Switch (i)
i=1;
case 1
i++;
case 2
++i;
break;
case 3
--i;
Output of i after executing the program

Answers were Sorted based on User's Feedback



Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / shruti

WHAT IS THE VALUE OF I BEFORE ENTERING THE SWITCH CASE???

if the values is something other than 1 , 2 , 3 there wont
be any effect, ASSUMING u have forgotton to give the curly
braces.


otherwise,
you will get an error, if the curly braces are not there
for the switch case.

Is This Answer Correct ?    7 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / jack

the value of i that was initialized before the switch
statement remains unchanged as the switch statement does
not have flower braces.

Is This Answer Correct ?    5 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / ramesh

i as it is

Is This Answer Correct ?    5 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / vinay

the value of i if we forget the mistake u done

it is i=2;

Is This Answer Correct ?    1 Yes 3 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / rukmanee

output: i=1

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

0 Answers   Expedia,


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

0 Answers  


What is putchar() function?

0 Answers  


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

0 Answers   Aspiring Minds,


What is the exact difference between '\0' and ""

3 Answers  






Fifty minutes ago if it was four times as many mints past 3 o clock. how many minutes is it to six o'clock n how....?????

3 Answers   TCS,


What is the concatenation operator?

0 Answers  


What is the newline escape sequence?

0 Answers  


What are the main characteristics of c language describe the structure of ac program?

0 Answers  


What is the use of keyword VOLATILE in C?

1 Answers  


A B C D E F G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A

2 Answers  


Why is c used in embedded systems?

0 Answers  


Categories