Test Series - cpp

Test Number 61/102

Q: Which is used to allocate and deallocate storage for objects during the execution?
A. Stack
B. Heap
C. Freestore
D. Queue
Solution: Free store is a pool of memory available for you to allocate and deallocate storage for objects during the execution of your program.
Q: Which operators are used in the free store?
A. new
B. delete
C. both new & delete
D. terminate
Solution: new and delete operators are used to allocate and deallocate the memory for the program.
Q: What type of class member is operator new?
A. static
B. dynamic
C. const
D. smart
Solution: static is a type of class member is operator new.
Q: What must be an operand of operator delete?
A. Pointer
B. Array
C. Stack
D. Queue
Solution: The operand of delete must be a pointer returned by new.
Q: How can object be allocated outside the object lifetime?
A. int
B. float
C. void*
D. char$
Solution: void* object can be allocated outside the object lifetime.
Q: Pick out the wrong header file about strings.
A. 
B. 
C. 
D. 
Solution: The standard header files for string is string and regex. So the wrong one presented here is ios.
Q: Which is best for coding the standard library for c++?
A. no trailing underscores on names
B. complex objects are returned by value
C. have a member-swap()
D. all of the mentioned
Solution: Best coding for the standard library for c++ is:
-> No trailing underscores on names
-> Complex objects are returned by value
-> It should have a member-swap().
Q: What is meant by vector in the container library contains?
A. It is a sequence container that encapsulates dynamic size arrays
B. It is a sequence container that encapsulates static size arrays
C. It manages the memory
D. It manages the length and size
Solution: Vector in the container library contains sequence container that manipulates and encapsulates dynamic size arrays.
Q: Pick out the wrong header file.
A. 
B. 
C. 
D. 
Solution: There is no header file named  in C++.
Q: What is the use of  header
A. Contains the standard exception files
B. Contains the standard library files
C. It is used to arise an exception in the program
D. Reduce the memory size
Solution:  header file contains standard exception files used for exception handling in a C++ program.

You Have Score    /10