constants Questions and Answers
Practice ModeShowing 10 of 30 questions
Q11
Which of the following is a valid way to define a constant in C?
Answer: Option D
Explanation: const keyword is used to define constants in C
Q12
What is the correct way to define a symbolic constant in C?
Answer: Option A
Explanation: #define preprocessor directive is used for symbolic constants
Q13
Which keyword is used to define constants in C?
Answer: Option C
Explanation: const keyword is used for defining constants
Q14
What will be the output of: #define PI 3.14
printf("%f", PI);
Answer: Option A
Explanation: PI will be replaced by 3.14 during preprocessing
Q15
Which of the following is NOT a valid constant definition?
Answer: Option C
Explanation: Missing semicolon makes this invalid
Q16
What is the value of a const variable that is not initialized?
Answer: Option C
Explanation: const variables must be initialized at declaration
Q17
Which of the following is a string constant?
Answer: Option A
Explanation: Double quotes define string constants
Q18
What is the type of constant 100?
Answer: Option A
Explanation: Default type for integer constants is int
Q19
How to define a constant pointer in C?
Answer: Option C
Explanation: const before * makes pointer constant
Q20
Which of these is a character constant?
Answer: Option A
Explanation: Single quotes define character constants