Abstract Class MCQs: 12 Solved Questions on Interface Definition
Solve 12 abstract-class questions, then use compact Java and C++ traces to check interface contracts, declarations, direct instances, and pure virtual functions.
KnowledgeGate Team
Exam prep & CS education

Abstract-class questions mix a general OOP idea with Java syntax, C++ pure virtual functions, direct instantiation, constructors, static methods, and subclass obligations. Memorising only "abstract means incomplete" is not enough to reject language-specific distractors.
Answer all 12 before reading the explanations, then label each tested idea as abstraction, interface contract, direct instance, Java declaration, or C++ pure virtual function. Use Abstract Class in OOP: How Incomplete Classes Define Interfaces, with a Worked Example for the full Shape hierarchy and dynamic-dispatch lesson; use the questions below for exam wording, Java declaration rules, and C++ pure-virtual-function checks. Questions without a direct item link can be revisited on the abstract-class practice page.
Build the abstract-class and interface map before solving

Idea | Java form | C++ form | Exam test |
|---|---|---|---|
Abstraction | Required operation, hidden detail | Operation through a base type | What vs how |
Interface contract | Methods implementers must supply | Abstract base members | Contract |
Abstract class | No direct instance; concrete subclass allowed | No direct instance; concrete derived class allowed | Count direct instances |
Mixed members | Constructor, static, concrete, and abstract methods allowed | Implemented and pure virtual members allowed | Mixed members |
Pure virtual function | Not C++ syntax | One makes the class abstract |
|
Java interfaces and abstract classes differ. An interface states a contract; an abstract class can also hold state and implementation.
abstract class Report {
int copies;
Report(int copies){this.copies=copies;}
abstract int pagesPerCopy();
int totalPages(){return copies*pagesPerCopy();}
static String kind(){return "document";}
}
class AnnualReport extends Report {
AnnualReport(int copies){super(copies);}
int pagesPerCopy(){return 24;}
}
Report r=new AnnualReport(3);AnnualReport(3) passes 3 to Report; pagesPerCopy() returns 24, so totalPages() is 3 * 24 = 72. Report.kind() is "document". new Report(3) is invalid. Direct Report instances: 0; concrete AnnualReport instances: 1.
struct PriceRule{virtual int discount(int total)const=0;};
struct StudentPrice:PriceRule{int discount(int total)const override{return total/10;}};
StudentPrice rule;
PriceRule* active=&rule;
int saved=active->discount(250); // 25
PriceRule base; // invalidStudentPrice completes the pure-virtual contract. The base pointer call dispatches to StudentPrice::discount, so integer division gives 250 / 10 = 25. PriceRule base; is invalid because PriceRule still has an unimplemented pure virtual function.
Abstract Class MCQs 1-3: abstraction and interface contracts
Question 1
Which OOP feature hides internal details and exposes only necessary functionality?
A. Inheritance
B. Encapsulation
C. Polymorphism
D. Abstraction
Correct answer: D. Abstraction.
"Hides internal details" and "exposes only necessary functionality" identify abstraction. Report.totalPages() hides its multiplication. Encapsulation packages state and behaviour, inheritance derives classes, and polymorphism supports different implementations.
Question 2, Bihar STET 2019
Abstraction means:
A. Summarization
B. Elimination
C. Hiding
D. Casting
E. None of these
Correct answer: C. Hiding.
"Hiding" is the OOP shorthand. The implementation still exists, so elimination is wrong; casting concerns types. Callers receive 72 without reproducing 3 * 24. Practise the solved question.
Question 3, Bihar STET 2025
What is the primary purpose of an interface in OOP?
A. To provide a blueprint for creating objects
B. To define a set of methods that must be implemented by implementing classes
C. To define constructors for classes
D. To create static methods
Correct answer: B. To define a set of methods that must be implemented by implementing classes.
An interface states operations implementers must provide. Constructors and static methods are not its primary purpose. AnnualReport fulfils the required pagesPerCopy() with 24. Practise the solved question.
Abstract Class MCQs 4-6: direct instances and subclass duties
Question 4
At any point of time, only ______ number of instances can exist for an abstract class.
A. 3
B. 2
C. 1
D. 0
Correct answer: D. 0.
The qualifier is direct. new Report(3) is invalid, so direct Report instances equal 0. One concrete AnnualReport may still be referenced through Report r.
Question 5
When different subclasses of Employee compute salary differently, computeSalary() should be:
A. Implemented in superclass only
B. Declared abstract in superclass and implemented in each subclass
C. Implemented only in one subclass
D. Declared private in superclass
Correct answer: B. Declared abstract in superclass and implemented in each subclass.
The superclass states the contract; each concrete subtype supplies its calculation. A superclass-only method forces one rule, one-subclass-only leaves others incomplete, and a private method cannot be the polymorphic contract. This mirrors Report.pagesPerCopy().
Question 6, UGC NET 2017
Which of the following statements about an abstract class in Java is/are true?
I. An abstract class is one that is not used to create objects.
II. An abstract class is designed only to act as a base class to be inherited by other classes.
A. Only I
B. Only II
C. Neither I nor II
D. Both I and II
Correct answer: D. Both I and II.
Here, I bars direct instantiation and II describes the base-class role. Report provides state and totalPages(); AnnualReport provides pagesPerCopy() = 24. An abstract class need not contain an abstract method. Practise the solved question.
Abstract Class MCQs 7-9: Java declarations and the C++ boundary
Question 7, RPSC 2024
Which of the following is the correct way to create an abstract class in Java?
A. class Demo { abstract void fun(); }
B. class abstract Demo { void abstract fun(); }
C. abstract class Demo { abstract void fun(); }
D. abstract class Demo { void fun() { abstract; } }
Correct answer: C. abstract class Demo { abstract void fun(); }.
Java places abstract before class and the return type. The bodyless method ends with ;. A omits the class modifier, B misplaces keywords, and D treats abstract as a statement. Practise the solved question.
Question 8, RSSB 2022
Which of the following statement is/are incorrect with respect to abstract classes?
i. Subclasses of an abstract class that do not provide an implementation of an abstract method, are also abstract.
ii. Constructor and static methods cannot be declared in abstract class.
iii. Sometimes we can create objects directly.
iv. A method must always be redefined in a subclass of abstract class.
A. i and ii
B. ii and iii
C. ii and iv
D. ii, iii and iv
Correct answer: D. ii, iii and iv.
Check each statement. i is correct: an incomplete subclass remains abstract. ii is wrong because Report has a constructor and static kind(). iii is wrong because direct instances equal 0. iv is wrong because AnnualReport inherits concrete totalPages() without redefining it. Practise the solved question.
Question 9, BPSC 2023
What is abstract class in C++?
A. Any class in C++ is an abstract class/Class from which any class is derived
B. Class specifically used as a base class with at least one virtual function
C. Class specifically used as a base class with at least one pure virtual function
D. More than one of the above
E. None of the above
Correct answer: C. Class specifically used as a base class with at least one pure virtual function.
A function marked = 0 makes a C++ class abstract. An implemented virtual function alone does not, so B is too broad. PriceRule base; fails, while StudentPrice::discount(250) returns 25. Practise the solved question.
Abstract Class MCQs 10-12: C++ pure virtual functions
Question 10, UGC NET 2015
Which of the following is used to make an Abstract class?
A. Making at least one member function as pure virtual function
B. Making at least one member function as virtual function
C. Declaring as Abstract class using virtual keyword
D. Declaring as Abstract class using static keyword
Correct answer: A. Making at least one member function as pure virtual function.
In virtual int discount(int total) const = 0;, = 0 makes PriceRule abstract. A normal virtual function alone does not. C++ also does not attach virtual or static to a class name. Practise the solved question.
Question 11, KVS 2018
Usually pure virtual function _____.
A. has complete function body
B. will never be called
C. will be called only to delete an object
D. is defined only in derived class
Correct answer: D. is defined only in derived class.
"Usually" matters. The base declares the operation and a concrete class supplies the override, as StudentPrice supplies the result 25. C++ permits an out-of-class base definition, so D is not an absolute rule. Practise the solved question.
Question 12, UGC NET 2026
Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason R.
Assertion A: We can build an object from a class containing a pure virtual function.
Reason R: A class containing a pure virtual function is called an abstract class.
In the light of the above statements, choose the most appropriate answer from the options given below:
A. Both A and R are correct and R is the correct explanation of A
B. Both A and R are correct but R is NOT the correct explanation of A
C. A is correct but R is not correct
D. A is not correct but R is correct
Correct answer: D. A is not correct but R is correct.
R is correct: a class with a pure virtual function is abstract. A is wrong because it cannot be instantiated directly. PriceRule base; fails; concrete StudentPrice returns 25 for an input of 250. A base pointer is not a direct PriceRule object. Practise the solved question.
Diagnose the misses and choose the next practice step
Misses on Questions 1-3 mean rebuild the abstraction and interface map. For 4-6, redraw the direct-instance and subclass trace. For 7-8, practise Java keyword placement and test each statement. For 9-12, rewrite virtual int discount(int total) const = 0, then explain why PriceRule base; fails and StudentPrice::discount(250) returns 25.
Retake all 12 tomorrow in 9 minutes. Allow 90 seconds for Question 8 and 75 seconds for Question 12. Require 10/12 before moving on; otherwise repeat only the missed cluster with the relevant trace.
Use Java for declarations and contracts, C++ Programming for pure virtual functions, and Coding & Skill Development Courses for the next topic.
Keep learning
Data Abstraction Explained: Hide Implementation Details with a Worked Java Example
See how a stable Account contract protects its invariant while the Java implementation changes from a running balance to a transaction ledger.
Programming Paradigms Explained: Concepts, Classifications and Worked Examples
Learn how imperative, procedural, object-oriented, functional and declarative styles organise the same computation, and how to classify code from visible evidence.
Introduction to Visual Basic (VB): Concepts, Worked Code and Exam Patterns
Learn how a VB.NET form turns text-box input and a button click into a traced result. Then practise operators, loops, procedures, scope and debugging.
Types of Programming Languages: Levels, Paradigms and Execution Models
Learn why low-level, object-oriented, compiled and dynamically typed describe different axes. Build a clear classification map through one result expressed three ways.





