what is the output of the program and explain why??
#include<stdio.h>

void main ( )

{

int k=4,j=0:

switch (k)

{

case 3;

j=300;

case 4:

j=400:

case 5:

j=500;

}

printf (ā€œ%d\nā€,j);

}

Answers were Sorted based on User's Feedback



what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / ramprabha

500

Is This Answer Correct ?    15 Yes 6 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / prasad

500

Is This Answer Correct ?    9 Yes 0 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / prashanth

the answer is 500 as break is not mentioned it goes to case
5 from case4 so value of j=500

Is This Answer Correct ?    7 Yes 1 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / avinash

because there us no break statement after case

Is This Answer Correct ?    6 Yes 0 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / gouse mohiddin

500

Is This Answer Correct ?    6 Yes 1 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / ashutosh tiwari

compiler error!
after case 3 there is semicolon & j=400 also ended with
semicolon

Is This Answer Correct ?    6 Yes 2 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / kalyan chukka

Ans is 500 i dont know y it printing 500 u mention k=3 or 4
or 5 any no it prints only 500

Is This Answer Correct ?    3 Yes 0 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / amik

the answer will b 500 becoz...when first k = 4 is
executing...the value of j is 400 den thr is no break
statement...so it will continue..nd at the end of the
switch..j will contain or retain.. the value 500

Is This Answer Correct ?    3 Yes 0 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / vijay r15

error
Becoz
j=0: j=400: // in these : should be replaced by ;
In case 3; // in this ; should be replaced by :

After correcting this the op is 500 becoz there is no break statement
Ans 500

Dbtfull guys mail to raj.vijay55@gmail.com

Is This Answer Correct ?    2 Yes 0 No

what is the output of the program and explain why?? #include<stdio.h> void main ( ) { ..

Answer / aswini

as there is no semicolon,uit will execute all the case
statements and j will be assigned as 500.
hence it will print 500..

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

what will be the output: main(){char ch;int a=10;printf("%d",ch);}

36 Answers   Accenture, TCS, Wipro,


How can we open a file in Binary mode and Text mode?what is the difference?

1 Answers   PanTerra,


write a c program to add two integer numbers without using arithmetic operator +

13 Answers   Value Labs,


2. What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value

3 Answers   Accenture,


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

0 Answers  






What is structure data type in c?

0 Answers  


What is double pointer in c?

0 Answers  


How does sizeof know array size?

0 Answers  


write a program to concatenation the string using switch case?

0 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


Do you know what are the properties of union in c?

0 Answers  


What is the use of extern in c?

0 Answers  


Categories