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

simple program for virtual function?

1 Answers  


write a Program to dispaly upto 100 prime numbers(without using Arrays,Pointer)

26 Answers   ADITI, iFlex, Infosys, Oracle, TCS, Unicops, Wipro,


What is abstract data structure in c?

0 Answers  


In a switch statement, explain what will happen if a break statement is omitted?

0 Answers  


Are comments included during the compilation stage and placed in the EXE file as well?

0 Answers  


Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?

6 Answers  


why we shiuld use main keyword in C

5 Answers  


Method Overloading exist in c ?

3 Answers   Wipro,


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

0 Answers  


What are the storage classes in C?

0 Answers  


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

0 Answers  


What is 02d in c?

0 Answers  


Categories