MCQOPTIONS
Saved Bookmarks
This section includes 19 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How are automatic variables different from the instance variables? |
| A. | Automatic variables are initialized automatically but instances are not |
| B. | Automatic variables are given zero values initially and not instances |
| C. | Instance variables have to be initialized explicitly and automatic implicitly |
| D. | Instance variables are initialized implicitly while automatic are not |
| Answer» E. | |
| 2. |
In Perl, using which operator are the local variables created? |
| A. | Dot |
| B. | Arrow |
| C. | Scope resolution |
| D. | my |
| Answer» E. | |
| 3. |
Which error is produced if the automatic variables are used without declaration? |
| A. | Undefined symbol |
| B. | Memory error |
| C. | Type mismatch |
| D. | Statement missing |
| Answer» B. Memory error | |
| 4. |
The automatic variables _________________________ |
| A. | Must be declared after its use |
| B. | Must be declared before using |
| C. | Must be declared, can be anytime |
| D. | Must not be initialized |
| Answer» C. Must be declared, can be anytime | |
| 5. |
Does java contain auto or register keywords? |
| A. | Yes, for declaring every type of variable |
| B. | Yes, only to declare cache registers |
| C. | No, because java doesn’t support automatic variables |
| D. | No, java supports local variable concept |
| Answer» E. | |
| 6. |
Constructor of automatic variables is called ____________________ |
| A. | When execution reaches the place of declaration of automatic variables |
| B. | When the program is compiled |
| C. | When the execution is just started |
| D. | Just before the execution of the program |
| Answer» B. When the program is compiled | |
| 7. |
What values does uninitialized automatic variables contain? |
| A. | Null value |
| B. | Void value |
| C. | Undefined/Garbage |
| D. | Zero value |
| Answer» D. Zero value | |
| 8. |
All variables declared within a block ____________________ |
| A. | Are not always automatic |
| B. | Can be made non-automatic |
| C. | Are static by default |
| D. | Are automatic by default |
| Answer» E. | |
| 9. |
The static variables of a function ________________ |
| A. | Are also automatic variables |
| B. | Are not automatic variables |
| C. | Are made automatic by default |
| D. | Can be made automatic explicitly |
| Answer» C. Are made automatic by default | |
| 10. |
Where are the automatic variables stored if another function is called in between the execution of the program? |
| A. | Heap |
| B. | Queue |
| C. | Stack |
| D. | Temp variable |
| Answer» D. Temp variable | |
| 11. |
If an automatic variable is created and then a function is called then ________________ |
| A. | The automatic variable created gets destroyed |
| B. | The automatic variable doesn’t get destroyed |
| C. | The automatic variable may or may not get destroyed |
| D. | The automatic variable can’t be used in this case |
| Answer» C. The automatic variable may or may not get destroyed | |
| 12. |
Which among the following is true for automatic variables in general? |
| A. | Automatic variables are invisible to called function |
| B. | Automatic variables are always visible to the called function |
| C. | Automatic variables can’t interact with the called function |
| D. | Automatic variables can’t be variable |
| Answer» B. Automatic variables are always visible to the called function | |
| 13. |
Scope of an automatic variable _______________ |
| A. | Is actually the whole program |
| B. | Is actually never fixed |
| C. | Is always equal to the whole program execution |
| D. | Is actually function or block in which it is defined |
| Answer» E. | |
| 14. |
The memory for automatic variables ___________________ |
| A. | Have to be allocated and deallocated explicitly |
| B. | Are allocated and deallocated automatically |
| C. | Is never actually allocated |
| D. | Are never safe |
| Answer» C. Is never actually allocated | |
| 15. |
What are automatic variables? |
| A. | Global variables |
| B. | Implicit/temporary variables |
| C. | Local variables |
| D. | System variables |
| Answer» D. System variables | |
| 16. |
CONSTRUCTOR_OF_AUTOMATIC_VARIABLES_IS_CALLED_____________________?$ |
| A. | When execution reaches the place of declaration of automatic variables |
| B. | When the program is compiled |
| C. | When the execution is just started |
| D. | Just before the execution of program |
| Answer» B. When the program is compiled | |
| 17. |
The automatic variables _________________________$ |
| A. | Must be declared after its use |
| B. | Must be declared before using |
| C. | Must be declared, can be anytime |
| D. | Must not be initialized |
| Answer» C. Must be declared, can be anytime | |
| 18. |
Does java contain auto or register keywords?$ |
| A. | Yes, for declaring every type of variable |
| B. | Yes, only to declare cache registers |
| C. | No, because java doesn’t support automatic variables |
| D. | No, java supports local variable concept |
| Answer» E. | |
| 19. |
All variables declared within a block ___________________? |
| A. | Are not always automatic |
| B. | Can be made non-automatic |
| C. | Are static by default |
| D. | Are automatic by default |
| Answer» E. | |