Professional Documents
Culture Documents
Computer Practice Class - 5 PDF
Computer Practice Class - 5 PDF
[Q]11. C language was invented in the year.? [Q]15.Correct way of commenting a single line is.?
(A) 1999 (B) 1978 (C) 1972 (D) 1990 (A) /*printf("Hello C.."); printf("How are you.");
उत्तर - C (B) //printf("Hello C.."); printf("How are you.");
(C) /*printf("Hello C.."); printf("How are you.");*/
[Q]12. C language is used in the development of .? (D) /printf("Hello C..");/ printf("How are you.");
(A) Databases (B) Graphic applications उत्तर – B
(C) Word Processors (D) All of the above व्याख्या:-
उत्तर – D PARIKSHA PLUS Answer C comments two lines with Multi-Line
comment or BLOCK Comment characters /* ....*/
व्याख्या:-
C language is very efficient in using hardware Only // is a Single Line Commenting characters.
resources.
[Q]16.Single Line Comment // is also called.?
[Q]13. A C program is a combination of.? (A) C++ Style Comment
(A) Statements (B) Functions (B) Java Style Comment
(C) Variables (D) All of the above (C) PHP Style Comment
उत्तर - D (D) All the above
उत्तर - D
[Q]14. Choose correct Answer..
#include<stdio.h> [Q]17. What is an Identifier in C Language.?
PRACTICE -5
(A) Name of a Function or Variable C++.
(B) Name of a Macros
(C) Name of Structure or Union [Q]21.Find an integer constant.
(D) All the above. (A) 3.145 (B) 34
उत्तर – D (C) "125" (D) None of the above
व्याख्या:- उत्तर – B
int age=25; व्याख्या:-
//here age is an Identifier Integer constant is a full or whole number without any
decimal point. So 3.14 is a floating point number or
[Q]18.An Identifier may contain.? Real number.
(A) Letters a-z, A-Z in Basic character set. Unicode
alphabet characters other languages [Q]22.Find a Floating Point constant.
(B) Underscore _ symbol (A) 12.3E5 (B) 12e34
(C) Numbers 0 to 9 Unicode Numbers in other (C) 125.34857 (D) All the above.
languages उत्तर – D
(D) All the above व्याख्या:-
उत्तर - D Floating Point can be represented in two forms.
1. Fractional Form
[Q]19. An Identifier can start with.? eg. 12345.67
(A) Alphabet 2. Exponential Form
(B) Underscore ( _ ) sign (Mantissa)e(number) or (Mantissa)E(number)
(C) Any character that can be typed on a keyboard eg. 123.4567E2
(D) Option A & Option B (e2 = 10 power 2 = 100)
उत्तर – D
व्याख्या:- [Q]23. Find a Character constant.
Identifier is just a name given to a Function, Variable (A)
etc. 'A'
Identifier name should contain only Letter, Numbers 'a'
and Underscore. PARIKSHA PLUS (B)
'1'
[Q]20.C Programs are used in .? '9'
(A) Any Electronic device which works on some logic (C)
and Operating System. '$'
(B) Washing machine '#'
(C) Fridge, Microwave Ovens (D) All the above.
(D) All the above. उत्तर – D
उत्तर – D व्याख्या:-
व्याख्या:- A character constant contains only one character
C is very fast to execute and safe to embed along with within Single Quotes. ' '. Single Quote is typed using
microprocessors. Device drivers are written in C and Single Quote Double Quote Key near Enter Key in a
PRACTICE -5
Keyboard. Simply it is Right Single Quote. (A) C Compiler converts your C program into machine
Left Single Quote looks like this ` readable language.
Right Single Quote looks like this ' (B) C Editor allows you to type C Programs. It is just
like a Notepad with extra options.
[Q]24. A Variable of a particular type can hold only a (C) Console shows the output of a C Program if it is
constant of the same type. Choose right answer text output.
(A) TRUE (D) All the above
(B) FALSE उत्तर - D
(C) It depends on the place the variable is declared.
(D) None of the above. [Q]28. Identify wrong C Keywords below.
उत्तर – A (A) auto, double, int, struct
व्याख्या:- (B) break, else, long, switch
An int can hold only Integer constant. (C) case, enum, register, typedef
A float can hold only Real Number constants. (D) char, extern, intern, return
A char can hold only Character constants. उत्तर – D
व्याख्या:-
[Q]25. Choose a right statement. 'intern' is not a keyword. Remaining are all valid
(A) int myage = 10; int my_age = 10; keywords.
(B) int myage = 10; int my,age = 10;
(C) int myage = 10; int my age = 10; [Q]29. Identify wrong C Keywords below.
(D) All are right (A) union, const, var, float
उत्तर – A (B) short, unsigned, continue, for
व्याख्या:- (C) signed, void, default, goto
Only Underscore ( _ ) symbol is allowed in a variable (D) sizeof, volatile, do, if
name i.e identifier name. Space, Comma and other उत्तर – A
special characters are not allowed. व्याख्या:-
'var' is not a valid keyword.
[Q]26. Number of Keywords present in C Language are
.?
(A) 32 (B) 34 (C) 62 (D) 64
PARIKSHA[Q]30.
PLUS Identify wrong C Keywords below.
(A) static, while, break, goto
उत्तर - A (B) struct, construct, signed, unsigned
व्याख्या:- (C) short, long, if, else
Only 32 Keywords originally. Compilers are (D) return, enum, struct, do
individual companies can include and use extra उत्तर – B
keywords if required. Such keywords should preceed व्याख्या:-
with __ ( two Underscore symbols before names). construct is not a keyword.
eg. __mykeyword All 32 Keywords are given for reference. auto, break,
case, char, const, continue, default, do, double, else,
[Q]27. Choose a correct statement. enum, extern, float, for, goto, if, int, long, register,
return, short, signed, sizeof, static, struct, switch,
PRACTICE -5
[Q]42.What is the output of the program.? [Q]45. What is the output of the C statement.?
#include<stdio.h> int main()
static int k; {
int main() int a=0;
{ a = 4 + 4/2*5 + 20;
printf("%d", k); printf("%d", a);
return 90; return 0;
} }
(A) -1 (B) 0 (C) 90 (D) Compiler error (A) 40 (B) 4 (C) 34 (D) 54
उत्तर – B उत्तर – C
व्याख्या:- व्याख्या:-
Default value of a static variable is zero by default. / and * has equal priority. But associativity is from L
PARIKSHA PLUS
[Q]43. What is the output of the program.?
to R.
4 + 2*5 + 20
int main() 4 + 10 + 20 = 34
{
register k = 25; [Q]46. What is the Priority among (*, /, %), (+, -) and
printf("%d", &k); (=) C Operators.?
return 90; (A) (*, /, %) > (+, -) < (=)
} (B) (*, /, %) < (+, -) < (=)
(C) (*, /, %) > (+, -) > (=)
(A) prints of address of variable k. (D) (*, /, %) < (+, -) (+, -) == (=)
(B) 25 उत्तर - C
(C) 0
PRACTICE -5
[Q]47. What is the output of the C statement.? उत्तर – A
int main() व्याख्या:-
{ 5/2 is 2 only because both numerator and denominator
int a=0; are integers. So only int value i.e 2 is the result.
a = 4 + 4/2*5 + 20; 4 + 2 * 10 + 5
printf("%d", a); 4 + 20 + 5 = 29.
return 0;
} [Q]50. What is the output of the C Program.?
(A) 40 (B) 4 (C) 34 (D) 54 int main()
उत्तर – C {
व्याख्या:- int a=0;
/ and * has equal priority. But associativity is from L a = 10 + 2 * 12 /(3*2) + 5;
to R. printf("%d", a);
4 + 2*5 + 20 return 0;
4 + 10 + 20 = 34 }
(A) 31 (B) 19 (C) 11 (D) 29
[Q]48. What is the output of the C Program.? उत्तर – B
int main() व्याख्या:-
{ Paranthesis changes the associativity of operators.
int a=0; 10 + 2 * 12 / (3*2) + 5;
a = 10 + 5 * 2 * 8 / 2 + 4; 10 + 24 / (3*2) + 5;
printf("%d", a); 10+ 24/6 + 5;
return 0; 10 + 4 + 5 = 19;
}
(A) 124 (B) 54 (C) 23 (D) 404 [Q]51.What is the output of the C Program.?
उत्तर – B int main()
व्याख्या:- {
10 + 10*8/2 + 4 int a=0;
10 + 80/2 + 4
10 + 40 + 4 = 54
PARIKSHA PLUS a = 10 + 2 * 12 / 3 * 2 + 5;
printf("%d", a);
return 0;
[Q]49. What is the output of the C Program.? }
int main() (A) 19 (B) 31 (C) 11 (D) 25
{ उत्तर – B
int a=0; व्याख्या:-
a = 4 + 5/2*10 + 5; 10 + 2 * 12 / 3 * 2 + 5;
printf("%d", a); 10 + 24/3*2 + 5;
return 0; 10 + 8*2 + 5;
} 10 + 16 + 5 = 31;
(A) 29 (B) 5 (C) 4 (D) 34
PRACTICE -5
[Q]52. What is the output of the C Program.? return 0;
int main() }
{ (A) 0 (B) -4 (C) -2 (D) 2
float a=10.0; उत्तर – D
a = a % 3; व्याख्या:-
printf("%f", a); 14%5 = 4 ( Reminder)
return 0; 14 % -5 = 4. Yes sign of the reminder is the sign of
} Numerator.
(A) 0 (B) 1 (C) 1.000000 (D) Compiler error. 4- 2 = 2;
उत्तर – D
व्याख्या:- [Q]55. What is the output of the C Program.?
You can use the operator Modulus Division % with int main()
only integers. {
error: invalid operands to binary % (have ‘float’ and int a= 3 + 5/2;
‘int’) printf("%d", a);
a = a % 3; return 0;
^ }
(A) 3
[Q]53.What is the output of the C Program.? (B) 2
int main() (C) 5
{ (D) Can not assign an expression to variable at the time
float a=10.0; of declaration.
a = (int)a % 3; उत्तर – C
printf("%f", a); व्याख्या:-
return 0; Assignment Operator = in C language has the least
} priority. So the right hand side expression is evaluated
(A) 0 (B) 1 (C) 1.000000 (D) Compiler Error. first and then assigned to the left side variable.
उत्तर – C a = 3 + 5/2;
व्याख्या:- PARIKSHA PLUS
Type casting from float to int is done by (int).
a = 3 + 2;
a = 5;
(int)10.000000 = 10;
10%3 = 1. Reminder of the division of 10 by 3. [Q]56.What is the output of the C statement.?
%f in printf prints it as 1.000000. int main()
{
[Q]54. What is the output of the C Program.? int a=0;
int main() a = 5<2 ? 4 : 3;
{ printf("%d",a);
int a=0; return 0;
a = 14%-5 - 2; }
printf("%d", a); (A) 4 (B) 3 (C) 5 (D) 2
PRACTICE -5
उत्तर – B return 0;
व्याख्या:- }
5<2 is false. So 3 will be picked and assigned to the (A) 0 (B) 1 (C) 8 (D) compiler error
variable a. उत्तर – B
व्याख्या:-
[Q]57.What is the output of C Program.? expression1 = empty
int main() expression2 = 8
{ If no expression is specified, it will be treated as 1.
int a=0;
a = printf("4"); [Q]60.What is the output of C Program.?
printf("%d",a); int main()
return 0; {
} int a=0, b;
(A) 04 (B) compiler error (C) 40 (D) 41 a = (5>2) ? b=6: b=8;
उत्तर – D printf("%d %d",a, b);
व्याख्या:- return 0;
a = printf("4"); }
First printf prints 4. printf() returns 1. Now the (A) 6 6 (B) 0 6 (C) 0 8 (D) compiler error
variable a=1; So 1 is printed next. उत्तर – D
व्याख्या:-
[Q]58. What is the output of the C Program.? Compiler error. a = (5>2) ? b=6: b=8; should be
int main() written as a = (5>2) ? b=6: (b=8);
{ main.c: In function ‘main’:
int a=0; main.c:14:23: error: lvalue required as left operand of
a = 5>2 ? printf("4"): 3; assignment
printf("%d",a); a = (5>2) ? b=6: b=8;
return 0;
} [Q]61. What is the output of the C Program.?
उत्तर – C
PARIKSHA PLUS
(A) compiler error (B) 14 (C) 41 (D) 0 int main()
{
व्याख्या:- if( 4 > 5 )
5>2 is true. So expression1 i.e printf("4) is executed {
printing 4. Function printf() returns 1. So a value is 1. printf("Hurray..\n");
}
[Q]59. What is the output of the C Program.? printf("Yes");
int main() return 0;
{ }
int a=0; (A) Yes (B) Hurray.. Yes
a = (5>2) ? : 8; (C) Hurray..Yes (D) Compiler error
printf("%d",a); उत्तर – A
PRACTICE -5
व्याख्या:- printf statements or remove second printf after IF.
if condition fails. So control will not enter Hurray
printf statement. [Q]64. What is the output of C Program.?
int main()
[Q]62. What is the output of the C Program.? {
int main() int a=5;
{ while(a=123)
if( 4 > 5 ) {
printf("Hurray..\n"); printf("RABBIT\n");
printf("Yes"); break;
return 0; }
} printf("GREEN");
(A) Yes (B) Hurray.. Yes return 0;
(C) Hurray..Yes (D) No Output }
उत्तर – A (A) GREEN
व्याख्या:- (B) RABBIT GREEN
To include more than one statement inside If block, (C) RABBIT is printed unlimited number of times.
use { } braces. Otherwise, only first statement after if (D) Compiler error.
block is included. IF condition fails with false. So उत्तर – B
second if which is outside of If is executed. व्याख्या:-
while(a=123) = while(123) = while(Non Zero
[Q]63. What is the output of the C Program.? Number). So while is executed. BREAK breaks the
int main() loop immediately. Without break statement, while
{ loop runs infinite number of times.
if( 4 < 5 )
printf("Hurray..\n"); [Q]65.hat is the output of C Program.?
printf("Yes"); int main()
else {
printf("England") PARIKSHA PLUS int k;
return 0; for(k=1; k <= 5; k++);
} {
(A) Hurray..Yes (B) Hurray.. Yes printf("%d ", k);
(C) Compiler error (D) None of the above }
उत्तर – C return 0;
व्याख्या:- }
If block includes only Single Hurray printf statement (A) 1 2 3 4 5 (B) 1 2 3 4 (C) 6 (D) 5
without curly braces { }. So second Yes printf उत्तर - C
statement is not part of IF block. Else should व्याख्या:-
immediately follow IF block. Otherwise, compiler Semicolon at the end of for(); isolates the below
throws errors. To compile well, use { } braces for two print() block. After for loop is over, k value is 6.
PRACTICE -5
for(k=1; k <= 5; k++) (b++ < 4) first compares and increments afterwards.
{
;
}
{
printf("%d ", k);
}