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


Please Help Members By Posting Answers For Below Questions

what are enumerations in C

729


Explain enumerated types.

607


What is unary operator?

664


What is far pointer in c?

817


What is volatile variable how do you declare it?

572






What are the rules for identifiers in c?

592


What is the process of writing the null pointer?

611


What functions are used in dynamic memory allocation in c?

601


Why c is procedure oriented?

578


How can you be sure that a program follows the ANSI C standard?

1137


Is c still used?

610


Explain how can I remove the trailing spaces from a string?

632


What is use of bit field?

776


What is the significance of c program algorithms?

685


the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b

1912