This is a working draft of sample questions right now. I’m adding to it as I think of things.
__________ 1. A pointer can point to another pointer.
__________ 2. In order to adhere to the Rule of 3, a class must provide an implementation of the default constructor, the copy constructor, and the assignment operator.
__________ 3. Pointers can point to both arrays and individual variables.
__________ 4. Segmentation faults happen at compile time.
__________ 5. The minimal length of a char array used to store the c-string SMU is 3.
__________ 6. Dynamic memory allocation is slower than static memory allocation.
__________ 7. Memory allocated with the new[] operator shall only be released with the delete operator.
__________ 8. The new operator can dynamically allocate memory on the stack.
__________ 9. The strcpy c-string function requires both parameters be null-terminated char arrays.
__________ 10. Assume class DSString
exists. Declaring a pointer to a DSString object (I.e. DSString* some_string;
) invokes one of the constructors for class DSString
.
__________ 11. Here is a member function header for class DSString:
void DSString::someFunction(char c, int a) **const** {…}
The use of const
in this function header means that parameters c and a are const.
__________ 12. The proper header for the main method when it is going to accept command line arguments is the following:
int main (char** argv, int arc){…}
__________ 13. Preprocessing is the first step in the process of converting a source file to an object file (machine code).