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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!