Quiz Space

Programming Concepts using Java OPPE 1: 19 July 2025 (May 2025 term)

Question 1

+25 marksProgramming

Complete the Java code that uses the concept of inheritance to demonstrate dynamic method dispatching.

Class AirPlane has the following members:

  • Private instance variable model
  • Constructor to initialize model
  • Accessor method for model
  • Method display to display the text: Inside an anonymous airplane

Classes Boeing and AirBus should be defined in such a way that any object of Boeing or AirBus can be assigned to a reference variable of type AirPlane. See the main method to understand the context.

  • For an object of Boeing, method display should print the message Inside Boeing followed by the model of the Boeing.
  • For an object of AirBus, method display should print the message Inside AirBus followed by the model of the AirBus.

What you have to do:

  • Define an accessor method for model inside class AirPlane
  • Define method display inside class AirPlane
  • Define classes Boeing and AirBus

Question 2

+25 marksProgramming

Write a program that takes input to create an array of Staff objects and prints the remuneration of each staff for their duties. Faculty should be assigned to Invigilation duty, and Hod should be assigned to Squad duty.

Abstract class Staff has the following members:

  • String name, String duty, and int num as private instance variables, where duty is the type of duty, which may be either Invigilation or Squad, and num is the number of hours of duty.
  • Constructor to initialize the instance variables
  • Required accessor methods
  • Method toString() to return the name of the staff
  • Abstract method abstract String remuneration()

Class Faculty is a child class of Staff and has the following members:

  • Constructor to initialize the instance variables
  • Method remuneration() returns the remuneration as num * 150 if the duty is Invigilation, otherwise returns the string Wrong duty assigned.

Class Hod is a child class of Staff and has the following members:

  • Constructor to initialize the instance variables
  • Method remuneration() returns the remuneration as num * 500 if the duty is Squad, otherwise returns the string Wrong duty assigned.

Class ExamBranch has the following members:

  • Method printStaffRemunerations that prints the name and remuneration of the staff if they are assigned valid duty, otherwise prints the name and the corresponding error message, for each staff.
  • main method accepts the name, duty, and number of hours of two Faculty members followed by that of two Hods, and invokes method printStaffRemunerations.

What you have to do:

  • Define method printStaffRemunerations in class ExamBranch

Question 3

+25 marksProgramming

Write a Java program that, given as input the names of resorts in a tourist place and the ratings scored by each of them in 3 consecutive months, prints the names of those resorts which have scored at least 4 in all the months. Complete the program as specified below.

Class Place has/should have the following members:

  • Private instance variable Map<String, ArrayList<Integer>> resortMap (maps the resort name to the list of ratings scored by it in each month).
  • A constructor to initialize the instance variable.
  • An accessor method to access the instance variable.

Class FClass has the following members:

  • A method getFinalList() that takes an object of class Place as a parameter and returns a list of resort names which have scored at least 4 in all the months.
  • main() method does the following:
    • Accepts inputs to instantiate an object of Place. The input is accepted in the order: resort name followed by the list of its ratings.
    • Invokes method getFinalList() to get the list of resort names which have a rating of at least 4 in all the months.
    • Prints the list returned by the method getFinalList().

What you have to do:

  • Define method getFinalList() of class FClass.

One more question in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Java OPPE 1 19 Jul 2025 paper

The IIT Madras BS Programming Concepts using Java (Java) OPPE 1 paper sat on 19 Jul 2025, in the May 2025 term (T2 2025): 4 questions for 100 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureJava OPPE 1 19 Jul 2025 at a glance
TermMay 2025 term (T2 2025)
SubjectProgramming Concepts using Java
Course codeBSCS2005
Questions4
Marks100
Duration180 min
Programming4
Official paperOPPE 1, 19 Jul 2025
Negative markingNo negative marking.
Updated

More Java