1 What would be the output of the following programs? #include<stdio.

h> void main( ) { int a = 300, b, c ; if ( a >= 400 ) b = 300 ; c = 200 ; printf ( "\n%d %d", b, c ) ; getch( ); } A 300 200 B Some garbage value and 200 will be printed C No output D None of the above Answer B 2 What would be the output of the following programs? #include<stdio.h> void main( ) { int a = 500, b, c ; if ( a >= 400 ) b = 300 ; c = 200 ; printf ( "\n%d %d", b, c ) ; getch( ); } A 300 200 B Some garbage value and 200 will be printed C No output D None of the above Answer A 3. What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 10, y = 20 ; if ( x == y ) ; printf ( "\n%d %d", x, y ) ;

getch( ); } A Error is present B No error but no output C 10 20 D 10 10 Answer C 4. What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 3, y = 5 ; if ( x == 3 ) printf ( "\n%d", x ) ; else ; printf ( "\n%d", y ) ; getch( ); } A 3 B 5 C error: misplaced else D 35 Answer D 5. What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 3 ; float y = 3.0 ; if ( x == y ) printf ( "\nx and y are equal" ) ; else printf ( "\nx and y are not equal" ) ; } A x and y are equal B x and y are not equal C error: float can not be compared with integer value D None of the above

Answer A 6. What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 3, y, z ; y = x = 10 ; z = x < 10 ; printf ( "\nx = %d y = %d z = %d", x, y, z ) ; getch( ); } A Error: Lvalue required B x=10 y=10 z=0 C x=10 y=3 z=0 D x=3 y=10 z=1 Answer B 7. What would be the output of the following programs? #include<stdio.h> void main( ) { int k = 35 ; printf ( "\n%d %d %d", k == 35, k = 50, k > 40 ) ; getch( ); } A 35 50 40 B 110 C 0 50 0 D 1 50 1 Answer C 8. What would be the output of the following programs? #include<stdio.h> void main( ) { int i = 65 ; char j = ‘A’ ; if ( i == j ) printf ( “C is WOW” ) ; else

printf( "C is a headache" ) ; getch( ); } A C is WOW B C is a headache C Error: cannot compare int with char D None of the above Answer A 9. Point out the errors, if any, in the following programs. #include<stdio.h> void main( ) { float a = 12.25, b = 12.52 ; if ( a = b ) printf ( "\na and b are equal" ) ; getch( ); } A Error: Wrong condition for if B No Error, output: a and b are equal C No Error, output: a and b are not equal D Error: Curly braces missing for if Answer B 10. Point out the errors, if any, in the following programs. #include<stdio.h> void main( ) { if ( 'X' < 'x' ) printf ( "\nascii value of X is smaller than that of x" ) ; getch( ); } A Error: Wrong condition for if B Output: ascii value of X is smaller than that of x C No error, no output D Error: undefined symbol X Answer B

11.

What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 10 ; if ( x >= 2 ) then printf ( "\n%d", x ) ; getch( ); }

A B C D Answer 12.

10 No error, no output Error.’then’ can not be used in C 2 C What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 10, y = 15 ; if ( x % 2 = y % 3 ) printf ( "\nCarpathians" ) ; getch( ); }

A B C D Answer 13.

Error: Lvalue required Output: Carpathians No error, no output None of the above A What would be the output of the following programs? #include<stdio.h> void main( ) { int x = 30 , y = 40 ; if ( x == y ) printf( "x is equal to y" ) ; elseif ( x > y ) printf( "x is greater than y" ) ; elseif ( x < y ) printf( "x is less than y" ) ;

else printf ( "\nDosa" ) . } A B C D Answer 14. } A B C D Answer 15. This is a game you have to play it.getch( ). This is a game You have to play it. z = 12 .h> void main( ) { int i = 4. scanf ( "%d %d". if ( a > b ) . } A B C Dean of students affairs Dosa Error .h> void main( ) { int a. if ( i = 5 || z > 50 ) printf ( "\nDean of students affairs" ) .a. getch( ). Error: Misplaced else D What would be the output of the following programs ? #include<stdio. x is less then y x is equal to y x is greater than y Undefined symbol elseif D What would be the output of the following programs? #include<stdio. b . printf ( "This is a game" ) . else printf ( "You have to play it" ) . b ) .

if ( a > 40 && a < 45 ) printf ( "a is greater than 40 and less than 45" ) .h> void main( ) . else printf ( "\nWish C was free !" ) . Let us C Error Wish C was free Let us C Wish C was free A What would be the output of the following programs? #include<stdio.h> void main( ) { int a = 40 . z = 12 . } A B C D Answer 18.h> void main( ) { int i = 4. None of the above A What would be the output of the following programs? #include<stdio. getch( ). getch( ). else printf ( "%d". a is greater than 40 and less than 45 40 Both A and C are correct None of the above B What would be the output of the following programs? #include<stdio. a ) . } A B C D Answer 17.D Answer 16. if ( i = 5 && z > 5 ) printf ( "\nLet us C" ) .

j = 1. k = i && j .h> void main( ) { int i = -1. k . } A B C D Answer 19. 10 12 01 -1 1 D What would be the output of the following programs ? #include<stdio. q = 20 . Why not C Definitely C Why not C Definitely C None of above A What would be the output of the following programs? #include<stdio. getch( ). j ) . } A B C D Answer 20. num . getch( ).h> void main( ) { int i = -4. getch( ). printf ( "\n%d". if ( p == 5 && q > 5 ) printf ( "\nWhy not C" ) . j ) .l .{ int p = 8. . j = ( num < 0 ? 0 : num * num ) . printf ( "%d %d". i. l = i || j . j. else printf ( "\nDefinitely C !" ) .

num = 30 . num ) . getch( ). k = ( num > 5 ? ( num <= 10 ? 100 : 200 ) : 500 ) .} A B C D Answer 21. (!j!=1?printf(“Welcome\n”):printf(“Good Bye\n”).h> void main( ) { int k. 100 200 500 None of above B What would be the output of the following programs? #include<stdio. getch(). 0 -4 Unpredictable None of above C What would be the output of the following programs? #include<stdio. } A B C D Answer Garbage value Error Good Bye Welcome D . printf ( "\n%d". } A B C D Answer 22.h> void main() { int j=4.

i). Error 10 Infinite Loop None of above C What would be the output of the following programs? #include<stdio. while(x= =1) { x=x-1. while(i<=10).23. } A B C D Answer 24. What would be the output of the following programs? #include<stdio. } A B C D Answer 25. } getch( ).h> void main( ) { int i=1. Garbage value 4321 1234 No Output D What would be the output of the following programs? . { printf(“%d\n”.h> void main( ) { int x=4.x). printf(“%d\n”. --x. } getch( ). i++.

} .x. Error No Output malyaliam is a palindrome None of above C What would be the output of the following programs? #include<stdio.h> void main( ) { while(‘a’<’b’) printf(“malyaliam is a palindrome\n”). getch( ). y=--x.h> void main( ) { int x=4.z.#include<stdio.z). z=x--. i=i+1.h> void main( ) { int i. printf(“%d%d%d\n”. } A B C D Answer 26. while(i=10) { printf(%d\n”.y. getch( ). } A B C D Answer 27.y.i). 233 333 423 None of above A What would be the output of the following programs? #include<stdio.

else printf(“\n%d%d”. } getch( ).h> void main( ) { int x=4. if(x= =y) continue.getch( ).y=0.y=0. while(x>=0) { x--. } A B C D Answer 28.y). y++.z. } A B C D 4 No Output Error 31 13 04 -1 5 Answer 29. D What would be the output of the following programs? #include<stdio.x.z. Error No Output 123456789 Infinite Loop D What would be the output of the following programs? #include<stdio. while(x>=0) .h> void main( ) { int x=4.

else printf(%d%d\n”. A semicolon. A newline A What is required to avoid falling through from one case to the next? end. x--. A B C D Answer 32.y). B What keyword covers unhandled possibilities? all contingency default Other C .x. } getch( ). break. Stop. } A B C Error No Output 40 31 D Answer 30. A B C D Answer Infinite Loop C Which follows the case statement? : . y++.{ if(x= =y) break. A B C D Answer 31.

case 0: printf("Zero"). switch(x) { case 1: printf("One").33. clrscr(). B A 'default' case is required in the switch statement? True False B The __________ statement when executed in a switch statement causes immediate exit from the structure. case 2: printf("Hello) World". A B C D Answer 36. case switch break default C What would be the output of the following programs? void main() { int Number. A B C D Answer 35. A B C D Answer 37. . } One Zero Hello World ZeroHello World D A program stops it's execution when a break statement is encountered? True False A B C D Answer 34. What is the result of the following code? int x=0.

y=1 and z=0 initially.com www. z=2. . } A B C D Answer 38. x: printf("cprogramming").com"). goto z. x = 0 and y = 2 x = 1 and y = 2 x = 1 and y = 0 none of the above A Assuming that x=2.expertcprogramming.com www. break. what will be their values after executing the following code segment switch(x) { case 2: x=1. y=0. case 1: x=0."). what will be their values after executing the following code segment switch(y) { case 0: x=0.com none of the above B Assuming that x=2. case 2: x=2. y=0. goto y. y=x+1. z: printf(". y: printf("expert").y=1 and z=0 initially.cprogrammingexpert. } A B C D Answer 39.printf("www. www. default: x=1. break. getch(). goto x.

n. } A B C D Answer 40.p). print: printf("m=%d.p=2 C What will be the value of x after executing the following code? int x=10.n=0.p=0. y=2. x=(x==y)?(y+x):(y-x). .n=0.p=%d".n=%d. } A B C D Answer 41. switch (ch) { case 'a': printf("A"). if( m + n + p == 2) goto print. x = 1 and y = 2 x = 2 and y = 2 x = 0 and y = 0 x = 0 and y = 1 A What will be the output of following program? main() { int m=0.n=2.y=15. case 'b': printf("B"). nothing will be printed on the screen m=0.m. default : printf("C"). 1 0 25 5 D What will be output of following segment? char ch = 'a'.p=0 m=2.n=0.default: x=1. } A B C D Answer 42.p=2 m=0.

break. } } . (Ex3) switch ( x+y ) (Ex4) switch (x) {case 2: y = x + y. switch(choice) { default : printf("nI am in Default"). case 3 : printf("nI am in case 3"). Ex2 will raise an error All statements are correct. Asuming that x and y are of of int type variables and x=1 and y=2 (Ex1) switch(y). case 1 : printf("nI am in case 1"). All statements will raise an error Ex3 and Ex4 are error-free. break. A B C ABC D Find which of the following switch related statements has error. Ex1 and Ex2 will raise an error Ex1 Ex3 and Ex4 are error-free. void main() { int choice = 7 . (Ex2) case 10.} A B C D Answer 43. A B C D Answer 44.}. break. break. C Find the output of following code. case 2 : printf("nI am in case 2").

} } A B C D Answer 46. case 3 : printf("\nWater turns into Gas"). break. switch(choice) { printf("\nI am in switch"). int a = 2. case 2 : printf("\nUS is Great Country").A B C D Answer 45. break. break. case 1 : printf("\nWhat are You Doing in Mumbai"). What are You Doing in Mumbai Error Water turns into Gas US is Great Country A What would be the output of the following programs? void main() { int choice = 1. Error I am in case 3 nI am in case 2 A What would be the output of the following programs? void main() { int choice = 1 . switch(choice) { case 1 : . I am in Default n I am in case 1.

} } A B C D Yes No . break. case 9/3 : printf("\nDon't Use Pointer"). break. break. case 1 : printf("\n3 Idiots is Funny Movie"). } } A B C D Answer 47. Variables are not allowed in Case Labels Default is absent No continue statement in Statement All Cases in switch are unique A Is this program is Error free void main() { int choice = 2 . switch(choice) { case 1 : printf("\nYour Time Starts now"). case a : printf("\nMy name is Pritesh A Taral"). break.printf("\nC Programming is Very Funny Language"). break. case 7-8+3 : printf("\nWhy to Learn C Programming"). break.

Variable is not allowed in Case"). case 3 : . break. int Num = 3. break. case Num : printf("\nI think . Error I think . { case 1 : printf("\nAllas"). case 2 : printf("\nBabo").Answer 48. case 7-8+3 : printf("\nWhat do you Think ?"). break. break. } } A B C D Answer 49. Variable is not allowed in Case What do you Think? Sachin Tendulkar is better than any other Cricketer in the World A What would be the output of the following programs? void main() { int choice = 2 . switch(choice) { case 1 : printf("\nSachin Tendulkar is better than any other Cricketer in the World"). switch(choice). A What would be the output of the following programs? void main() { int choice = 2 . break.

Error Babo Allas Hurray A What would be the output of the following programs? void main() { int choice = 2 . break. switch(choice) { case 1 : printf("\nAllas"). continue. } printf(" Finally I am in main ").printf("\nHurray"). break. case 2 : printf("\nBabo"). Yes No . } A B C D Answer 50. switch(choice) { } } Question : Is this program is error free A B C D Answer 51. A What would be the output of the following programs? void main() { int choice = 2 .

Babo Error : Misplaced continue Hurray Allas B What would be the output of the following programs? void main() { int choice = 2 .1 : printf("\nAllas"). break.case 3 : printf("\nHurray"). break. switch(choice) { case 1. Babo Error : Multiple Parameter's not allowed Hurray Allas A What would be the output of the following programs? void main() { . break.2.3. case 4. } } A B C D Answer 53.3 : printf("\nHurray"). case 1.5. break.2 : printf("\nBabo"). } } A B C D Answer 52.

switch(choice<<1) { case 2: printf("\nAllas"). break. break. switch(choice. case 2: printf("\nBabo").choice+2) { case 1: printf("\nAllas").int choice = 1 . break. case 4: printf("\nBabo"). case 3: printf("\nHurray"). break. break. break. } } A Babo .choice+1. } } A B C D Answer 55 Babo Error : << is not allowed Hurray Allas D What would be the output of the following programs? void main() { int choice = 1 . case 8: printf("\nHurray").

Yes No A What would be the output of the following programs? void main() { int choice = 2 . break. break. break. } } Question : Does Expressions are allowed in Case Labels A Yes . case 2/2*3 : printf("\nCase 3"). case 'B' : case 'b' : printf("\nB for Ball"). } } Question : Will this program works A B C D Answer 56. switch(choice) { case 1+2/3 : printf("\nCase 1").B C D Answer 55. Error : Variables are not allowed Hurray Allas C What would be the output of the following programs? void main() { int choice = 1 . break. switch(choice) { case 'A' : case 'a' : printf("\nA for Apple").

break. break. } } Question : Is it necessary to have Case Labels greater than Zero? A B C D Answer 58.B C D Answer 57. switch(choice) { case -1 : printf("\nCase -1"). break. } } Question : Is it working properly ? A Yes . break. No A What would be the output of the following programs? void main() { int choice = -2 . case '1' : printf("\nCase -2"). case -2 : printf("\nCase -2"). switch(choice) { case 1 : printf("\nCase -1"). Yes No B What would be the output of the following programs? void main() { int choice = -2 .

2 : printf("\nCase 10. break.1").1 : printf("\nCase 10. . case =10 : printf("\nEqual to 10"). case 10.3 : printf("\nCase 10. Yes No B What would be the output of the following programs? void main() { float choice = 10. No A What would be the output of the following programs? void main() { int choice = 10 . switch(choice) { case 10.1 . case >10 : printf("\nGreater than 10"). switch(choice) { case <10 : printf("\nLess than 10"). } } Question : Is it working properly? A B C D Answer 60. break.2").B C D Answer 59. break. break. case 10. break. break.3").

} i -= 4. case 2: printf(" M. } printf("i = %d\n". B What will the output of the sample code below be? int i = 4. case 3: i += 5. switch(check){ case 1: printf("D.Steyn"). break. A B C D Answer 62. case 8: i += 5. i *= 2. break. if ( i == 8) { i++.} } Question : Is it working properly ? A B C D Answer 61. if (i == 9) break.W.Johnson"). switch (i) { default: .G. Yes No .h> void main(){ int check=2. i). i=5 i=2 i=8 i=10 A what is the output of following? #include<stdio.

Johnson M. M. 3 Idiots Ghajini Krrish Race Race Ghajini Krrish Race Compilation error B What will be output when you will execute following c code? #include<stdio.E.G.Muralidaran").Muralidaran Compilation error C What will be output when you will execute following c code? #include<stdio.Johnson Mohammad Asif M. } } A B C D Answer 64.K Hussey"). } A B M.case 3: printf(" Mohammad Asif").G. muralidaran M.h> void main(){ int movie=1. de villiers"). default: printf(" M. else if(a>20) printf("M. Dhoni").h> void main(){ int a=100.B. } } A B C D Answer 63. case 4: printf(" Ghajini"). switch(movie<<2+movie){ default:printf("3 Idiots"). de villiers . Dhoni A. else if(a>30) printf("A.S. if(a>10) printf("M. case 5: printf(" Krrish").S.B. case 8: printf(" Race").

K Hussey A. switch(money. Willian Warren Lawrence Inqvar Compilation error B What will be output when you will execute following c code? #include<stdio. case L*4:printf("Inqvar"). de Villiers D Answer 65. case L*2:printf("Warren"). default: printf("Lawrence").money*2){ case L: printf("Willian"). A B C D Answer 66.E.B. break. Compilation error: More than one conditions are true A Within a switch statement Continue can be used but Break cannot be used Continue cannot be used but Break can be used Both Continue and Break can be used Neither Continue nor Break can be used B What will be output when you will execute following c code? #include<stdio. switch(5/4/3){ . break. case L*3:printf("Carlos").S Dhoni M. } } A B C D Answer 67. break.C M. break.h> #define L 10 void main(){ int money=10.h> void main(){ int const X=0.

Clinton Gates Compilation Error Gandhi C what is output for below code #include<stdio. } return 0. } A B C D Answer 69. case j: printf("BAD").j=2.h> int main(void) { int i=1.").case X: printf("Clinton"). switch(i) { case 1: printf("GOOD"). good bad error no output C Point out the error. switch(a) { } printf("This is c program.break. case X+2:printf("Gates"). case X+1:printf("Gandhi"). default: printf("Brown"). if any in the program. #include<stdio.break. break. break.h> int main() { int a = 10. break. return 0. . } } A B C D Answer 68.

h> int main() { int i = 1. if any in the program.h> int main() { int a = 5. } return 0. break. } A B C D Answer 71. switch(a) { case 1: printf("First"). case 1: printf("Case1"). case 2: printf("Case2"). #include<stdio. . switch(i) { printf("This is c program.} A B C D Answer 70. Error: No case statement specified Error: No default specified No Error Error: infinite loop occurs C Point out the error."). Error: No default specified Error: Invalid printf statement after switch statement No Error and prints "Case1" None of above C Which of the following errors would be reported by the compiler on compiling the program given below? #include<stdio. break.

for(i=0. break.i<x.case 2: printf("Second"). } return 0. No Output Error is present None of the above C What is the result of the following code? int x=0. case 5: printf("Final"). Final No Error.i+=3){ printf("Start "). switch(x) { case 1: printf( "One" ). } A B C D Answer 72. One Zero Hello World ZeroHello World D What will be output of following c code? #include<stdio.h> int main(){ int x=011. case 0: printf( "Zero" ). case 3 + 2: printf("Third"). case 2: printf( "Hello World" ). . } A B C D Answer 73.i.

. } return 0. Within a switch Stmt outside a case stmt After a switch stmt Before a switch stmt A The goto statement transfers control to a label. The given label must reside in the _____function and can appear before only one statement in the same function.continue. Same Different Inside Outside A When we use the case control structure ? To choose one from multiple alternatives To switch from one instruction to another To make the execution fast None of above A A B C D Answer 76.. printf("End"). A B C D Answer 75. } A B C D Answer 74. Start start start start start start None of above C The break stmt is frequently used to terminate the processing of a particular case . A B C D Answer ..

case X+1:printf("Gandhi"). { case 0: printf("Its morning time"). switch(suite). .77. case 1: printf("Its evening time"). switch(5/4/3){ case X: printf("Clinton"). } } A Error B Its morning time C Its evening time D None of above Answer A 79. The case keyword is followed by ? A Float values B Character values C integer values D Both b and c Answer D 78. What will be output when you will execute following c code? #include<stdio. The value that follows the keyword CASE may only be ? A Constant B Variable C Semicolon D number Answer A 80. case X+2:printf("Gates"). break.h> void main(){ int const X=0. What will be the output of following ? void main( ) { int suite =1. break.

Control structures includes: A sequential B selection .break. default: printf("Brown"). When does the code block following while(x<100) execute? A When x is less than one hundred B When x is greater than one hundred C When x is equal to one hundred D While it wishes Answer A 83. } } Choose all that apply: A Clinton B Compilation error C Gandhi D Gates Answer B 81. What is the final value of x when the code int x. x++) {} is run? A 10 B 9 C 0 D 1 Answer A 82.while C while D repeat until Answer D 84. x<10. Which is not a loop structure? A for B do . for(x=0.

x. } .h> int main( ) { int x=10. Break. What will be the output of following code ? #include<stdio. if(x = = y) printf("%d%d". return 0. Case ‘R’ : puts (“I II III”).C iteration D All Answer D 85. Swich (x) { Case ‘b’ : puts(“0 1 001”). What will be the output of the following program ? Void main () { Char x=’d’. The do-while statement lets you repeat a statement or compound statement until a specified expression becomes: A True B False C D Answer A 87. } } A 1 2 3 B 0 1 001 C I II III D None of the above Answer A 86.y=20. Default : puts(“1 2 3”). Break.y).

Which of the following statement is used to take the control to the beginning of the loop ? A exit B break C continue D None of these Answer C 89. A do .while loop is useful when we want that the statement within the loop must be executed ? A only once B at least once C more than once D None of above Answer B 90. The statement that transfer control to the beginning of the loop is called ? A break statement B exit statement C continue statement . What would be the output of the following programs? #include<stdio.i<=5. for(i=1.printf("%d".h> void main( ) { int i. i++.A Garbage values B Raise an error C Prints Nothing D None of above Answer C 88. } A Error B Garbage values C 1 to 5 D Infinite loop Answer D 91.i)).

for(x=-1. i. printf ( "\n%d %d\n". } } } A 12 12 B 12 21 . } return 0. j . j ) .D goto statement Answer C 92. j <= 2 . How many times "HELLO" is get printed? #include<stdio. else break. printf("HELLO "). i++ ) { for ( j = 1 . x++) { if(x < 5) continue. What will be the output of the program? main( ) { int i. } A Infinite times B 11 times C 0 times D 10 times Answer C 93. i <= 2 .h> int main() { int x. for ( i = 1 . j++ ) { if ( i == j ) continue . x<=10.

i<=10. int b = 12. } printf(" %d". A x=0 B x=1 C x=3 D x=4 Answer D 94. What will be printed when the sample code is executed? int x = 0. a+=2.i). x<4. b-=2. x). while(a<b){ printf("In the loop"). Consider following code int a = 6. } A 12345 B 01234 C 54321 D Error Answer B 95. } . What will be output when you will execute following c code? Example for(i=0. printf("x=%d\n".C 21 12 D None of these Answer B 94. for (x=1.i++) { if(i==5) { break. x++).

B continue transfers the control flow to the conditional statement of the for loop. Which of the following is true regarding the continue statement in a for loop? A continue transfers the control flow to the initialization statement of the for loop. return 0. return 0.h> int main(){ int i=2.j=2. What will be output of following c code? #include<stdio.i). C continue transfers the control flow to the update statement of the for loop. What will be output of following c code? #include<stdio.3.j. i=j=2. while(i+1?--i:j++) printf("%d".How many times is the phrase "In the loop" printed? A 1 B 2 C 3 D 4 Answer B 96. } A 2 B 1 C 3 D compiler error Answer B 97. while(--i&&j++) printf("%d %d".i. D continue transfers the control flow to the statement just after the for loop Answer C 98. } A 23 B 13 .h> int main(){ int i.j).

‘O’). ‘L’).h> int main() { . Case ‘E’: printf(“%c”. Case ‘L’: printf(“%c”. Case ‘L’: printf(“%c”.) { printf("%d ". What will be the output of the program? #include<stdio. ‘H’).C 12 D 11 Answer B 99. Case ‘O’: printf(“%c”. Clrscr (). ‘E’). What will be output of following c code? #include<stdio. Switch(x) { Case ‘H’: printf(“%c”. } A 10 B 0 C Logical error D Infinite loop Answer D 100. } } A HELLO B HELlo C H D None of this Answer A 101.h> int main(){ for(. } return 0. What will be the output of the following program? Void main () { Char x=’H’. ‘L’).10)..

A do while loop is useful when we want the statements within the loop must be executed A atleast once B more than once C exactly once D none of the above Answer A 105. } A 3456 ... 32767 .i++) { printf("%d".unsigned int i = 65535. The minimum number of times the do while loop is executed is A cannot be predicted B 1 C 0 D 2 Answer B 104.. return 0.(i+2)). } A Infinite loop B 0 1 2 . printf("\n").i!=5.. what is the output for below code for(i=1. 65535 C 0 1 2 . /* Assume 2 byte integer*/ while(i++ != 0) printf("%d".++i).32766 -32765 -1 0 D No output Answer A 102 The minimum number of times the while loop is executed is A 1 B 0 C cannot be predicted D Non of the above Answer B 103.

C for(.).) D for(. The keyword else can be used with A if statement B Switch () statement C do…while () statement D None of the above Answer A 109.i=1) { printf("%d ".B 345 C 3 5 7 9 11 D 12345 Answer A 106. if(i!=1) break. for(i=0. } A 1 B 2 C 3 . } return 0. Which of the following declaration of for statement is syntactically correct? A for().i). What will be output of following c code? #include<stdio.i=-1..) Answer D 108. The minimum number of times the for() loop is executed is A 1 B 0 C cannot be predicted D Non of the above Answer B 107.h> int main(){ int i=1. B for(.

What is the output of the following code: void main() { int n. for(n=0. The general form of for statement in C is A for(initialize counter.n++).n). } A c++ B 0123 C c++0 1 2 3 D None of the above Answer C 112. printf(\"%d\". } return 0. increment counter.D 4 Answer A 110. int i={ printf("c" "++").h> int main(){ int x=123. } A 3 B 2 C 12 D 123 Answer A 111.n<=2. } for(x=0. What will be output of following c code? #include<stdio.x<=i.x++){ printf("%d ". test counter) .x).

test counter) C for(test counter. increment counter. } A 0 B 1 C 2 D 4 Answer A 114. return 0. #include<stdio.b=7. What will be output of the following program? #include<stdio. i++).c).14L)).14f). while() { printf("%d\n". D for(initialize counter.h> int main(){ int a=2.B for(increment counter. } A 1 24 B 268 C 123 D 8 4 10 Answer D 115. initialize counter.c=10.h> int main(){ printf("%d %d %d". test counter. printf("%d".sizeof(3.14). initialize counter). What will be output of the following program? #include<stdio.h> int main() { int i=1.sizeof(3. increment counter) Answer D 113. Point out the error. if(i>10) . if any in the while loop. c = a==b.sizeof(3. return 0.

2. 4. 3.h> int main() { int i=0. for(. i<=5. } return0. 4 D 6 Answer D 117. 116.h> void main() { print("Hello World") getch().break. i++). return 0. 1. 5 B 5 C 1.h> #include<conio. 2.What will be output of the following c program? #include<stdio.". D No error Answer A Question What will be the output of the program? #include<stdio. 3. } A There should be a condition in the while loop B There should be at least a semicolon in the while C The while loop should be replaced with for loop. } A 0. i). } A Hello World B No Output will be printed C Compile Error . printf("%d.

h> void main() { int x=10.D hello world Answer C 118. after if(x!=y) would produce an error D The program will not produce any output Answer B Question The control statement that allows us to make a decision from number of choices is called as _____ . for(i=1. printf(\"x=%dy=%d\".y).x. } A The printf function is called10 times B The program will produce the output x=10 y=1 C The .b=12. if(a==b) printf(“a and b are equal”). A if-else B switch C for D do-while Answer B 120.i<=10. Which of the following statements are true for the following Program? #include<stdio. void main() { int a=12.i++) if(x!=y). } What will be the output of the sample code shown above? A 12 B compile time error . y=100%9.

execution of the body.case statement? A Character B Integer C Float D Enum Answer C 125. Which of the following statement transfers the control to the beginning of the loop? A Exit B Break C Continue D None of the above Answer C 122. execution of the body . A Case B switch C else---if D if-------else Answer D 124. The two way selection is implemented using _______ statement. condition testing B Execution of the body. condition testing. C : D None of the above Answer D 123. condition testing C initialization. In what sequence the initialization. initialization.C run time error D a and b are equal Answer D 121. testing and execution of the body is done in a` dowhile ` loop A initialization. Which of the following data types cannot be written in a switch . The if statement in ` C ` is terminated by A { B .

D None of the above Answer A 126. Goto statement is used for _____ . A Conditional jump only B both conditional and unconditional jumps C Unconditional jump only D None of the above Answer C 127. Which of the following statement does not belong to structured programming? A while B for C go-while D goto Answer D 130. What is an infinite loop? A It is an endless loop B It is a nested loop C It means multiple loops D It is an unclosed loop Answer A . The loop condition is tested at the -----------of the ` do…while ` construct. A Start B Middle C End D Start & End Answer C 128. Which of the following is an iterative control structure? A Decision Making B Sequential C Jump D Loop Answer D 129.

'DO…WHILE’ and 'FOR' structure are called A Sequential logic structures B Iterative logic structures C Decision logic structures D None of the above Answer B 134. A ` switch ` statement is used to make a decision _________________. A to switch the processor to execute some other program B between two alternatives C amongst many alternatives D none of these Answer C 133. ’IF…ELSE’ or ‘CASE ‘structure are called A Selection logic structures B Iteration logic structures C Sequence logic structures D Program logic structures Answer A 135.131. The condition is tested at the -----------of loop in a ` while ` statement A Start B Middle C End D Any Where Answer A 132. Which of the following is keyword A if B String C data type D None of these Answer A .

} A HelloWelcome B None of these C Compile Error D Hello Answer A 138. The Correct syntax for the ` for ` loop in ` C ` is ________. C printf('%f'. Which one of the following is the correct syntax for printing the float vaiable named ` a ` to the console? A printf("%f". i++) B for(i=1: i<=5: i++) C for(i=1. What will be output of the following c program? #include<stdio.a).a). i++) D None of the above Answer A 137. A for(i=1. B printf("%f". D printf("%f". i<=5 .&a).a&) Answer A 139. Loop inside another loop is called as___________ A Integrated Loop B Nested Loop C Control Loop D Loop . printf("Welcome").h> #include<conio.136.h> void main() { printf("Hello"). i<=5 . getch().

Answer B 139. In the program given below.0: x = A The program has a syntax error because the required break statement is missing in the switch statement. switch (d) { case1.0: x =1. double d =1.h> main() { int i=1. } } A The condition in the for loop is a must B There should be a semicolon after the for loop C 12345678910 D Error Answer D 140.. case1. if(i>10) break. for(. point out the error.5: x =2. What would be the output of the following programs? void main() { int x. in the ` for ` loop #include<stdio.5. i++). if any. B The program has a syntax error because the required default case is missing in the switch . case2.) { printf(\"%d \".

} A Hi B Hi Hello C Hello D None of the above Answer C 142. getch().else ` statement is included within an ` if . A Next if statement .7.h> #include<conio. if(0>a) printf("Hi").. it is known as a _________.. When an ` if.statement C No errors D The program has an error because a double variable has been used in the \'switch case\' construct Answer D 141. else printf("Hello"). Which of the following is the correct output for the program given below #include<stdio.h> void main() { float a=0.else ` statement . Which of the following is not a control statement in C? A For B do-while C while D else Answer D 143.

B Value of n is printed out twice if n is zero. n). printf("\n%d". D All of above Answer D . A Value of n is printed out twice if n is negative. n). C Value of n is printed out once if n is positive. Which of the following statements is/are correct for the code shown below if (n <=0) printf("\n%d".B another if statement C combined if statement D Nested if statement Answer D 144.

Sign up to vote on this title
UsefulNot useful