OOPM QuizA1
OOPM QuizA1
Skill Assessment -I
Batch- A1
Sem- III A Total Marks-10
2. What is the term for a class that is designed to be a base for other classes and cannot be
instantiated in C++?
a) Friend class
b) Abstract class
c) Static class
d) Virtual class
3. Which access specifier allows members of a class to be accessible only within the class itself
and its derived classes?
a) Public
b) Protected
c) Private
d) Static
class A {
public:
void display() {
cout << "Class A";
}
};
class B : public A {
public:
void display() {
cout << "Class B";
}
};
int main() {
A* ptr;
B obj;
ptr = &obj;
ptr->display();
}
a) Class A
b) Class B
c) Compile-time error
d) Runtime error
a) ~class_name();
b) class_name::~();
c) void class_name::~();
d) destructor class_name();
9. What is the result of calling a non-virtual function from a derived class object using a base class
pointer in C++?
10. In C++, which of the following is used to allocate memory for an array of objects dynamically?
a) new
b) new[]
c) malloc[]
d) calloc[]
12. Which of the following operators is used to call a member function of a class through a pointer to an
object in C++?
a) .
b) ->
c) ::
d) *
14. Which of the following statements is true about function overloading in C++?
a) Hierarchical inheritance
b) Multiple inheritance
c) Hybrid inheritance
d) All of the above
a) Compile-time polymorphism
b) Runtime polymorphism
c) Static polymorphism
d) Dynamic polymorphism
17. Which of the following is the correct way to declare an abstract class in C++?
18. In C++, which of the following is NOT a valid data type for a member of a class?
a) int
b) float
c) double
d) function
20. Which of the following is used to access a static member of a class in C++?
a) .
b) ::
c) ->
d) []