MCQOPTIONS
Saved Bookmarks
This section includes 12 Mcqs, each offering curated multiple-choice questions to sharpen your C knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Which header file should be included if a function has to be defined such that it can accept variable number of arguments? |
| A. | stdlib.h |
| B. | stdarg.h |
| C. | assert.h |
| D. | setjmp.h |
| Answer» C. assert.h | |
| 2. |
What is the role of the given C function? |
| A. | allows a function with variable arguments which used the va_start macro to return |
| B. | retrieves the next argument in the parameter list |
| C. | initializes ap variable to be used with the va_arg and va_start macros |
| D. | returns the next additional argument as an expressionView Answer |
| Answer» B. retrieves the next argument in the parameter list | |
| 3. |
Which macro retrieves the next argument in the parameter list of the function with type type? |
| A. | type va_arg(va_list ap, type) |
| B. | type var_arg(va_list ap, type) |
| C. | type v_arg(va_list ap, type) |
| D. | type val_arg(va_list ap, typ |
| E. | type var_arg(va_list ap, type)c) type v_arg(va_list ap, type)d) type val_arg(va_list ap, type) |
| Answer» B. type var_arg(va_list ap, type) | |
| 4. |
ALLOWS_A_FUNCTION_WITH_VARIABLE_ARGUMENTS_WHICH_USED_THE_VA_START_MACRO_TO_RETURN?$ |
| A. | retrieves the next argument in the parameter list |
| B. | initializes ap variable to be used with the va_arg and va_start macros |
| C. | returns the next additional argument as an expression |
| Answer» C. returns the next additional argument as an expression | |
| 5. |
The C library macro type _________ retrieves the next argument in the parameter list of the function with type. |
| A. | va_end |
| B. | va_arg |
| C. | va_start |
| D. | no macros |
| Answer» C. va_start | |
| 6. |
______ macro must be called before using ______ and ________ |
| A. | va_arg, va_end and va_start |
| B. | va_start, va_end and va_arg |
| C. | va_end, va_arg and va_start |
| D. | v_arg, v_end and v_start |
| Answer» C. va_end, va_arg and va_start | |
| 7. |
The _______ macro shall be invoked before any access to the unnamed arguments. |
| A. | va_arg |
| B. | va_end |
| C. | va_list |
| D. | va_start |
| Answer» E. | |
| 8. |
Which macro retrieves the next argument in the parameter list of the function with type type? |
| A. | type va_arg(va_list ap, type) |
| B. | type var_arg(va_list ap, type) |
| C. | type v_arg(va_list ap, type) |
| D. | type val_arg(va_list ap, type) |
| Answer» B. type var_arg(va_list ap, type) | |
| 9. |
If access to the varying arguments is desired then the called function shall declare ________ having type va_list. |
| A. | class |
| B. | object |
| C. | function |
| D. | variable |
| Answer» C. function | |
| 10. |
The three macros defined by stdarg.h is _________ |
| A. | start(), arg() and end() |
| B. | var_start(), var_arg() and var_end() |
| C. | va_start(), va_arg() and va_end() |
| D. | v_start(), v_arg() and v_end() |
| Answer» D. v_start(), v_arg() and v_end() | |
| 11. |
The header file stdarg.h defines a variable type ________ |
| A. | va_list |
| B. | v_list |
| C. | size_t |
| D. | var_list |
| Answer» B. v_list | |
| 12. |
How many macros are defined in the header file stdarg.h? |
| A. | one |
| B. | two |
| C. | three |
| D. | four |
| Answer» D. four | |