MCQOPTIONS
Saved Bookmarks
This section includes 17 Mcqs, each offering curated multiple-choice questions to sharpen your C Program knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
char* myfunc(char *ptr){ ptr+=3; return(ptr);}void main(){ char *x, *y; x = "EXAMVEDA"; y = myfunc(x); printf("y=%s", y);}What will be printed when the sample code above is executed?%! |
| A. | y=EXAMVEDA |
| B. | y=MVEDA |
| C. | y=VEDA |
| D. | y=EDA |
| E. | y=AMVEDA |
| Answer» C. y=VEDA | |
| 2. |
When a function is recursively called all the automatic variables are stored in a ..........%! |
| A. | Stack |
| B. | Queue |
| C. | Array |
| D. | Linked list |
| E. | Register |
| Answer» B. Queue | |
| 3. |
Which of the following function calculates the square of 'x' in C?%! |
| A. | sqr(x) |
| B. | pow(2, x) |
| C. | pow(x, 2) |
| D. | power(2, x) |
| E. | power(x, 2) |
| Answer» D. power(2, x) | |
| 4. |
Determine output:main(){ int i = abc(10); printf("%d", --i);}int abc(int i){ return(i++);} |
| A. | 10 |
| B. | 9 |
| C. | 11 |
| D. | None of these. |
| Answer» C. 11 | |
| 5. |
Any C program |
| A. | Must contain at least one function. |
| B. | Need not contain any function. |
| C. | Needs input data. |
| D. | None of the above |
| Answer» B. Need not contain any function. | |
| 6. |
Use of functions |
| A. | Helps to avoid repeating a set of statements many times. |
| B. | Enhances the logical clarity of the program. |
| C. | Helps to avoid repeated programming across programs. |
| D. | Makes the debugging task easier. |
| E. | All of the above |
| Answer» F. | |
| 7. |
What will happen after compiling and running following code?main(){ printf("%p", main); } |
| A. | Error |
| B. | Will make an infinite loop. |
| C. | Some address will be printed. |
| D. | None of these. |
| Answer» D. None of these. | |
| 8. |
What will be the output of the following program code?main(){ static int var = 5; printf("%d ", var--); if(var) main();} |
| A. | 5 5 5 5 5 |
| B. | 5 4 3 2 1 |
| C. | Infinite Loop |
| D. | Compilation Error |
| E. | None of these |
| Answer» C. Infinite Loop | |
| 9. |
Pick the correct statements.I.¬¨‚Ä ¬¨‚Ä ¬¨‚Ä The body of a function should have only one return statement.II.¬¨‚Ä ¬¨‚Ä The body of a function may have many return statements.III.¬¨‚Ä A function can return only one value to the calling environment.IV.¬¨‚Ä If return statement is omitted, then the function does its job but returns no value to the calling environment.$ |
| A. | I and II |
| B. | I and III |
| C. | II and III |
| D. | II and IV |
| E. | III and IV |
| Answer» D. II and IV | |
| 10. |
Determine output:main(){ int i = 5; printf("%d%d%d%d%d", i++, i--, ++i, --i, i);} |
| A. | 54544 |
| B. | 45445 |
| C. | 54554 |
| D. | 45545 |
| Answer» E. | |
| 11. |
What is the result of compiling and running this code?main(){ char string[] = "Hello World"; display(string);}void display(char *string){ printf("%s", string);} |
| A. | will print Hello World |
| B. | Compilation Error |
| C. | will print garbage value |
| D. | None of these. |
| Answer» C. will print garbage value | |
| 12. |
The default parameter passing mechanism is |
| A. | call by value |
| B. | call by reference |
| C. | call by value result |
| D. | None of these. |
| Answer» B. call by reference | |
| 13. |
Functions have .......... |
| A. | Local scope |
| B. | Block scope |
| C. | File scope |
| D. | Function scope |
| E. | No scope at all |
| Answer» D. Function scope | |
| 14. |
The function scanf() returns ......... |
| A. | The actual values read for each argument. |
| B. | 1 |
| C. | 0 |
| D. | The number of successful read input values. |
| E. | ASCII value of the input read. |
| Answer» E. ASCII value of the input read. | |
| 15. |
The recursive functions are executed in a ........... |
| A. | Parallel order |
| B. | First In First Out order |
| C. | Last In First Out order |
| D. | Iterative order |
| E. | Random order |
| Answer» D. Iterative order | |
| 16. |
What will be printed when this program is executed?int f(int x){ if(x |
| A. | 4 5 6 7 |
| B. | 1 2 3 4 |
| C. | 4 |
| D. | Syntax error |
| E. | Runtime error |
| Answer» D. Syntax error | |
| 17. |
Which of the following is a complete function? |
| A. | int funct(); |
| B. | int funct(int x) { return x=x+1; } |
| C. | void funct(int) { printf(“Hello"); } |
| D. | void funct(x) { printf(“Hello"); } |
| E. | None of these |
| Answer» C. void funct(int) { printf(‚Äö√Ñ√∫Hello"); } | |