#include<stdio.h> int main() { int a = 5; switch(a) { default: a = 4; case 6: a--; case 5: a = a+1; case 1: a = a-1; } printf("%d \n", a); return 0; } |
chevron_right
filter_none
(A) 3
(B) 4
(C) 5
(D) None of these
Answer: (C)
Explanation: There is no break statement, so first a = a + 1 is executed, then a = a-1 is executed.
Quiz of this Question
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C | Loops & Control Structure | Question 1
- C | Loops & Control Structure | Question 2
- C | Loops & Control Structure | Question 3
- C | Loops & Control Structure | Question 4
- C | Loops & Control Structure | Question 5
- C | Loops & Control Structure | Question 6
- C | Loops & Control Structure | Question 7
- C | Loops & Control Structure | Question 8
- C | Loops & Control Structure | Question 9
- C | Loops & Control Structure | Question 10
- C | Loops & Control Structure | Question 11
- C | Loops & Control Structure | Question 12
- C | Loops & Control Structure | Question 13
- C | Loops & Control Structure | Question 14
- C | Loops & Control Structure | Question 15
- C | Loops & Control Structure | Question 16
- C | Loops & Control Structure | Question 17
- C | Loops & Control Structure | Question 18
- C | Loops & Control Structure | Question 19
- C | Loops & Control Structure | Question 20

