BPSC TRE · Computer Science

OOP Previous Year Questions

17 OOP (Computer Science) questions asked in BPSC TRE previous year papers, each with the correct answer and explanation. Read them free on UTpaper, or attempt the full papers as timed online tests.

  • 17 questions
  • Official answer key
  • Free

Other Computer Science topics

Q1BPSC TRE 2.0 (2023) Computer Class 9-10
What difference do the fifth generation computers have from other generation computers?
  1. ATechnological advancement
  2. BObject-oriented programming
  3. CScientific code
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (D) More than one of the above

Explanation

Fifth-generation computers are marked both by technological advancement (AI, parallel processing) and by object-oriented programming, so more than one option applies.

Q2BPSC TRE 2.0 (2023) Computer Class 9-10
Which of the following constructors is provided by the C++ compiler if not defined in a class?
  1. ACopy constructor
  2. BDefault constructor
  3. CParameterized constructor
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (B) Default constructor

Explanation

If a class defines no constructor at all, the compiler supplies a default constructor.

Q3BPSC TRE 2.0 (2023) Computer Class 9-10
Which of the following can be considered as the members that can be inherited but not accessible in any class?
  1. APublic
  2. BProtected
  3. CPrivate
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (C) Private

Explanation

Private members are inherited by a derived class but cannot be accessed directly from it.

Q4BPSC TRE 2.0 (2023) Computer Class 9-10
Which of the following statements is completely true? I. In an object-oriented programming language, all the function calls are resolved at compile-time. II. In a procedure programming language, all the function calls are resolved at compile-time.
  1. AOnly II
  2. BOnly I
  3. CBoth I and II
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) Only II

Explanation

Object-oriented languages also use run-time (virtual) binding, so I is false; in procedural languages every call is resolved at compile time, so only II is true.

Q5BPSC TRE 2.0 (2023) Computer Class 9-10
How can one implement the compile-time polymorphism in the C++ programming language?
  1. ABy using the template
  2. BBy using the concepts of inheritance
  3. CBy using both the virtual functions and inheritance
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) By using the template

Explanation

Templates (along with overloading) are resolved at compile time, so they implement compile-time polymorphism; virtual functions give run-time polymorphism.

Q6BPSC TRE 2.0 (2023) Computer Class 9-10
Among the following, which statement is correct about the modularity?
  1. AModularity means hiding the parts of the program.
  2. BModularity refers to dividing a program into subsequent small modules or independent parts.
  3. CIt refers to overloading the program's part.
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (B) Modularity refers to dividing a program into subsequent small modules or independent parts.

Explanation

Modularity means splitting a program into small independent modules.

Q7BPSC TRE 3.0 (2024) Computer Science Class 11-12
Which of the following is a pillar of OOP?
  1. AInheritance
  2. BEncapsulation
  3. CAbstraction
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (D) More than one of the above

Explanation

Inheritance, encapsulation and abstraction, along with polymorphism, are the pillars of OOP, so more than one option is correct.

Q8BPSC TRE 3.0 (2024) Computer Science Class 11-12
What is the access specifier used to make members of a class accessible only within the same package?
  1. Aprivate
  2. Bpublic
  3. Cpackage-private
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (C) package-private

Explanation

Java's default (package-private) access, with no modifier at all, makes a member visible only to classes in the same package.

Q9BPSC TRE 3.0 (2024) Computer Science Class 11-12
Inheritance in OOP allows a class to:
  1. AInherit properties and behavior from another class
  2. BCreate instances of another class
  3. COverride methods of another class
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) Inherit properties and behavior from another class

Explanation

Inheritance lets a class acquire the properties (fields) and behaviour (methods) of another class. Overriding is a separate feature that inheritance makes possible.

Q10BPSC TRE 1.0 (2023) Computer Science Class 11-12
Which of the following features must be supported by any programming language to become a pure object-oriented programming language?
  1. AEncapsulation
  2. BInheritance
  3. CPolymorphism
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (D) More than one of the above

Explanation

A pure object-oriented language must support encapsulation, inheritance and polymorphism (along with abstraction and objects), so all three are required.

Q11BPSC TRE 1.0 (2023) Computer Science Class 11-12
Which is correct syntax of inheritance?
  1. Aclass base_classname : access derived_classname {/*define class body*/};
  2. Bclass derived_classname : access base_classname {/*define class body*/};
  3. Cclass derived_classname : base_classname {/*define class body*/};
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (D) More than one of the above

Explanation

Both (B) and (C) are valid: class derived : access base { }; and, without an access specifier, class derived : base { }; where the default is private for classes.

Q12BPSC TRE 1.0 (2023) Computer Science Class 11-12
Which of the following statements is correct about the class?
  1. AAn object is an instance of its class.
  2. BA class is an instance of its object.
  3. CAn object is the instance of the data type of that class.
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) An object is an instance of its class.

Explanation

A class is a blueprint, and an object is an instance of its class. The reverse statement is wrong.

Q13BPSC TRE 1.0 (2023) Computer Science Class 11-12
Which of the following can be used to create an abstract class in the C++ programming language?
  1. ABy using the pure virtual function in the class
  2. BBy declaring a virtual function in the base class
  3. CBy declaring the virtual keyword afterward the class declaration
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) By using the pure virtual function in the class

Explanation

A class becomes abstract when it has at least one pure virtual function, for example virtual void f() = 0;. Such a class cannot be instantiated.

Q14BPSC TRE 1.0 (2023) Computer Science Class 11-12
Which feature of OOP is indicated by the following code? class student{int marks;}; class topper: public student{int age; topper(int age) {this.age=age;}};
  1. AEncapsulation and inheritance
  2. BInheritance and polymorphism
  3. CPolymorphism
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) Encapsulation and inheritance

Explanation

Data hidden inside the classes shows encapsulation, and topper deriving from student with public shows inheritance. There is no overloading or overriding, so polymorphism is not shown.

Q15BPSC TRE 2.0 (2023) Computer Science Class 11-12
A constructor is called whenever
  1. Aan object is created
  2. Ba class is created
  3. Ca class is declared
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) an object is created

Explanation

A constructor runs automatically each time an object of the class is created, and it initialises that object. Declaring a class does not call it.

Q16BPSC TRE 2.0 (2023) Computer Science Class 11-12
The number of access specifiers in class of C++ is
  1. A2
  2. B3
  3. C4
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (B) 3

Explanation

C++ has three access specifiers: public, private and protected.

Q17BPSC TRE 2.0 (2023) Computer Science Class 11-12
Which concept of C++ is used to reuse the written code?
  1. APolymorphism
  2. BInheritance
  3. CEncapsulation
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (B) Inheritance

Explanation

Inheritance lets a derived class reuse the data and functions of an existing base class without rewriting them.

How to use these BPSC TRE Computer Science questions

Every question here was asked in a real BPSC TRE paper; the paper and shift are shown on the card, and the number opens the question on its own page. Try each one before tapping Show answer, then attempt the full BPSC TRE papers as timed tests to check your speed under exam conditions.

More BPSC TRE subjects