Home > CompTIA A+ Exam > Quizzes > Object Oriented Programming Practice Test: Memory Allocation & Scope of Variable
Object Oriented Programming Practice Test: Memory Allocation & Scope of Variable
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 74% Most missed: “If an object is allocated using new operator ____________”
Quiz questions on new and delete operators, automatic and extern variables. In object-oriented programming (OOP), memory allocation is the process of allocating memory to store the data members and functions of an object. The amount of memory required for an object depends on the size and type of its data members and the size and complexity of its member functions. In most programming languages, memory allocation for objects is done automatically when an object is created. When an object is destroyed, the memory allocated to it is automatically deallocated. The scope of a variable in OOP... Show more
Object Oriented Programming Practice Test: Memory Allocation & Scope of Variable
Time left 00:00
25 Questions

1. If new throws an error, which function can be called to write a custom exception handler?
2. What are automatic variables?
3. Which of the following results in the allocation of memory for the extern variables?
4. All variables declared within a block ____________________
5. The static variables of a function ________________
6. The objects allocated using new operator ________________
7. Does java contain auto or register keywords?
8. Which among the following is true?
9. In Perl, using which operator are the local variables created?
10. Which cases among the following produces the undefined result?
11. Which error is produced if the automatic variables are used without declaration?
12. If an automatic variable is created and then a function is called then ________________
13. If an object is allocated using new operator ____________
14. How does compiler convert “::operator new” implicitly?
15. Which among the following is true for automatic variables in general?
16. Constructor of automatic variables is called ____________________
17. Which is the correct syntax for extern function declaration?
18. Which is the correct syntax for extern variable declaration?
19. Why are functions extern by default?
20. What does a header file contain for an extern variable?
21. Which among the following is correct syntax to declare a 2D array using new operator?
22. When delete operator is used ___________________ (If object has a destructor)
23. Which is the correct syntax to delete an array of objects?
24. The memory for automatic variables ___________________
25. In C++, if new operator is used, when is the constructor called?