

MCQOPTIONS
Saved Bookmarks
This section includes 9 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
1. |
Assume that the random number generating function - rand( ), returns an integer between 0 and 10000 (both inclusive). If you want to simulate the throwing of a die using this random function, use the expression |
A. | rand ( ) % 6 |
B. | rand ( ) % 6 + 1 |
C. | rand ( ) % 5 + 1 |
D. | None of the above |
E. | |
Answer» C. rand ( ) % 5 + 1 | |
2. |
If a piece of code can be implemented as a macro or as an inline function, which of the following factors favour implementation as an inline function? |
A. | Interacting with other components (like variables in an expression), in the correct way .. |
B. | Flexibility to manipulate as a pointer |
C. | Source code size |
D. | Both A and B |
Answer» E. | |
3. |
Which of the following parameter passing mechanism(s) is/are supported by C++, but not by C? |
A. | Pass by value |
B. | Pass by reference |
C. | Pass by value-result |
D. | All of the above |
Answer» C. Pass by value-result | |
4. |
If many functions-have the same name, which of the following information, if present, will be used by the compiler to invoke the correct function to be used? |
A. | The operator : : |
B. | The return value of the function |
C. | Function signature |
D. | Both A & C |
Answer» E. | |
5. |
The compiler identifies a virtual function to be pure |
A. | by the presence of the keyword pure |
B. | by its location in the program |
C. | if it is equated to 0 |
D. | None of the above |
Answer» D. None of the above | |
6. |
|
A. | It speeds up execution |
B. | It slows down execution |
C. | It increases the code size |
D. | Both A and C |
Answer» E. | |
7. |
|
A. | It results in compile-time error |
B. | It results in run time error |
C. | It prints 1 1 2 |
D. | It prints 1 1 10 |
Answer» B. It results in run time error | |
8. |
|
A. | It results in compile-time error |
B. | It results in run time error |
C. | It prints 1 1 2 |
D. | It prints 1 1 10 |
Answer» E. | |
9. |
|
A. | It results in compile-time error |
B. | It results in run time error |
C. | It prints 1 1 2 |
D. | It prints 1 1 1 |
Answer» D. It prints 1 1 1 | |