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

Is c high or low level?

573


What are the restrictions of a modulus operator?

625


Can static variables be declared in a header file?

610


How are Structure passing and returning implemented by the complier?

705


write a program to generate address labels using structures?

4001






formula to convert 2500mmh2o into m3/hr

491


What is structure in c definition?

566


How do you convert strings to numbers in C?

703


What is operator precedence?

637


What are categories used for in c?

560


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1501


why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above

603


What is NULL pointer?

671


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

1756


Why & is used in c?

707