Control Structure Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q61
Find the output void main ( ) { int a,b,c=4; if (a=c%2) b=5; printf("%d", b); }
  • A 5
  • B 0
  • C No output
  • D Garbage value
Answer: Option D
Q62
Find the output void main ( ) { char a='A'; if ((a=='z') | | ((a='L') && (sizeof (a='\0')))) a=a; printf("%c", a); printf("Nothing"); }
  • A A Nothing
  • B Nothing
  • C L Nothing
  • D Z Nothing
Answer: Option C
Q63
switch statement only tests for
  • A Relational expression
  • B Logical expression
  • C Equality
  • D All the above
Answer: Option C
Q64
Find the output. voidmain ( ) { int x=1; if (x++>=x) printf("%d",x); else printf("%d", ++x) }
  • A 2
  • B 3
  • C Compilation error
  • D None of these
Answer: Option B
Q65
Find the output void main ( ) { int i, j; for (i=1, j=5; i++, j--;) { if (i==j) continue; printf("%d", i); } }
  • A 2 4 5 6
  • B 1 2 4 5
  • C Compilation error
  • D None of these
Answer: Option A
Q66
Which is true about break statement?
  • A break can make early exit from the block where it appears.
  • B break can't be used in 'if' construct
  • C Both a and b
  • D None of these
Answer: Option C
Q67
Find the output void main ( ) { char c='\b'; if (c==8) printf("true"); else printf("false"); }
  • A true
  • B false
  • C Compilation error
  • D No output
Answer: Option A
Q68
Find the output void main ( ) { char ch; if("printf(")") printf("ok"); else printf("Bye"); }
  • A Ok
  • B Bye
  • C 0Ok
  • D 0Bye
Answer: Option A
Q69
Find the output void main ( ) int x=1, y=3, z=0; if (x!=y>=z) printf("Right"); else printf("Wrong"); }
  • A Right
  • B Wrong
  • C compilation error
  • D None of these
Answer: Option B
Q70
Find the output void main ( ) { int a=4, b=8, c=3; if (a+b!c) printf("True"); else printf("False"); }
  • A True
  • B False
  • C Compilation error
  • D None of these
Answer: Option C
Questions and Answers for Competitive Exams Various Entrance Test