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.


Please wait...

C Programming :: Declarations and Initializations

11. What is the correct way to round off x, a float, to an int value?

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

Answer: Option A

Explanation:

Rounding off a value means replacing it by a nearest value that is approximately equal or smaller or greater to the given number.



y = (int)(x 0.5); here x is any float value. To roundoff, we have to typecast the value of x by using (int)

Workspace


Tags:  No Tags on this question yet!

12. In C programming language the below statement means.

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

Answer: Option D

Explanation:

what are these statements n C?

Workspace


Tags:  No Tags on this question yet!

13. What is the output of the following program ?
void main()
{
printf("%d",10?0?5:1:12);
}

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

Answer: Option D

Explanation:

The Answer should be 1, Because the will return the value of condition and printf will print the output .



10?0?5:1:12 (here 10 is true)->0?5:1(Here 0 is false)-> 1 is output.

Workspace


Tags:  No Tags on this question yet!

14. What is the output of the following program ?

#include
void main()
{
int i= 5;
if (i == 5)
return 0;
else
printf("i is not five");
printf("over");
}

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

Answer: Option D

Explanation:

Clearly we can see that i value is initialised 5 and the condition i==5 is also true. Hence return 0; will be executed and the execution will be terminated without printing anything coz its return 0 and not print 0.



Return statement brings the control of the program out of the loop.

Workspace


Tags:  No Tags on this question yet!

15. What is the output of the following "c" program ?

#include
void main()
{
int i = 107, x = 5;
printf ((x > 7)? "%d" : "%c:, i)
}

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

Answer: Option C

Explanation:

printf ((x > 7)? "%d" : "%c:, i) x value assigned is 5 hence 5 is not greater than 7 so second condition i.e (%c:i)



will be executed means ascii value of small k is 107 so the character k will be printed. 

Workspace


Tags:  No Tags on this question yet!

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

#include
void main()
{
int a=4, b = 6;
printf ("%d", a==b);
}

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

Answer: Option B

Explanation:

printf ("%d", a==b);  It gives a boolean result i.e 1 for true and 0 for false. Since 4 is not equal to 6 hence output will be 0.

Workspace


Tags:  No Tags on this question yet!

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

Answer: Option A

Explanation:

Generally takes place when in an expression more than one data type is present. In such condition type conversion (type promotion) takes place to avoid lose of data.



All the data types of the variables are upgraded to the data type of the variable with largest data type.

ShortCut By :: VIKAS KUMAR singh

Generally takes place when in an expression more than one data type is present. In such condition type conversion (type promotion) takes place to avoid lose of data.



All the data types of the variables are upgraded to the data type of the variable with largest data type.

Workspace


Tags:  No Tags on this question yet!

18. Integer division in a 'C' program results in

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

Answer: Option A

Explanation:

Its true answer is truncation. For example if we normally divide 3/2 we get 1.5



But in c language if we do integer division 3/2 we will only get 1 as the decimal values are removed by c compiler hence it truncates the value.

Workspace


Tags:  No Tags on this question yet!

ShortCut

19. The value of an automatic variable that is declared but not initialized will be

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

Answer: Option C

Explanation:

Until and unless it is not initialised it will contain garbage value only.

ShortCut By :: Aditya

C language has 4 storage classes and these Storage classes will have below values when it is declared but not initialized.






















auto garbage
static zero
extern zero
register garbage

Workspace


Tags:  No Tags on this question yet!

20. Which of the following operators in 'C' does not associate from the left?

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

Answer: Option C

Explanation:

Operator Precedence Chart

The below table describes the precedence order and associations of operators in C / C++ . Precedence of operator decreases from top to bottom.

C-Precedence-Operator-Description-Associativity

Workspace


Tags:  No Tags on this question yet!