Question
C++ P2 1)Who can access private data in a class? a)members of the class b)friends of the class c)members of the class and of derived
C++
P2
1)Who can access private data in a class?
a)members of the class
b)friends of the class
c)members of the class and of derived classes
d)members of the class and friends
2)C++ vectors are generally preferred to dynamic arrays because
a)arrays cannot contain object elements
b)vectors can grow and shrink
c)all choices are true
d)vectors can never be empty
3)A derived class has access to
a)the public functions and variables of its ancestor classes
b)private and public functions and variables of its ancestor classes
c)private and protected functions and variables of its ancestor classes
d)the private functions and variables of its ancestor classes
4)Operators can be overloaded as
a)friends of a class
b)members of a class
c)data members of a class
d)members or friends of a class
5)Functions should normally be made virtual
a)if they are friend functions
b)if they are private functions
c)always
d)if they are meant to be overriden
6)When calling a function on an object pointed to by a pointer variable, we use operator
a)=
b).
c)::
d)->
7)What is the value of str after the following code?
string str;
a)garbage
b)uninitialized
c)null
d)empty string
8)If you define a function in the derived class that has the same function signature as a function in
the base class, this is known as
a)reloading
b)overwriting
c)redefinition
d)overloading
9)When an unusual situation or error occurs
a)the exit statement is executed
b)the try statement is executed
c)the catch statement is executed
d)the throw statement is executed
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started