Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

PRACTICE -5

[Q]1. Who invented C Language.? Examples are C and BASIC.


(A) Charles Babbage (B) Grahambel
(C) Dennis Ritchie (D) Steve Jobs [Q]6. Which program outputs "Hello World.." .?
उत्तर – C (A)
व्याख्या:- main()
Full name is Dennis MacAlistair Ritchie. He also {
invented Unix Operating System along with his scanf("Hello World..");
colleague Ken Thomson. }
(B)
[Q]2. C Language is a successor to which language.? main()
(A) FORTRAN (B) D Language {
(C) BASIC (D) B Language printf("Hello World..");
उत्तर - D }
(C)
[Q]3. C is a which level language.? main()
(A) Low Level (B) High Level {
(C) Low + High (D) None print("Hello World..");
उत्तर – B }
व्याख्या:- (D)
C is a high level language. Another example is main()
BASIC. {
scan("Hello World..");
[Q]4. Low level language is .? }
(A) Human readable like language. उत्तर - B
(B) language with big program size.
(C) language with small program size. [Q]7. C is _______ type of programming language.?
(D) Difficult to understand and readability is (A) Object Oriented (B) Procedural
questionable. (C) Bit level language (D) Functional
उत्तर – D
व्याख्या:-
PARIKSHA PLUS उत्तर – B
व्याख्या:-
Looks like raw data often in the form of 1's and 0's. C is a procedural language. It is written in a number of
steps using statements and functions. Logic is clearly
[Q]5. High level language is a .? depicted in the program. Procedural language is aslo
(A) Human readable like language. called Imperative Language. Examples are COBAL,
(B) language with small program size. BASIC etc.
(C) language with big program size.
(D) language which is difficult to understand and not [Q]8. C language was invented in which laboratories.?
human readable. (A) Uniliver Labs (B) IBM Labs
उत्तर – A (C) AT&T Bell Labs (D) Verizon Labs
व्याख्या:- उत्तर – C
PRACTICE -5
व्याख्या:- main()
C was invented in Bell Laboratories in New Jersey. {
/* Multi Line Comment
[Q]9. BCPL Language is also called..? This line is ignored by compiler
(A) C Language (B) B Language */
(C) D Language (D) None printf("Hello C..");
उत्तर – D }
व्याख्या:- (A) #include is a Preprocessor Directive
B language is successor of BCPL ( Basic Combned (B) <stdio.h> is a header file with predefined functions
Programming Language ). B language was invented like printf, scanf etc
by Ken Thomson. (C)
#include
[Q]10. C language was invented to develop which main()
Operating System.? {
(A) Android (B) Linux (C) Ubuntu (D) Unix
उत्तर – D }
व्याख्या:- is a mandatory function to be included in every C
C was invented to develop Unix Operating System to Program.
overcome compatibility with different Hardware (D) All the above
Platforms. उत्तर - D

[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

typedef, union, unsigned, void, volatile, while. (A) #include<stdio.h>


main()
[Q]31.Types of Integers are.? {
(A) short (B) int (C) long (D) All the above auto int a;
उत्तर – D printf("%d", a);
व्याख्या:- }
Size of int < long. //output is compiler error. a is not initialized.
(B) #include<stdio.h>
[Q]32.Find a correct C Keyword. main()
(A) Float (B) Int (C) Long (D) double {
उत्तर – D auto int a;
व्याख्या:- printf("%d", a);
All C Keywords are in lower case. }
//output = 0
[Q]33. Types of Integers are.? (C) #include<stdio.h>
Range of signed char and unsigned char are.? main()
(A) -128 to +127 0 to 255 {
(B) 0 to 255 -128 to +127 auto int a;
(C) -128 to -1 0 to +127 printf("%d", a);
(D) 0 to +127 -128 to -1 }
उत्तर – A //output = null
व्याख्या:- (D) #include<stdio.h>
Advantage of an unsigned representation is only to main()
increase the upper limit i.e positive limit. Size of a {
char remains same i.e 1 Byte. auto int a;
printf("%d", a);
[Q]34.Range of singed long and unsigned long }
variables are.? //output = some random number
PARIKSHA PLUS
(A) -2147483647 to +2147483648 0 to 4294967295 उत्तर – D
व्याख्या:-
(B) -2147483648 to +2147483647 0 to 4294967296
(C) -2147483648 to +2147483647 0 to 4294967295 Yes. If an integer is not initialized, some random
(D) 0 to 4294967295 -2147483648 to +2147483647 number in integer range will be displayed.
उत्तर – C
व्याख्या:- [Q]36. What is the output of the program.?
Size of a long variable is 4 Bytes or 32 bits. #include<stdio.h>
(2)^32. int main()
{
[Q]35. Choose a correct statement regarding automatic printf("Hello Boss.");
variables. }
(A) Hello Boss. (B) hello boss
PRACTICE -5
(C) No output (D) Compiler error उत्तर – B
उत्तर – D व्याख्या:-
व्याख्या:- Automatic and Register variables have only Block
Notice the return type int before main() method. So Scope. Always local definition takes precedence.
main should maintain a return 0; or return
somenumber; statement. [Q]39.What is the output of the C Program statement.?
register int b;
prinf("%d", b);
[Q]37. What is the output of the program.? (A) null
int main() (B) 0
{ (C) random integer number
auto int a=10; (D) random real number
{ उत्तर – C
auto int a = 15; व्याख्या:-
printf("%d ", a); auto and register variables hold garbage values by
} default.
printf("%d ", a);
return 1; [Q]40.What is the output the program.?
} int main()
(A) 10 10 (B) 10 15 {
(C) 15 10 (D) Compiler error register a=80;
उत्तर – C auto int b;
व्याख्या:- b=a;
Automatic or Register variables have block scope and printf("%d ", a);
life. Most recent definition takes precedence. {...} is a printf("%d ", b);
block. return -1;
}
[Q]38.What is the output of the program.? (A) Compiler error. You can not assign register value to
int main() PARIKSHA PLUS int variable.
(B) 80 80
{
register a=10; (C) 80 0 Register value can not be copied.
{ (D) Compiles, but output is none.
register a = 15; उत्तर - B
printf("%d ", a);
} [Q]41. What is the output of the program.?
printf("%d ", a); void myshow();
int main()
return 20; {
} myshow();
(A) 15 20 (B) 15 10 (C) 10 15 (D) 15 15 myshow();
PRACTICE -5
myshow(); (D) Compiler error
} उत्तर – D
void myshow() व्याख्या:-
{ You can not use Ampersand & operator with a
static int k = 20; Register variable. Register is part of CPU and
printf("%d ", k); accessing it is not authorized.
k++;
} [Q]44.The statement below is .....a
(A) 20 20 20 (B) 20 21 21 extern int p;
(C) 20 21 22 (D) Compiler error. (A) Declaration (B) Definition
उत्तर – C (C) Initialization (D) None of the above
व्याख्या:- उत्तर – A
Variable of type static holds its value until the end of व्याख्या:-
program execution. Static variables do not initialize Usually, most of the C statements with extern
again and again with function calls. keyword are Declarations.

[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);
}

[Q]66. What is the output of C Program.?


int main()
{
int k, j;
for(k=1, j=10; k <= 5; k++)
{
printf("%d ", (k+j));
}
return 0;
}
(A) compiler error (B) 10 10 10 10 10
(C) 11 12 13 14 15 (D) None of the above
उत्तर – C
व्याख्या:-
You can initialize any number of variables inside for
loop.

[Q]67.What is the output of C Program.?


int main()
{
int a=0, b=0; PARIKSHA PLUS
while(++a < 4)
printf("%d ", a);
while(b++ < 4)
printf("%d ", b);
return 0;
}
(A) 0 1 2 3 1 2 3 4 (B) 1 2 3 1 2 3 4
(C) 1 2 3 4 1 2 3 4 (D) 1 2 3 4 0 1 2 3
उत्तर – B
व्याख्या:-
(++a < 4) first increments and compares afterwards.

You might also like