1. Which part of the ADT tells the programmer using it how to use it? a. The imp
ID: 663303 • Letter: 1
Question
1. Which part of the ADT tells the programmer using it how to use it?
a. The implementation
b. The scope resolution
c. The abstractness
d. The interface
2. In which case would you consider using a dynamic array?
a. You should always use a dynamic array
b. If the program needs to get the size of the array from the user
c. If the array is small, and the size is known before the program runs
d. If the array size is big, but known at compile time
3. Which of the following statements are true?
a. A class or a struct may have a member which is a dynamic array.
b. A dynamic array can have a base type which is a class or a struct.
c. A class or a struct may have a member which is a dynamic array and a dynamic array can have a base type which is a class or a struct.
d. None of the choices apply.v
4. Which of the following statements is not correct?
a. The destructor of a class is a void function.
b. The destructor of a class is not a member of the class.
c. The destructor of a class is not called when an object of the class goes out of scope.
d. The destructor of a class is not named the same as the name of the class, but preceded with a tilde.
5. Which of the following are valid declarations for an assignment operator for a class named myClass?
a. void friend operator = (const myClass& source);
b. void friend operator = (myClass& left, const myClass& source);
c. void operator = (const myClass& source);
d. void operator = (myClass& left, const myClass& source);
6. To add an element to a vector of integers named numbers at the next available position in the vector, you would use:
a. numbers.push_back(newValue);
b. numbers.pushBack(newValue);
c. numbers[numbers.size( )+1] = newValue;
d. numbers = newValue;
7. What is the value of numbers.size( ) after the following code?
vector < float > numbers(100);
a. 10
b. 0
c. 100
d. 1000
8. What is wrong with the following attempted c-string declaration and initialization?
char str1[5] = {
Explanation / Answer
1: D
2: C
3: B
4: A
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.