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 :: Basic Concepts

Home > C Programming > Basic Concepts > General Questions

11. What will be the output of the below C program.

#include
int main()
{
printf("%d", out);
return 0;
}
int out=100;

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

Answer: Option A

Explanation:

The rule is that a variable is available for use from the point of declaration. Even though a is a global variable, it is not available for main. Hence an error.

Workspace

Tags:

No Tags on this question yet!

12. What will be the output of the below C program.

#include
int main()
{
extern int i; i=20;
printf("%d",sizeof(i));
return 0;
}

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

Answer: Option B

Explanation:

extern declaration specifies that the variable i is defined somewhere else. The compiler passes the external variable to be resolved by the linker. So compiler doesn't find an error. During linking the linker searches for the definition of i. Since it is not found the linker flags an error.

Workspace

Tags:

No Tags on this question yet!

13. What will be the output of the below C program.

#include
int main()
{
int i=-1;
+i;
printf("i = %d, +i = %d \n",i,+i);
return 0;
}

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

Answer: Option C

Explanation:

Unary + is the only dummy operator in C. Where-ever it comes you can just ignore it just because it has no effect in the expressions (hence the name dummy operator).

Workspace

Tags:

No Tags on this question yet!

14. What will be the output of the below C program.

#include
int main()
{
int i=-1;
-i;
printf("i = %d, -i = %d \n",i,-i);
return 0;
}

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

Answer: Option A

Explanation:

-i is executed and this execution doesn't affect the value of i. In printf first you just print the value of i.
After that the value of the expression -i = -(-1) is printed.

Workspace

Tags:

No Tags on this question yet!

15. What will be the output of the below C program.

#include
int main()
{
int k=1;
printf("%d==1 is %s",k,k==1?"TRUE":"FALSE");
return 0;
}

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

Answer: Option A

Explanation:

When two strings are placed together (or separated by white-space) they are concatenated (this is called as "stringization" operation). So the string is as if it is given as "%d==1 is %s". The conditional operator( ?: ) evaluates to "TRUE".

Workspace

Tags:

No Tags on this question yet!

16. What will be the output of the below C program.

#include
int main(){
int a= 0;
int b = 20;
char x =1;
char y =10;
if(a,b,x,y)
printf("hello");
return 0;
}

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

Answer: Option A

Explanation:

The comma operator has associativity from left to right. Only the rightmost value is returned and the other values are evaluated and ignored.
Thus the value of last variable y is returned to check in if. Since it is a non zero value if becomes true so, "hello" will be printed.

Workspace

Tags:

No Tags on this question yet!

17. What will be output of the following "c" code?

#include
int main(){
printf("%d","abcde"-"abcde");
return 0;
}

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

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

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

#include
#include
void main()
{
printf("%f",sqrt (36.0));
}

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

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

19. What is the output of the following C Program?

#include
void main()
{
printf("%d %d %d", sizeof(3.14f), sizeof(3.14), sizeof (3.14l));
}

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

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

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

#include
void main()
{
printf(5 + "Fascimile");
}

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

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!