Quiz
CS1B Ch 7 Quiz
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 (35)
1In C++, new types are mostly created using _________.
- AA. A function
- BB. A class or struct
- CC. Either A or B
- DD. None of the above
2In object-oriented programming, a data member plays the role of _________.
- AA. An attribute
- BB. A behavior
- CC. Either A or B.
- DD. None of the above
3In object-oriented programming, a member function plays the role of a
- AA. An attribute
- BB. A behaviour
- CC. All of the above
- DD. None of the above.
4In C++, attributes and behaviors are declared in the
- AA. Class Declaration
- BB. Class Definition
- CC. Either A or B
- DD. None of the above
5In C++, attributes and behaviors are normally defined in the
- AA. Class Definition
- BB. Member Function Definition
- CC. All of the above
- DD. None of the above
6In a class, all members are by default:
- AA. Private
- BB. Protected
- CC. Public
7In C++, we need a _____ at the end of class definition
- AA. Colon
- BB. Dot
- CC. Semi-colon
- DD. None of the above
8In a class, a private data member can be accessed
- AA. In the class
- BB. Through the public member functions
- CC. Either A or B
- DD. None of the above
9In a class, a public member function can be accessed
- AA. In the class
- BB. Through the other public member functions
- CC. Outside the class
- DD. All of the above
10To define a member function outside of a class, we need the ______ operator.
- AA. Member Select (.)
- BB. Class Scope (::)
- CC. Either A or B
- DD. None of the above
11To call a member function outside of a class, we need the ____ operator
- AA. Member Select (.)
- BB. Class Scope(::)
- CC. Either A or B
- DD. None of the above
12In a class, data members are normally initialized by
- AA. A constructor
- BB. A destructor
- CC. Either A or B
- DD. None of the above
13In a class, data members are normally cleared by
- AA. A constructor
- BB. A destructor
- CC. Either A or B
- DD. None of the above
14A constructor is a member function that _____ as the class
- AA. has the same name
- BB. cannot have a return value
- CC. None of the above
- DD. Either A or B
15A destructor is a member function that has ____ as the class
- AA. The same name as the class preceded by a tilde (~).
- BB. Cannot have a return value.
- CC. Either A or B
- DD. None of the above
16A class can have more than one
- AA. Default constructor
- BB. Parameter constructor
- CC. Destructor
- DD. Assignment operator
17In a class the _____ can be overloaded.
- AA. Default Constructor
- BB. Parameter Constructor
- CC. Copy Constructor
- DD. Assignment Operator
18The initialization list in a constructor starts with a
- AA. Dot
- BB. Colon
- CC. Semi-Colon
- DD. None of the abovce
19If we create n objects in our application, _____ constructors are called
- AA. 0
- BB. 1
- CC. n
- DD. None of the above
20If we create n objects in our application, ______ the destructor of the class needs to be called _____ times.
- AA. 0
- BB. 1
- CC. n
- DD. None of the above
21We need _____ copy constructor
- AA. At least one
- BB. At most one
- CC. All of the above
- DD. None of the above
22We can have _______ destructors for a class.
- AA. Only one
- BB. Only two
- CC. Any number of
- DD. None
23If a class has three instance data members and we create five object of the class, the system creates _____ data values.
- AA. 5
- BB. 15
- CC. 1
- DD. None
24If a class has two static data members and we create five objects of the class, the system creates _____ static data values.
- AA. 5
- BB. 10
- CC. 2
- DD. None
25In a member function, a host object is
- AA. The first parameter
- BB. The second parameter
- CC. A hidden parameter point to by the this-> pointer
- DD. The return object
26A mutator function is the one that __ the host object.
- AA. changes
- BB. does not change
- CC. A or B
- DD. None of the above
27An accessor function is one that ___ the host object.
- AA. Changes
- BB. Does not change
- CC. A or B
- DD. None of the above
28One or more conditions that may need to be imposed on some or all class data members is the ____________ of the class.
- AA. Class Definition
- BB. Class Conditions
- CC. Class Invariants
- DD. Class Declaration
29A static data member needs to be initialized ___________.
- AA. In the class declaration
- BB. In the class definition
- CC. Outside of the class (Global Area)
- DD. None of the above
30A static member function can be called through _______
- AA. An instance
- BB. The class
- CC. Either of the above
- DD. None of the above
31The class definition is called the _____ file.
- AA. Interface
- BB. Implementation
- CC. Application
- DD. None of the above.
32The file that contains member function definitions is called ______________ file.
- AA. Interface
- BB. Implementation
- CC. Application
- DD. None of the above
33The file that instantiates and uses the object of the class is called the ____ file.
- AA. Interface
- BB. Implementation
- CC. Application
- DD. None of the above
34To prevent the duplicate inclusion of a file in another file, we use the preprocessor directives _________ in our programs.
- AA. Define
- BB. ifndef
- CC. endif
- DD. All of the above
35In separate compilation, the designer uses the original and the user uses a copy of _______ file, which means the file is protected from change.
- AA. Interface
- BB. Implementation
- CC. Application
- DD. All of the above
Information
- Description
- Computer Science Quiz on CS1B Ch 7 Quiz, created by Erik Malpass on 02/05/2023.
- Author
- Erik Malpass
- Language
- English
- Views
- 16
- Tags
- Rating
- No ratings yet Rate this quiz