CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
main()
{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
}



Category C Interview Questions
Rating (3.0) By 1 users
Added on 7/19/2006
Views 1605
Rate it!
Answers:

The output will be three because when execution takes place ,inside the switch the corresponding case 3(since i=3)is selected and as there is a break statement after it, it cmes out of the loop.



THE OUTPUT: three

Because "initialization" has been done at the time of declaration i.e int i=3; which means the value of i has been strictly assigned as 3 in the memory without any possibility of change
in it.



 Posted by: Devika    

Contact Devika  Contact Devika

The output will be 'Three'. int i=3 is initialized and switch will call case 3, as case ends with break,it comes out of the loop.



 Posted by: Arjun    

Contact Arjun  Contact Arjun


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
x) main()
{
printf("%x",-1<<4);
}


View Answer
What is pointer?

View Answer
How to perform matrix multiplication using Double linked lists?

View Answer
If compiler for c is written in c language, which is used to complie the compiler?

View Answer
What is the difference between

#include< >
and
#include" "



View Answer
How can you get the number of elements in an array allocated dynamically at runtime?
For example -
int *p = (int *) malloc(sizeof(int) * n);

int numElems = ??????? /* n is not available here */


View Answer
How can send unlimited no of arguments to a function, eg printf function can take any no of arguments

View Answer
What is the draw back in using friend function in c++
View Answer
In the following code, in which order the functions would be called?
x = f1(23,14)*f2(12/4)+f3();

a) f1, f2, f3
b) f3, f2, f1
c) The order may vary from compiler to compiler
d) None of the above

View Answer
What is the type of the variable b in the following declaration?
#define FLOATPTR float*
FLOATPTR a,b;

a) float
b) float pointer
c) int
d) int pointer

View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/6045/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.7