C-Variable Numbers and Arguments Questions and Answers
Practice ModeShowing 10 of 28 questions
Q21
What is the main disadvantage of variable arguments?
Answer: Option B
Explanation: Lack of type safety is the primary disadvantage as compiler cannot verify argument types.
Q22
Can variable argument functions be recursive?
Answer: Option C
Explanation: Variable argument functions can be recursive, but each invocation manages its own argument list.
Q23
What happens if you call va_arg after va_end?
Answer: Option C
Explanation: Calling va_arg after va_end results in undefined behavior.
Q24
Can you use variable arguments in main() function?
Answer: Option B
Explanation: The main function can have variable arguments, but standard signatures don't include them.
Q25
What is the role of the fixed parameter in variable argument functions?
Answer: Option B
Explanation: The fixed parameter often provides information about the variable arguments (count, types, or sentinel value).
Q26
Which of these is NOT a valid use of variable arguments?
Answer: Option B
Explanation: Variable arguments cannot be used for array declarations as they are a runtime feature.
Q27
What is variable argument in function prototype also known as?
Answer: Option C
Explanation: The ellipsis (...) in function prototypes is called varargs, representing variable arguments.
Q28
Can variable argument functions have default arguments?
Answer: Option B
Explanation: C does not support default arguments; this is a C++ feature. Variable arguments serve a different purpose.