Question
(1) If a class contains a pointer to dynamically allocated memory, which of the following defaults is likely to be unacceptable? (a) copy constructor (b)
(1) If a class contains a pointer to dynamically allocated memory, which of the following defaults is likely to be unacceptable? (a) copy constructor (b) destructor (c) operator = (d) all of the above (2) Which of the following is not used for strings? (a) -= (b) the output operator << (c) += (d) getline() (3) Which of the following is the value of the one digit postfix expression: 4 8 + 4 / 5 - 3 * (a) 6 (b) 8 (c) 6 (d) none of the above (4) Which of the following is not an advantage of linked lists when compared to arrays: (a) Dynamic memory allocation (b) Efficient use of memory (c) Direct access to any list element (d) Efficient insertion and deletion (5) Linked lists allow (a) insertions at the back and removals from the front (b) insertions and removals only at one end (c) insertions and removals anywhere (d) none of the above (6) Which data structure is used by the compiler to implement function calls? (a) vector (b) stack (c) two dimensional array (d) list (7) Which of the following statements about stacks is incorrect? (a) stacks can be implemented using linked lists. (b) stacks are first in, first-out data structures. (c) new nodes should be added to the top of the linked list based stack. (d) the last node (the bottom) of a linked list based stack has a null (zero) link. (8) An integer stack S is initially empty, then, the following commands are performed. S.push(8); S.push(7); S.pop(); S.push(9); S.push(8); S.pop(); Which of the following is the correct stack after the commands (assume the top of the stack is on the left). (a) 8 9 7 8 (b) 8 9 (c) 7 8 (d) 9 8 (9) A deep copy refers to (a) the copying of values of pointers (b) the copying of basic types, such as integers (c) the copying of big objects (d) the copying of values of pointees (10) A shallow copy refers to (a) the copying of basic types, such as integers (b) the copying of values of pointers (c) the copying of small objects (d) the copying of values of pointees (11) C++ istream (a) is a class (b) is a class object (c) is an operator (d) is a class method (12) When we define and implement operator overloading in C++: (a) It must be a class member (b) It may or may not be a class member. (c) It must not be a member of a class (d) It can not be declared as a friend function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started