Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: Control Instructions

Home > C Programming > Control Instructions > General Questions

21. What will be output of following c program?

#include
int main(){
char c=-64;
int i=-32;
unsigned int u =-16;
if(c>i){
printf("pass1");
if(c printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1);

if(c==i)
printf("pass2");
else
printf("Fail2");
return 0;
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

Tags:

TCS 

22. int a = 0, b = 2;
if (a = 0)
b = 0;
else
b *= 10;

What is the value of b?

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

23. int x = 2, y = 2, z = 1;

What is the value of x after the following statmements?

if (x = y%2)
z = x;
else
z=y;

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

24. Comment on the output of this C code?

#include
int main()
{
int a = 1;
switch (a)
case 1:
printf("%d", a);
case 2:
printf("%d", a);
case 3:
printf("%d", a);
default:
printf("%d", a);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Capgemini 

25. What is the output of the following 'C' program ?

#include
int main()
{
int i=10;

switch(i) {
case 10: printf("Hello "); {
case 1 : printf("World ");
}
case 5: printf("Hello World ");
}
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

Global Edge 

26. Predict the output of following code:

#include
void main()
{
int a=2;
switch(a)
{
case 1: printf("one");
case 2: printf("Two");
case 3: printf("Three");
default:printf("Invalid option");
}
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

Executable code ; No break statement

Workspace

Tags:

TCS 

27. Predict the output of following "C" code:

#include
main()
{
int a=100,b=300;
if(a>50)
a=200;
b=400;
printf("%d",b);
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

No braces, so only one immediate statement is part of if

Workspace

Tags:

TCS 

28. Predict the output of following "C" code:

void main()
{
if(printf("O", printf("Two")))
printf("Face");
else
printf("Focus");
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option D

Explanation:

prints content of printf statement and takes length of the string for if case execution in this case its 4, So true

Workspace

Tags:

TCS 

29. Predict the output of following "C" code:

void main()
{
if( printf("Hai"))
printf("Face");
else
printf("Focus");
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option B

Explanation:

prints content of printf statement and takes length of the string for if case execution in this case its 4, So true

Workspace

Tags:

TCS 

30. Predict the output of following "C" code:

void main()
{
if(5,4,3,2,1,0,8,9)
printf("True");
else
printf("False");
}

View Answer | Discuss in Forum | Workspace | Asked In |

Answer: Option A

Explanation:

Last value of if will be considered

Workspace

Tags:

TCS