Class-and-object
Question 1 |
Which of the following is a correct statement?
Composition is a strong type of association between two classes with full ownership. | |
Composition is a strong type of association between two classes with partial ownership. | |
Composition is a weak type of association between two classes with partial ownership. | |
Composition is a weak type of association between two classes with strong ownership. |
Question 1 Explanation:

Question 2 |
Which of the following is not a correct statement?
Every class containing abstract method must be declared abstract. | |
Abstract class can directly be initiated with ‘new’ operator. | |
Abstract class can be initiated. | |
Abstract class does not contain any de nition of implementation. |
Question 2 Explanation:
A class which is declared as abstract is known as an abstract class. It can have abstract and non-abstract methods. It needs to be extended and its method implemented. It cannot be instantiated.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
Rules:
1. An abstract class must be declared with an abstract keyword.
2. It can have abstract and non-abstract methods.
3. It cannot be instantiated.
4. It can have constructors and static methods also.
5. It can have final methods which will force the subclass not to change the body of the method.
Question 3 |
Which of the following C++ statements correctly declares an abstract class?
Class A {virtual void show() = 0; };
| |
Class A {void show() = 0;};
| |
Class A {void show() { } ; };
| |
Class A {show() = 0; }; |
Question 4 |
The memory occupied by an object type of data in VB is
1 byte | |
2 byte | |
4 byte | |
8 byte |
Question 4 Explanation:


Question 5 |
If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access
Protected and public data only in C and B | |
Protected and public data only in C | |
Private data in A and B | |
Protected data in A and B |
Question 5 Explanation:
The following table shows the access to members permitted by each modifier.
