Programming in C MCQ - Constants, Variables and Data Types

Correct AnswerOption B
Rate difficulty Rate difficulty:
Choose a difficulty.
The storage size of int is implementation-dependent. C guarantees that int has a minimum representable range, but it does not require int to occupy exactly two bytes. Many modern systems use a four-byte int. The sizeof operator can be used to determine the actual storage size of a type on a particular implementation.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
The printf function displays formatted output according to its format string. The %f conversion specifier prints a floating-point value in fixed-point decimal notation. Escape sequences such as and represent a newline and a horizontal tab. Each conversion specifier must match the corresponding argument type.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
Share this question
Share:
Converting a double value to float may cause a loss of precision because float commonly provides fewer significant digits than double. If the original value cannot be represented exactly as float, it is rounded to a representable value. The conversion may also encounter range limitations.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
The sqrt function is declared in the math.h header and calculates the square root of its argument. The standard sqrt function accepts a double and returns a double. When an integer argument is supplied, it is converted to double. A call such as sqrt((double)i) explicitly converts the integer variable i before calculating its square root.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
The expression (float)9/5 first converts the integer 9 into the floating-point value 9.0. Since one operand is floating-point, 5 is also converted to float and floating-point division is performed. Therefore, 9.0/5.0 produces 1.8. The printf format specifier %f displays this value as 1.800000 by default. Hence, option A (1.8) is the intended correct answer.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Why Practice with Avatto?
High Quality MCQsExam-focused questions with accurate answers
Detailed ExplanationsStep-by-step explanations to enhance learning
Latest Exam PatternBased on updated syllabus and pattern
Performance AnalyticsTrack performance and improve weak areas
100% Free PracticePractice unlimited questions for free