C- Declarations and Initializations Questions and Answers
Practice ModeShowing 10 of 49 questions
Q11
What is the default value of an uninitialized local variable in C?
Answer: Option C
Explanation: Local variables are not automatically initialized and contain garbage values.
Q12
Which keyword is used to define a constant in C?
Answer: Option C
Explanation: const keyword makes a variable read-only after initialization.
Q13
What is the size of int data type in C?
Answer: Option D
Explanation: The size of int depends on the system architecture and compiler.
Q14
Which of the following is not a valid C identifier?
Answer: Option C
Explanation: Identifiers cannot start with numbers or contain special characters.
Q15
What does the extern keyword do?
Answer: Option B
Explanation: extern declares a variable without defining it, indicating it is defined elsewhere.
Q16
Which storage class has the longest lifetime?
Answer: Option C
Explanation: static variables persist throughout the program execution.
Q17
What is the output of: printf("%d", sizeof(char));
Answer: Option A
Explanation: char always takes 1 byte in C regardless of the system.
Q18
Which of the following is a valid way to declare and initialize a string?
Answer: Option A
Explanation: Strings can be initialized using array syntax or pointer with string literal.
Q19
What is the value of an uninitialized global variable?
Answer: Option A
Explanation: Global variables are automatically initialized to zero by default.
Q20
Which of the following is a valid floating point declaration?
Answer: Option D
Explanation: float and double are used for floating point numbers in C.