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

What are reserved words?

0 Answers  


main() { FILE *fs; char c[10]; fs = fopen(“source.txt”, ”r”); /* source.txt exists and contains “Vector Institute” */ fseek(fs,0,SEEK_END); fseek(fs,-3L,SEEK_CUR); fgets(c,5,fs); puts(c); }

1 Answers   Vector,


Write a c program to print the even numbers followed by odd numbers in an array without using additional array

1 Answers   Tech Mahindra,


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

0 Answers  


Tell me about low level programming languages.

0 Answers   Amdocs,






What is the scope of global variable in c?

0 Answers  


write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values.  The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.

0 Answers  


Stimulate calculators to perform addition,subtraction,multiplication and division on two numbers using if/else statement?

1 Answers   IBM,


Can we declare variables anywhere in c?

0 Answers  


Heyyy All, Just a challenge . A C program with if Else if(){ /// insert sumthing print ("in if") // insert sumting } else { ///// insert sumthing print ("in else"); //// insert sumthing } can anyone modify it so that program prints. if and else both

3 Answers  


Differentiate between ordinary variable and pointer in c.

0 Answers  


What is f'n in math?

0 Answers  


Categories