Control Structure Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q41
Find the output void main ( ) { int i=1; if (i<=5) { printf("%d", i); if (i==3) continue; i++; } }
  • A 1
  • B 123333....
  • C 12345
  • D None of these
Answer: Option D
Q42
Find the output void main ( ) { if (true && false) printf("TRUE"); else printf("FALSE"); }
  • A FALSE
  • B TRUE
  • C Compilation error
  • D Garbage value
Answer: Option C
Q43
Find the output. void main ( ) { int x=5; if (x<4); { printf("%d", x++); printf ("5d", x*=2); } else printf("do it again"); }
  • A 512
  • B do it again
  • C 512do it again
  • D Compilation error
Answer: Option D
Q44
Find the output void main ( ) { int x=1; if ("%d=hallo", x); }
  • A 1=hallo
  • B hallo5
  • C 1
  • D No output
Answer: Option D
Q45
If there are more than one sdtatements present in a 'if' expression then order of evaluation is
  • A Right to left
  • B Left to right
  • C Right-left
  • D None of these
Answer: Option B
Q46
Find the output void main ( ) { int i=100, j=100, k=-100; if (!i>=k) j+=j; k+=kl printf("%d %d %d", i,j, k); }
  • A 100 100 0
  • B 0 100 -200
  • C 100 200 -200
  • D 0 200 -100
Answer: Option C
Q47
Find the output void main ( ) { int a=2, b=0, c=-2; if (b, a, c) printf("Lack of C knowledge"); else printf("Begineer"); }
  • A Lack of C knowledge
  • B Beginner
  • C Compilation error
  • D Runtime error
Answer: Option A
Q48
what happens when 'break' statement is omitted from a particular case ?
  • A Leads to a logical error
  • B Causes execution to terminate after that case
  • C Causes execution to continue all subsequent cases
  • D Causes execution to branch to the statement after the switch statement
Answer: Option C
Q49
Find the output void main ( ) { int x=5; if (x=0) printf("%d", x); printf('%d, ++x); }
  • A 5 6
  • B 0 1
  • C 1
  • D 6
Answer: Option C
Q50
The 'continue' statement is used to
  • A Continue the next iteration of a loop construct
  • B Exit the block where it exists and continue after
  • C Exit the outermost block even if it occurs inside the innermost
  • D Continue the compilation even an error occurs in a program
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test