C Programming - Variable Length Argument
Question 1
|
What is the output of this C code?
3
| |
5
| |
7
| |
11
|
Question 2
|
Which of the following function with ellipsis are illegal?
void func(…);
| |
void func(int, …);
| |
void func(int, int, …);
| |
Both (a) and (c)
|
Question 3
|
Which of the following data-types are promoted when used as a parameter for an ellipsis?
char
| |
short
| |
int
| |
None of the mentioned
|
Question 4
|
Which header file includes a function for variable number of arguments?
stdlib.h
| |
stdarg.h
| |
ctype.h
| |
Both (a) and (b)
|
Question 5
|
Which of the following macro extracts an argument from the variable argument list (ie ellipsis) and advance the pointer to the next argument?
va_list
| |
va_arg
| |
va_end
| |
va_start
|
Question 6
|
The type va_list is used in an argument list
To declare a variable that will refer to each argument in turn;
| |
For cleanup
| |
To create a list
| |
There is no such type
|
Question 7
|
The declaration … can
Appear anywhere in the function declaration
| |
Only appear at the end of an argument list.
| |
Nothing
| |
Both a & b
|
Question 8
|
Each call of va_arg
returns one argument
| |
Steps va_list variable to the next
| |
Both a & b
| |
None of the mentioned
|
Question 9
|
The standard header _______ is used for variable list arguments (…) in C.
Question 10
|
va_end does whatever.
Cleanup is necessary
| |
Bust be called before the program returns.
| |
Both a &
| |
None of the mentioned
|
Question 11
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
97
| |
a
|
Question 12
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
97
| |
a
|
Question 13
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
a
| |
b
|
Question 14
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
a
| |
b
|
Question 15
|
What is the output of this C code?
Compile time error
| |
Undefined behaviour
| |
97.000000
| |
98.000000
|
Check Your Answers:
1. C
2. A
3. A
4. B
5. B
6. A
7. B
8. D
9. D
10. C
11. A
12. A
13. B
14. D
15. B
0 comments:
Post a Comment