CMPE 320 Final Exam ( Updated 2025
) 1 100 Complete Questions & Answers
(Solved) 100% Correct
The new[] operatr can be used in a try/catch block so that code can
check for a failure of heap allocation - ANSWER-True
,2|Page
The compiler will provide an error if you try to use delete instead of
delete[] to delete an array - ANSWER-False
The delete[] operator also automatically deletes all array elements -
ANSWER-True
The destructor is never invoked directly in code - ANSWER-True
A memory leak is caused by attempts to use uninitialized variables -
ANSWER-False
NO error will occur if a pointer that has been set to nullptr is deleted -
ANSWER-True
An attempt to delete an uninitialized pointer will result in 'unspecified
behavior' - ANSWER-True
Object slicing is caused by an attempt to de-reference a parent type
pointer and hten to store it in a child type vairable - ANSWER-False
A failed static_cast<type> produces a nullptr - ANSWER-
False
Very few compilers have fully implemented the C++ 11 standard -
ANSWER-False
,3|Page
The first stage of compilation of a *.cpp file is the generation of the
*.exe executable file - ANSWER-False
C++ is a dynamically typed language - ANSWER-False
The GCC compiler allocates the same amount of memory for a long as it
does an int - ANSWER-True
The members of an enumerated type cannot be assigned individually
unique integer values at the time of declaration - ANSWER-False
void* can be used to type a pointer to anything - ANSWER-True
On the RHS of an assignment operation, the * operator acts to obtain a
memory address for a variable - ANSWER-False
An attempt to divide by 0.0 (a double) yields a compiler error in C++ -
ANSWER-False
A C-style cast will remove the const property from any variable. -
ANSWER-True
C++ style casting operators are templated - ANSWER-
True
, 4|Page
You must use the new operator to declare an array in c++ - ANSWER-
False
C++ will initialize all the array positions of a nujmeric type array to zero
upon declaration - ANSWER-False
Array elements can be accessed without using [] - ANSWER-true
An array will throw an exception if an attempt is made to access one
position past the end of the array - ANSWERFalse
You cannot build the equivalent to a struct using a normal C++ class -
ANSWER-False
It is more efficeint to use a bitwise shift operator, >>, than to use / when
you are dividing an integer by a number that is a poer of two. -
ANSWER-True
In C++ the assignment operator, =, returns the value being assigned. -
ANSWER-True
Non-zero integer values are evaluated as true in a Boolean expression -
ANSWER-True