Quiz Space

Programming Concepts using Java Quiz 1: 13 July 2025 (May 2025 term)

Question 1

+7 marksOne correct option

Consider the following Java program. When the call stack reaches its maximum depth, which method will be at the top of the call stack?

java
class Example {
public void methodA(int x) {
if (x > 0) {
methodB(x - 1);
}
}
public void methodB(int y) {
if (y > 0) {
methodC(y - 1);
}
}
public void methodC(int z) {
if (z > 0) {
methodA(z - 1);
}
}
}
class TestCallStack {
public static void main(String[] args) {
Example e = new Example();
e.methodA(3);
}
}
  1. A
  2. B
  3. C
  4. D

Question 2

+7 marksOne correct option

Consider the Java code below.

java
class Account {
public void login() {
System.out.println("Basic login");
}
}
class User extends Account {
public void login() {
super.login();
System.out.println("User login");
}
public void login(String code) {
System.out.println("User login with code: " + code);
}
}
class Admin extends User {
public void login() {
super.login();
System.out.println("Admin login");
}
public void login(String code) {
System.out.println("Admin login with code: " + code);
}
}
public class Test {
public static void main(String[] args) {
User obj = new Admin(); // LINE 1
obj.login();
obj.login("9999");
}
}

Choose the correct option.

  1. A
  2. B
  3. C
  4. D

Question 3

+7 marksOne correct option

Consider the Java code given below.

java
class Animal {
private String name;
public Animal(String n) {
name = n;
}
public String toString() {
return "Name: " + name;
}
}
class Dog extends Animal {
private String breed;
public Dog(String n, String b) {
//LINE 1
breed = b;
}
public String toString() {
return super.toString() + ", Breed: " + breed;
}
}
public class Test {
public static void main(String[] args) {
Animal dog = new Dog("Rocky", "Golden Retriever");
System.out.println(dog);
}
}

Choose the correct option to be filled in place of LINE 1 so that the output is:

Name: Rocky, Breed: Golden Retriever

  1. A
  2. B
  3. C
  4. D

12 more questions 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 Quiz 1 13 Jul 2025 paper

The IIT Madras BS Programming Concepts using Java (Java) Quiz 1 paper sat on 13 Jul 2025, in the May 2025 term: 15 questions for 100 marks in 120 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 Quiz 1 13 Jul 2025 at a glance
TermMay 2025 term
SubjectProgramming Concepts using Java
Course codeBSCS2005
Questions15
Marks100
Duration120 min
MCQ11
MSQ4
Official paperIIT M DIPLOMA AN EXAM QDD2 13 July 2025
Negative markingNo negative marking.
Updated

Same Quiz 1, other subjects

More Java