Quiz
C++ 2
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (30)
1This directive is used to create an "include guard," which allows a program to be conditionally compiled. This prevents a header file from accidentally being included more than once
- A#include
- B#guard
- C#ifndef
- D#endif
- ENone of these
2The constructor function's return type is ________.
- Aint
- Bfloat
- Cchar
- Dstructure pointer
- ENone of these
3A C++ class is similar to one of these.
- Ainline function
- Bheader file
- Clibrary function
- Dstructure
- ENone of these
4What is the output of the following program?

- AThe program runs, but with no output.
- B77
- CHello!
- DThe program will not compile.
5When using smart pointers to dynamically allocate objects in C++ 11, it is unnecessary to delete the dynamically allocated objects because the smart pointer will automatically delete them.
- ATrue
- BFalse
6Class objects can be defined prior to the class declaration.
- ATrue
- BFalse
7When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.
- ATrue
- BFalse
8The constructor function may not accept arguments.
- ATrue
- BFalse
9Members of a class object are accessed with the ________.
- Adot operator
- Bcin object
- Cextraction operator
- Dstream insertion operator
- ENone of these
10The process of object-oriented analysis can be viewed as the following steps:
- AIdentify objects, then define objects' attributes, behaviors, and relationships
- BDefine data members and member functions, then assign a class name
- CDeclare private and public variables, prototype functions, then write code
- DWrite the main() function, then determine which classes are needed
- ENone of these
11You may overload any C++ operator, and you may use the operator function to define non-standard operators, such as @ and ^.
- ATrue
- BFalse
12To overload the + operator, you would write a function named ________.
- Aoverload +
- Boperator +
- Cfunction +
- Doperator.overload(+)
- ENone of these
13If a member variable is declared ________, all objects of that class have access to that variable.
- Astatic
- Bdynamic
- Cinline
- Ddefault
- ENone of these
14A static member function does not need to be called by a specific object of the class.
- ATrue
- BFalse
15This operator may be used to assign one object to another.
- A=
- B==
- C<>
- D@
- ENone of these
16A member function that is declared ________ may not access any non-static data members in the class.
- Aprivate
- Bpublic
- Cstatic
- Dinline
- ENone of these
17A static member variable can be used when there are no objects of the class in existence.
- ATrue
- BFalse
18Each object of a class has its own copy of the class's ________.
- Amember functions
- Bmember variables
- Cconstructor and destructor functions
- DAll of these
- ENone of these
19The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all non-static member functions.
- ATrue
- BFalse
20When you redefine the way a standard operator works when it is used with class objects, you have ________ the operator.
- Areassigned
- Breformatted
- Coverloaded
- Doverwhelmed
- ENone of these
21Protected members of a base class are like ________, but they may be accessed by derived classes.
- Aconstructor functions
- Bstatic members
- Cprivate members
- Dpublic members
- ENone of these
22The term ________ means the ability to take many forms.
- Ainheritance
- Bpolymorphism
- Cmember function
- Dencapsulation
- ENone of these
23A member function of a derived class may not have the same name as a member function of a base class.
- ATrue
- BFalse
24In C++ 11, if a derived class attempts to override a final member function, the compiler generates an error.
- ATrue
- BFalse
25________ members of a base class are never accessible to a derived class.
- APublic
- BPrivate
- CProtected
- DPublic, Private, and Protected
- ENone of these
26A derived class may become a base class, if another class is derived from it.
- ATrue
- BFalse
27________ to a base class may be assigned the address of a derived class object.
- AAccess specifiers
- BStatic members
- CPrivate members
- DPointers
- ENone of these
28A virtual function is a member function that expects to be ________ in a derived class.
- Aignored
- Bcalled frequently
- Coverridden
- Dprivate
- ENone of these
29The ________ constructor is called before the ________ constructor.
- Abase, derived
- Bderived, base
- Cpublic, private
- Dprivate, public
- ENone of these
30A virtual function is declared by placing the key word ________ in front of the return type in the base class's function declaration.
- Avirtual
- Bprivate
- Cpublic
- Dprotected
- ENone of these
Information
- Description
- C++ 2 Quiz on C++ 2, created by Ummm No on 23/09/2016.
- Author
- Ummm No
- Language
- English
- Views
- 7
- Tags
- Rating
- No ratings yet Rate this quiz