Classes and Objects MCQs: 12 Solved OOP Questions with Explanations

Solve 12 classes and objects MCQs, check each explanation, and use a worked Java trace to separate instance state, constructors, overloading and nested classes.

KnowledgeGate Team

Exam prep & CS education

20 Oct 20267 min read

Common mix-ups include blueprint versus instance, constructor versus method, and static versus inner class. OOP language boundaries distinguish object-oriented concepts from language features. Find related practice under Coding & DSA Courses for Placements. Choose before reading each explanation.

Questions 1, 3 and 12 open the matching bank item. The remaining questions use the Class and Objects lesson hub because their public question pages do not currently resolve.

Classes and objects: the six distinctions to recall first

Distinction

What to remember

Class

Blueprint for objects.

Object

Runtime class instance.

Instance field

Separate per object.

Constructor

Initializes an object.

Overloading

Same name, different parameters.

Static nested class

Needs no enclosing object.

new creates an instance; its constructor sets the starting state.

Student s1 = new Student("Meera", 82) and s2 = new Student("Arun", 74) share one class but hold separate state. Changing s1.score to 87 leaves s2.score at 74.

Classes and objects MCQs 1-4: methods, Java support and constructors

Question 1, Bihar STET 2025

In OOP, what is method overloading?

  • A. Creating multiple constructors

  • B. Using multiple inheritance

  • C. Defining multiple methods with the same name but different parameters

  • D. Inheriting multiple methods from a parent class

Correct answer: C.

Overloading keeps the name but changes the parameter list, as in deposit(int amount) and deposit(int amount, int bonus). The compiler selects a signature from the arguments. Constructors can be overloaded too, but A does not define method overloading.

Question 2, Beltron Programmer 2025

How does Java support application development in the Object-Oriented paradigm?

  • A. By compiling directly to machine code

  • B. By enabling multiple inheritance using classes

  • C. By providing features like classes, interfaces and inheritance

  • D. By using only functions without classes

Correct answer: C.

Java uses classes for object definitions, interfaces for contracts and inheritance for reuse. A class cannot extend multiple classes, although it may implement multiple interfaces. Therefore B is false, while A and D do not describe its object model.

Question 3, Beltron Programmer 2025

In the context of object-oriented programming, which of the following options accurately describes a constructor in a class?

  • A. A method that returns a value and must be explicitly called to initialize variables

  • B. A predefined static block executed before any method or field of the class

  • C. A member function that shares the class name and is automatically invoked during object creation

  • D. A special function used to allocate memory dynamically for class instances

Correct answer: C.

In Java and C++, a constructor shares the class name, has no ordinary return type and runs during object creation. In new Student("Meera", 82), allocation and initialization are related, but the constructor is not just a memory-allocation function. D is too broad.

Question 4, RSSB 2022

Match the following:
List I
(i) A method used to create an instantiation of a class
(ii) A signal that stops normal program execution
(iii) A graphical image usually stored in a file
(iv) Converting one type of value to another
List II
(a) Bitmap
(b) Type casting
(c) Exception
(d) Constructor

  • A. (i)-b, (ii)-c, (iii)-d, (iv)-a

  • B. (i)-c, (ii)-d, (iii)-b, (iv)-a

  • C. (i)-a, (ii)-b, (iii)-c, (iv)-d

  • D. (i)-d, (ii)-c, (iii)-a, (iv)-b

Correct answer: D.

Instantiation maps to constructor, disrupted flow to exception, a stored graphical image to bitmap, and value conversion to type casting. The tuple (i)-d, (ii)-c, (iii)-a, (iv)-b appears only in D. Check every match, not just one familiar pair.

Nested class MCQs 5-8: static, inner and anonymous classes

Question 5, UGC NET 2016

It is possible to define a class within a class termed as nested class. There are _____ types of nested classes.

  • A. 2

  • B. 3

  • C. 4

  • D. 5

Correct answer: A.

Java's broad split has two branches: static nested classes and non-static inner classes. Member, local and anonymous classes sit within the inner-class branch, explaining why you may recall a larger number. They are not extra peers.

Question 6, Hexaware 2024

Which statement is true about a static nested class?

  • A. You must have a reference to an instance of the enclosing class in order to instantiate it.

  • B. It does not have direct access to non-static members of the enclosing class.

  • C. Its variables and methods must be static.

  • D. It must extend the enclosing class.

Correct answer: B.

A static nested class has no implicit outer-object reference, so it cannot directly read an outer instance field. It may have instance members; nesting creates no inheritance. Outer.Nested n = new Outer.Nested() makes A false.

Question 7, Hexaware 2024

java
public class MyOuter {
    public static class MyInner {
        public static void foo() { }
    }
}

Which statement, if placed in a class other than MyOuter or MyInner, instantiates the nested class?

Assume no import statement for MyInner exists in that other class.

  • A. MyOuter.MyInner m = new MyOuter.MyInner();

  • B. MyOuter.MyInner mi = new MyInner();

  • C. MyOuter m = new MyOuter(); MyOuter.MyInner mi = m.new MyInner();

  • D. MyInner mi = new MyOuter.MyInner();

Correct answer: A.

Outside MyOuter without an import, both type and constructor need MyOuter.MyInner. Since MyInner is static, it needs no outer instance; m.new MyInner() is for a non-static inner class. B and D leave one use unqualified.

Question 8, Hexaware 2025

Which of the following correctly constructs an anonymous inner class instance?

  • A. Runnable r = new Runnable() { };

  • B. Runnable r = new Runnable(public void run() { });

  • C. Runnable r = new Runnable { public void run(){}};

  • D. System.out.println(new Runnable() {public void run() { }});

Correct answer: D.

The expression needs new Runnable() plus a class body implementing run(). D meets both conditions, and its object is valid for println(Object). A leaves run() unimplemented, B puts a method inside constructor parentheses, and C omits the parentheses.

OOP language MCQs 9-12: classification, modularity and concept boundaries

Question 9, UGC NET 2014

The pure object oriented programming language with extensive metadata available and modifiable at run time is

  • A. Small talk

  • B. C++

  • C. Java

  • D. Eiffel

Correct answer: A.

The intended language is Smalltalk, written as Small talk in the source option. Its object model and reflective environment fit pure object orientation and runtime-modifiable metadata. Java retains primitives and static members, while C++ is multi-paradigm.

Question 10, DSSSB 2023

Which of the following languages are object-oriented programming languages?
Languages:
i) LISP
ii) Java
iii) C++
iv) Simula
v) SQL
vi) C

  • A. i, ii, iii and iv only

  • B. ii, iii and iv only

  • C. i, ii, iii, iv, v and vi

  • D. i and ii only

Correct answer: B.

Here Java, C++ and Simula are object-oriented. LISP is primarily functional, SQL is a query language and C is procedural. The surviving indices are ii, iii and iv, so B follows. Multi-paradigm capabilities do not alter the intended classification.

Question 11, BPSC 2023

Among the following, which statement is correct about the modularity?

  • A. Modularity means hiding the parts of the program

  • B. Modularity refers to dividing a program into subsequent small modules or independent parts

  • C. It refers to overloading the program’s part

  • D. More than one of the above

  • E. None of the above

Correct answer: B.

Modularity divides a program into smaller units with clear responsibilities and interfaces. Hiding internals is information hiding, while overloading shares a name across distinguishable declarations. Only B defines modularity, so D cannot apply.

Question 12, BPSC 2024

Which among the following doesn’t come under OOP concept?

  • A. Data hiding

  • B. Platform independent

  • C. Message Passing

  • D. More than one of the above

  • E. None of the above

Correct answer: B.

Data hiding and message passing describe object-oriented state and interaction. Platform independence is an implementation or runtime property, not a defining OOP concept. Java combines both, creating the association trap behind B.

Classes and objects worked trace: one blueprint, two instances and one nested helper

Trace the output:

java
public class Account {
    static int objectsCreated = 0;
    int balance;

    Account(int opening) {
        balance = opening;
        objectsCreated++;
    }

    void deposit(int amount) { balance += amount; }
    void deposit(int amount, int bonus) { balance += amount + bonus; }

    static class Audit {
        static int doubled(int value) { return 2 * value; }
    }

    public static void main(String[] args) {
        Account a = new Account(1000);
        Account b = new Account(2500);
        a.deposit(500);
        b.deposit(200, 50);
        System.out.println(a.balance + " " + b.balance + " "
                + Account.objectsCreated + " " + Account.Audit.doubled(7));
    }
}

The output is 1500 2750 2 14.

  1. a: 1000 + 500 = 1500.

  2. b: 2500 + 200 + 50 = 2750.

  3. Two constructor calls make objectsCreated = 2.

  4. doubled(7) = 2 × 7 = 14; no Account object is needed.

Classes and objects traps these 12 MCQs expose

Trap

Where to revisit it

Blueprint versus instance

Opening Student example and Q3

Overloading versus inheritance

Q1

Constructor versus allocation

Q3 and Q4

Static nested versus inner

Q5 to Q8

OOP concept versus language feature

Q9 to Q12

Classify each stem as definition, syntax, ownership or classification, then reject options that switch levels.

Use OOP for Teaching CS Exams: Classes and Inheritance to rebuild classes, independent object state and inheritance from worked examples. Then String Handling in Java: Pool, Immutability, Interview Questions carries object-state reasoning into reference identity and immutability. Constructors initialize objects, static nesting removes the outer-instance requirement, and platform independence remains a language or runtime property rather than an OOP concept.

Classes and objects: the next practice step

Use a three-pass retest. First, sort Q1-Q12 into definition, syntax, ownership or classification. Second, explain each rejected option in one sentence. Third, change the trace: set a's opening balance to 1200 and call b.deposit(300, 25); predict 1700 2825 2 14 before running it. For sequenced practice, use the Java Course: Concepts, MCQs & Coding Questions.