Programming in C MCQ - Constants, Variables and Data Types

Correct AnswerOption C
Rate difficulty Rate difficulty:
Choose a difficulty.
A static local variable has static storage duration. It is initialized only once and retains its value between calls to the function, while its name remains visible only within its declared scope.
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 C
Rate difficulty Rate difficulty:
Choose a difficulty.
Found this useful?
Follow:
A preprocessor directive beginning with #include requests inclusion of the specified header file. The math.h header declares mathematical library functions, such as sqrt and pow.
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 declaration float height[100]; defines an array containing 100 elements of type float. The declaration float height, women; declares two separate floating-point variables.
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.
For ordinary int variables, the leftmost bit is commonly used as the sign bit in signed binary representations. The exact representation of signed integers is governed by the C implementation and language version.
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 C
Rate difficulty Rate difficulty:
Choose a difficulty.
In C, negating an unsigned integer uses modular arithmetic. For a 16-bit unsigned int, the possible values range from 0 to 65535. The result of -a is calculated modulo 65536. Given a = 0x6DB7, we calculate 0x10000 - 0x6DB7 = 0x9249. Therefore, the correct answer is option C (0x9249). Option B is incorrect by one, while option D represents the result for a 32-bit unsigned integer.
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