MCQs for Lecture 1

The following are MCQs for Lecture 1:C++ Primer.
Use these questions to test your understanding of the material presented in the lecture

1. In a C++ program the last statement in the main() should be
a) pause
b) cout
c) cin
d) return

2. cin and cout are
a) classes
b) methods
c) objects
d) operators

3. Which one of the following is the correct defintion for a C++ main()?
a) void main(int argc, char *argv[])
b) void main(int) {…}
c) void main(void)
d) int main() { …}

4. Constructors are used for ____
a) constructing programs
b) running classes
c) intializing objects
d) all of the above

5. Copy constructors are used
a) when you are copying arrays in your classes
b) when you are copying constructors
c) when you doing dynamic memory allocation
d) All of the above

6. ___ and __ are used for dynamic memory allocation in C++.
a) cin and cout
b) classes and objects
c) constructors and destructors
d) delete and new

7. Destructor is for _____
a) initializing the values of fields in an object
b) initializing arrays
c) freeing memory which was allocated dynamically to arrays etc
d) destroying an object

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License