consider the following program sigment
int n,sum=1;
switch(n) {
case 2:sum=sum+2;
case 3:sum*=2;
break;
default:sum=0;}
if n=2, what is the value of sum
a.0
b.6
c.3
d.none
Answer Posted / roopa
The anser is d i.e. NONE.
Case 2 does not have the break statement.
so sum becomes 8
| Is This Answer Correct ? | 2 Yes | 13 No |
Post New Answer View All Answers
why do some people write if(0 == x) instead of if(x == 0)?
What is huge pointer in c?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Why c is called object oriented language?
What is a memory leak? How to avoid it?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
Is multithreading possible in c?
Explain what does the format %10.2 mean when included in a printf statement?
What tq means in chat?
How can this be legal c?
How can variables be characterized?
Are pointers really faster than arrays?
Why doesnt long int work?
Where in memory are my variables stored?
Explain what is wrong with this statement? Myname = ?robin?;