Control Structure Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q71
Find the output void main ( ) { int x=2; switch (x) { case 1:case 2:cse 3: printf("fool"); default: break; } }
  • A Fool
  • B No output
  • C Expression syntax
  • D None of these
Answer: Option A
Q72
Find the output void main ( ) { int i; for (i=0; i<10;i++ { switch (i) { case 0: i+=0; case 1: i+=1; case 2: i+=2; default: i+=3; break; } printf("%d", i); } }
  • A 0, 1, 3, 6, 7, 8
  • B 0, 1, 3
  • C 6, 10
  • D 5, 10
Answer: Option C
Q73
Find the output. void main ( ) { switch (0) { case '0': printf("Fool"); break; case '\0:' printf("Mad"); } }
  • A Fool
  • B Mad
  • C Compilation error
  • D None of these
Answer: Option B
Q74
Find the output void main ( ) { float f=0.9; double d=0.9f; if (f==d) printf("ar"); else printf("Near"); }
  • A Dear
  • B Near
  • C Compilation error
  • D None of these
Answer: Option A
Q75
Find the output void main ( ) { int x=4; char y=4; if (x==y) printf ("Equal"); else printf("Not equal"); }
  • A Equal
  • B Not equal
  • C Compilation error
  • D No output
Answer: Option A
Q76
Find the output void main ( ) { int ch='a; switch (ch) { case 'a': printf("%d", 'a'); case 97: printf("Foo1"); default: printf('Good"); }
  • A 97Fool
  • B Good
  • C Fool
  • D Compilation error
Answer: Option D
Q77
To execute al switch case statements
  • A Any one of the case statement match with switch condition
  • B First case must match with switch condition
  • C Default case must match with switch condition.
  • D None of these
Answer: Option B
Q78
Find the output void main ( ) { int c=12, d=15; while (c!=d) { if (c>d) c=c-d; else d=d=c; } printf("%d %d", c, d); }
  • A 30 30
  • B 3 3
  • C Compilation error
  • D None of these
Answer: Option B
Q79
Find the output void main ( ) { int a=20, b=15, c; c=func (a,b); printf ("%d", c); } int func (int a, int b) { if (a!=b) if (a<b) func (b,a); else func (b,a-b); else return a; }
  • A 20
  • B 15
  • C 5
  • D 10
Answer: Option C
Q80
Find the output void main ( ) { int a, b, c, d; a=b=c=5; if (d=(a==b)) if (d==c) printf("good"); else printf("Boy"); else printf ("Good boy"); }
  • A Good
  • B Boy
  • C Good boy
  • D Compilation error
Answer: Option B
Questions and Answers for Competitive Exams Various Entrance Test