Programming in C MCQ - Constants, Variables and Data Types

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.
An external variable is declared outside all functions and has file scope by default. It can be accessed by functions within its scope, and its lifetime lasts for the entire execution of the program. If no explicit initializer is provided, it is initialized to zero.
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 B
Rate difficulty Rate difficulty:
Choose a difficulty.
The keyword unsigned specifies an unsigned integer type. An unsigned integer cannot represent negative values and uses its available bits for nonnegative values. Its exact range depends on the integer type and 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 C
Rate difficulty Rate difficulty:
Choose a difficulty.
A short int is an integer type whose range is generally smaller than or equal to that of int. The short specifier indicates an integer type with at least 16 bits, although its actual size is implementation-dependent.
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 D
Rate difficulty Rate difficulty:
Choose a difficulty.
Found this useful?
Follow:
C does not have a primitive data type named float as a structure, and int, float and char are all fundamental arithmetic types. A primitive type is built into the language rather than being defined as a structure.
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.
When a char variable is passed to printf() with the %d format specifier, integer promotion takes place. On implementations where int can represent all values of char, the value is promoted to int, and %d prints that integer value. The result may depend on the stored character value, the execution character set, and whether plain char is signed or unsigned. Therefore, option C is correct.
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