Question 11832 – Artificial-intelligence
April 14, 2024
C-Programming
April 14, 2024
Question 11832 – Artificial-intelligence
April 14, 2024
C-Programming
April 14, 2024

Question 8806 – Programming

What will be the output of the following C program segment?

char inchar = 'A';
switch (inchar)
{
case 'A' :
    printf ("choice A n") ;
case 'B' :
    printf ("choice B ") ;
case 'C' :
case 'D' :
case 'E' :
default:
    printf ("No Choice") ;
}

Correct Answer: C

Question 18 Explanation: 
Everything in the switch will be executed, because there is no break; statement after case ‘A’. So it executes all the subsequent statements until it find a break;
So,
→ Choice A
→ Choice B. No choice. Is the output.
A
No Choice
B
Choice A
C
D
Program gives no output as it is erroneous
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!