Question 1
Consider the Java code given below.
What will the output be?

The IIT Madras BS Programming Concepts using Java (Java) End Term paper sat on 10 May 2026, in the January 2026 term: 23 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Consider the Java code given below.
What will the output be?




Correct answer

Consider the Java code given below.
What will the output be?
This program generates the output:

This program generates the output:

This program generates the output:

This program generates the output:

Correct answer
This program generates the output:

Consider the Java code given below.
Identify the appropriate statement to fill in the blank at , such that the output is:
—
—
—
—
Correct answer
—
Consider the following block of code.
Which among the following code blocks can replace the given code in order to generate a customized assertion error as shown below?




Correct answer

Consider the Java code given below.
Choose the correct option.
It generates the output:

Compilation fails because and cannot be converted to
Compilation fails because method has not been defined in classes and
It generates the output:

Correct answer
It generates the output:

Consider the Java code given below.
Choose the correct option to fill in place of so that the output is:




Correct answer

Consider the Java code given below.
Choose the correct option.
This program generates the output:
This program generates the output:
This program generates the output:
This program generates the output:
Correct answer
This program generates the output:
Consider the Java code given below.
Choose the correct option to fill in the blank at such that the program generates the following output.
—
—
—
All of these.
Correct answer
—
Consider the Java code given below.
Choose the correct option.
This program generates the output:

This program generates the output:

This program generates the output:

This program terminates abnormally due to unhandled exception(s).
Correct answer
This program generates the output:

Consider the Java code given below.
Choose the correct option.
It generates the output:
It generates the output:
It generates the output:
It generates the output:
Correct answer
It generates the output:
Consider the Java code given below. Suppose the file is written successfully by the program.
What will the output be?
—



Correct answer

Consider the code given below that checks whether two normal distributions are identical. Method is overridden to compare two objects as follows. If two distributions have the same mean and variance, then both are considered identical. Based on the given information, answer the question that follows.
Choose the correct option to fill in place of so that the output is:




Correct answer

Consider the following Java code that uses chained exceptions.
What can be the output of this code?




Correct answer

Method returns an infinite sequential ordered produced by iterative application of a function to an initial element , producing a consisting of , , , etc. Based on the above information, consider the code given below, and answer the question that follows.
What will the output be?
—
—
—
—
Correct answer
—
Consider the code given below.
Choose the correct option.
The code always prints 2000.
The code prints any number in the range 1000 to 2000
The code prints any number in the range 0 to 1000
The code always prints 1000.
Correct answer
The code prints any number in the range 1000 to 2000
Consider the Java code given below.
What will the output be?




Correct answer

Consider the Java code given below.
What will the output be?




Correct answer

From among the options, identify the appropriate function header(s) for function that takes as input an array of objects and prints the highest salary among them.
Choose the correct option(s).
—
—

—
Correct answers

—
Consider the Java code given below.
Which of the following is NOT true about the given code?
This program may generate .
The program may generate the output:

The program may generate the output:

The program may generate the output:

Correct answer
This program may generate .
Consider the Java code given below.
Choose the correct option to be filled in place of such that the above program produces the GUI given below.




Correct answer

Consider the code given below.
What will the output be?
—
—
—
—
Correct answer
—
Method returns an that describes the specific value, if non-null; otherwise returns an . Based on this description, consider the code given below, and answer the question that follows.
Choose the correct option.
This program generates the output:

This program terminates due to after printing the message:

This program generates the output:

This program generates the output:

Correct answer
This program generates the output:

Consider the following code which has 4 user-defined threads, two threads would work as stock adders to a warehouse (object) and the other two work as stock removers from the same warehouse.
Choose all the options that would NEVER occur as a result of execution of this code.
It may generate the output as:

It may generate the output as:

It may generate the output as:

It may generate the output as:

Correct answers
It may generate the output as:

It may generate the output as:
