Control Structure Questions and Answers

Practice Mode
Showing 10 of 97 questions
Q21
Find the output void main ( ) { int a=5, b=3, c=2; if (a>b>c) printf("LINUX"); else printf("WINDOWS"); }
  • A WINDOWS
  • B LINUX
  • C Error: Multiple conditions not allowed in if statement
  • D None of these
Answer: Option B
Q22
Find the output void main ( ) { int x=5, y=3; if (x>y) printf("HOT"); else; printf("COLD"); }
  • A HOT
  • B COLD
  • C HOTCOLD
  • D Compilation error
Answer: Option C
Q23
Find the output. void main ( ) { int a=1; if (a==2)return printf("C Program"); }
  • A No Output
  • B C Program
  • C Compile time Error
  • D Run time Error
Answer: Option A
Q24
Which of the following statements causes unconditonal execution
  • A Only break
  • B Both break and continue
  • C There is no unconditional execution in C
  • D goto
Answer: Option D
Q25
Find the output void main ( ) { if (printf("bc"), printf("a"), printf("bc")) printf("hai"); else printf("byte"); }
  • A bchai
  • B bcbye
  • C bcabc
  • D bcabchai
Answer: Option D
Q26
Which of the following switch statement is true? I. int a=1, b=2, c=3, x; switch (x) { switch (x>2) { case 1: case a: case 2: case b: case 3: case c: } } II. int x=5; III. int x=2; switch (x<B) { switch (x>1) { case 1: swtich (5) { case 2: continue; case 1: case 3: case 2: } } }
  • A Only I
  • B Both I & II
  • C Both I & II
  • D None of these
Answer: Option D
Q27
Find the output void main ( ) { float x=3.y; double y=1.5; if (x && y>1.5) printf("fool"); else printf("stupid"); }
  • A fool
  • B stupid
  • C Garbage value
  • D None of these
Answer: Option B
Q28
Find the output int a=50, b=60, c=70; if (! (a=15)>b) b=100; else c=100;
  • A 60 100
  • B 100 70
  • C 60 0
  • D 60 70
Answer: Option A
Q29
Fint the output void main ( ) { int x=5; if (x=1) printf("one"); else printf("five"); printf("%d",x); }
  • A one5
  • B five5
  • C one1
  • D five1
Answer: Option C
Q30
Find the output. void main ( ) { int i=2; switch (i>>1) { default: i++; case 1:; case 2:; } printf("%d",i); }
  • A 2
  • B 1
  • C Compilation error
  • D None of these
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test