Quiz Space

Java Quiz 2: 23 November 2025 (September 2025 term)

Question 1

+7 marksOne or more correct options

Select all that apply.

  1. A

    students.stream()
    .map(s -> s.grade >= 70.0 && s.grade <= 90.0)
    .forEach(s -> System.out.println(s.name));

  2. B

    students.stream()
    .filter(s -> s.grade >= 70.0 && s.grade <= 90.0)
    .forEach(s -> System.out.println(s.name));

  3. C

    students.stream()
    .filter(s -> s.grade >= 70.0)
    .filter(s -> s.grade <= 90.0)
    .forEach(s -> System.out.println(s.name));

  4. D

    students.stream()
    .filter(s -> s.grade >= 70.0)
    .map(s -> s.grade <= 90.0)
    .forEach(s -> System.out.println(s.name));

Question 2

+5 marksOne correct option

Consider the code given below.
interface Vehicle {
public abstract double getFuelEfficiency();
}
class Car implements Vehicle, Cloneable {
protected double fuelCapacity;
protected double mileage;
public Car(double fuel, double m) {
fuelCapacity = fuel;
mileage = m;
}
public double getFuelEfficiency() {
return fuelCapacity * mileage;
}
public Car clone() throws CloneNotSupportedException {
return (Car) super.clone();
}
}
class ElectricCar extends Car {
public ElectricCar(double batteryCapacity, double mileage) {
super(batteryCapacity, mileage);
}
public ElectricCar clone() throws CloneNotSupportedException {
return (ElectricCar) super.clone();
}
}
public class VehicleTest {
public static void main(String[] args) {
try {
ElectricCar e1 = new ElectricCar(50, 2);
ElectricCar e2 = e1.clone();
e1.fuelCapacity = 100;
System.out.print(e1.getFuelEfficiency() + e2.getFuelEfficiency());
} catch (CloneNotSupportedException e) {
System.out.println("Cloning not supported");
}
}
}
What will the output be?

  1. A

    200.0

  2. B

    300.0

  3. C

    400.0

  4. D

    Cloning not supported

Question 3

+7 marksOne correct option
  1. A

    while (!s.isEmpty()) {
    if (s.pop().equals(d.peek())) {
    return false;
    }
    }

  2. B

    while (!s.isEmpty()) {
    if (s.pop().equals(d.poll())) {
    return false;
    }
    }

  3. C

    while (!s.isEmpty()) {
    if (!s.pop().equals(d.poll())) {
    return false;
    }
    }

  4. D

    while (!s.isEmpty()) {
    if (!s.pop().equals(d.peek())) {
    return false;
    }
    }

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 2 23 Nov 2025 paper

The IIT Madras BS Programming Concepts using Java (Java) Quiz 2 paper sat on 23 Nov 2025, in the September 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 2 23 Nov 2025 at a glance
TermSeptember 2025 term
SubjectProgramming Concepts using Java
Course codeBSCS2005
Questions15
Marks100
Duration120 min
MSQ4
MCQ11
Official paperIIT M DIPLOMA AN EXAM QDD2 23 Nov 2025 NEW
Negative markingNo negative marking.
Updated

Same Quiz 2, other subjects

More Java