(MCT 212) Advanced Programming Bonus Assignment: Eng. Nour Mandour Good Luck

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

(MCT 212) Advanced Programming

Bonus Assignment
1. When the inheritance is private, the private methods in base class are
__________ in the derived class (in C++).

A. Inaccessible
B. Accessible
C. Protected
D. Public

2. What is meant by multiple inheritance?


A. Deriving a base class from derived class
B. Deriving a derived class from base class
C. Deriving a derived class from more than one base class
D. None of the mentioned

3. Inheritance allow in C++ Program?


A. Class Re-usability
B. Creating a hierarchy of classes
C. Extendibility
D. All of the above

Eng. Nour Mandour


Good Luck
1
4. Can we pass parameters to base class constructor though derived class
or derived class constructor?
A. Yes
B. No
C. May Be
D. Can't Say

5. What is the difference between protected and private access specifiers


in inheritance?
A. Private member is not inheritable and not accessible in derived class.
B. Protected member is inheritable and also accessible in derived class.
C. Both are inheritable but private is accessible in the derived class.
D. Both are inheritable but protected is not accessible in the derived
class.

6. The friend functions and the member functions of a friend class can
directly access the______________ data.
A. Private and protected
B. Private and public
C. Protected and public
D. Private, protected and public

7. Reusability of the code can be achieved in CPP through ______ .

A. Polymorphism
B. Encapsulation
C. Inheritance
D. Both A and C

Eng. Nour Mandour


Good Luck
2
8. How many types of access specifiers are provided in OOP (C++)?
a) 4
b) 3
c) 2
d) 1

9. Which constructor will be called from the object obj2 in the following
C++ program?

a) A(int y, int x)
b) A(int y; int x)
c) A(int y)
d) A(int x)

Eng. Nour Mandour


Good Luck
3
10. What is a friend member functions in C++?
a) Non-member functions which have access to all the members
(including private) of a class
b) Member function which doesn’t have access to private members
c) Member function which can modify any data of a class
d) Member function which can access all the members of a class

Eng. Nour Mandour


Good Luck
4

You might also like