Question 1
Consider the following Java program.
What is the maximum number of activation records on the stack during the execution of the program?
2
3
4
5

The IIT Madras BS Programming Concepts using Java (Java) Quiz 1 paper sat on 15 Mar 2026, in the January 2026 term: 15 questions for 100 marks in 120 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 following Java program.
What is the maximum number of activation records on the stack during the execution of the program?
2
3
4
5
Correct answer
5
Consider the Java code given below.
Choose the correct option regarding the given code.
This code generates output:

This code generates output:

This code generates output:

This code generates a compilation error because the method cannot be overridden
Correct answer
This code generates a compilation error because the method cannot be overridden
Consider the Java code given below.
Choose the correct option.
The program generates output:

generates compilation error because a variable of type cannot refer to an object of type .
generates run time error because there is ambiguity in which method is being invoked.
The program generates output:

Correct answer
The program generates output:

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




Correct answer

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




Correct answer

Consider the Java code given below.
Identify the appropriate statements to fill in place of in order to correctly invoke method inside the while loop.
—
—
—
Method cannot be invoked from an outside class.
Correct answer
—
Consider the Java code given below.
Choose the correct option.
This program generates compiler error at Reason: An interface reference cannot be passed as a constructor argument.
This program generates the output:

This program generates the output: followed by runtime error Reason: A method inside is invoking inside , whereas is invoking another method in .

This program generates compiler error at Reason: A method inside is invoking a method defined in an interface.
Correct answer
This program generates the output:

Consider the Java code given below.
Choose the correct option.
Compilation error at because private variable cannot be accessed without using an accessor method.
The program generates the output:

The program generates the output:

The program generates the output:

Correct answer
Compilation error at because private variable cannot be accessed without using an accessor method.
Consider the following Java code.
Identify the lines which have errors.
Line 7 and Line 11
Line 4 and Line 5
Line 15 and Line 20
Line 1 and Line 2
Correct answer
Line 15 and Line 20
Consider the Java code given below.
Identify the correct option to fill in place of , such that the output is:




Correct answer

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

This code generates the output:

generates compilation error because a variable of type cannot refer to an object of type .
generates runtime error because there is ambiguity in which method is being invoked.
Correct answer
This code generates the output:

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




Correct answer

Consider the 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 regarding the above code.
generates compilation error because the method is not abstract.
generates compilation error because class cannot implement two interfaces.
generates compilation error because class is not declared as abstract.
, and generate compilation errors because the methods , and are not abstract.
Correct answer
generates compilation error because class is not declared as abstract.
Consider the Java program below.
Identify the correct option(s) to fill in the blank at , such that the output is:
—
—

—
Correct answers

—