COP 3330 FSU Exam 1 Latest Update - Actual Exam Questions with 100% Verified Correct Answers Guaranteed A+ Verified by Professor
A class destructor
- may have any number of parameters
- must be paired with each constructor for the class
- will be created automatically if none is supplied by the programmer
- is responsible for de-allocating resources when an object goes out of scope
- is called by operator new
- is called by operator delete
- must be supplied with the class if a constructor is also supplied
h) is called multiple times by an operator delete [] - CORRECT ANSWER: will be
created automatically if none is supplied by the programmer is responsible for de-allocating resources when an object goes out of scope is called by operator delete is called multiple times by an operator delete []
Consider the following function prototype:
void Funky (const int * a, size_t size);
and suppose your have a client program with an array declared as follows:
int intArray[20]; 1 / 3
a) The call Funky(intArray,10); is not allowed to change the value of intArray.b) The call Funky(intArray,10); will likely result in a compile error.c) The call Funky(intArray,20) is allowed to change the value intArray[20].d) The call Funky(intArray,10)
is not allowed to change the value of intArray[5]. - CORRECT ANSWER: The call
Funky(intArray,10) is not allowed to change the value of intArray[5]
Consider the following program:
int F(int a, int& b) { a = a - 1; b = b - 1; return a + b; 2 / 3
}
int main() { int x,y,z; x = 2; y = 3; z = 4; std::cout << "x = " << x << '\n' << "y = " << y << '\n' << "z = " << z << '\n'; }
What is the screen output?
a) x = 2 y = 3 z = 4 x = 2 y = 3 z = 4 b) x = 1 y = 2 z = 3 x = 2 y = 2 z = 5
- / 3