Question: QUESTION 6 Which is incorrect? There should eventually be a call to the operator delete on a pointer that points to the memory allocated by
QUESTION 6
Which is incorrect?
| There should eventually be a call to the operator delete on a pointer that points to the memory allocated by each call to new. | ||
| A function can return an array. | ||
| Dangling pointers present a problem in C++ | ||
| Dynamic variables or dynamically allocated variables in C++ are created and destroyed according to the programs needs. |
10 points
QUESTION 7
Which function declaration passes a pointer as a parameter?
| void func1(int piVal, double *pdVal); | ||
| int* func3(int piVal, double pdVal); | ||
| double func4(int &piVal, double &pdVal); | ||
| void func2(int &piVal, double pdVal); |
10 points
QUESTION 8
Which sample code program (in Blackboard->Code->6-10->Ch10) creates a dynamic array?
| Program 10.7 | ||
| Program 10.3 | ||
| Program 10.6 | ||
| None listed |
10 points
QUESTION 9
which of these declares a function pointer?
| int *calc(); | ||
| int *pt[3]; | ||
| int (*calc)(); | ||
| int &pt=num; |
10 points
QUESTION 10
A string function that returns a boolean value is
| at() | ||
| compare() | ||
| find() | ||
| empty() |
10 points
QUESTION 11
Function members of a class gain access to the calling object's members by
| a pointer to the calling object that is implicitly provided by the compiler. The name if this pointer is this. The members are prefixed implicitly by this-> as in this->membername | ||
| there is no particular mechanism, the variables just know what the calling object is and automatically refer to the calling object | ||
| a variable called self that is an alias for the calling object. This self is used to access the members of the object as in self.membername | ||
| None of the above |
10 points
QUESTION 12
If a class is named MyClass, what must the constructors be named?
| initializer | ||
| ~MyClass | ||
| MyClass | ||
| Any name the programmer wishes except the name of the class |
10 points
QUESTION 13
In class Complex, defined in Program 11.1 (Blackboard->Contents->Code->6-10->Ch11), which function is a mutator?
| imaginaryPart | ||
| assignNewValues() | ||
| showComplexValues() | ||
| Complex() |
10 points
QUESTION 14
Which statement invokes the constructor for class Complex?
| Complex a; | ||
| Complex b(6.8, 9.7); | ||
| All listed | ||
| Complex a, b(6.8, 9.7); |
10 points
QUESTION 15
Which function declaration is NOT accepting an array of ints as a parameter?
| int findMax(int *vals, int size); | ||
| int findMax(int vals[], int size); | ||
| int findMax(int **vals, int size); | ||
| int findMax(int &vals, int size); |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
