uiz Space

January 2026 term · Programming Concepts using Java · BSCS2005

Programming Concepts using Java Quiz 2: 12 April 2026 (January 2026 term)

The IIT Madras BS Programming Concepts using Java (Java) Quiz 2 paper sat on 12 Apr 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.

Questions
15
Marks
100
Duration
120 min
MCQ
13
MSQ
2

Updated

Official paper: Programming Concepts Using Java 06 Apr 26 · No negative marking.

Question 1

+6 marksOne correct option

Consider the Java code given below.

What will the output be?

Consider the Java code given below.
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • B
    Figure from the original question paper

Question 2

+6 marksOne correct option

Consider the Java code given below that prints the credit points of courses. From among the options, identify the appropriate function header for the function that takes as input a list of courses and prints their credit points.

Choose the correct option.

Consider the Java code given below that prints the credit points of courses. From among the options, identify the approp
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • C

    —

Question 3

+6 marksOne correct option

Consider the two Java files given below.

Choose the correct option.

Consider the two Java files given below.
Consider the two Java files given below.
  1. A

    and generate compilation errors.

  2. B

    Only generates compilation error.

  3. C

    and generate compilation errors.

  4. D

    No compilation errors.

Show answer

Correct answer

  • B

    Only generates compilation error.

Question 4

+6 marksOne correct option

Consider the Java code given below about controlling robot hardware values.

Choose the correct option.

Consider the Java code given below about controlling robot hardware values.
  1. A

    and generate a compilation error because method is already defined with the same signature.

  2. B

    and generate a compilation error because method is already defined with the same signature.

  3. C

    Only generates a compilation error because method is already defined with the same signature.

  4. D

    This program generates output:

    This program generates output:
Show answer

Correct answer

  • C

    Only generates a compilation error because method is already defined with the same signature.

Question 5

+6 marksOne correct option

Consider the Java code given below.

Identify the appropriate option to fill in place of such that the output is:

Consider the Java code given below.
Consider the Java code given below.
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • D

    —

Question 6

+6 marksOne correct option

Consider the code given below.

Choose the correct option.

Consider the code given below.
  1. A

    generates compilation error because method cannot be invoked on .

  2. B

    This code generates the output followed by runtime Error at due to ambiguity in .

  3. C

    This code generates the output:

    This code generates the output:
  4. D

    This code generates the output:

    This code generates the output:
Show answer

Correct answer

  • C

    This code generates the output:

    This code generates the output:

Question 7

+7 marksOne correct option

Consider the Java code given below.

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

Consider the Java code given below.
Consider the Java code given below.
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 8

+7 marksOne correct option

The function is defined as: If the specified key is not already associated with a value or is associated with , associates it with the given non-null value. Otherwise, replaces the associated value with the results of the given remapping function, or removes if the result is . Consider the Java code given below.

Choose the correct option.

The  function is defined as: If the specified key is not already associated with a value or is associated with  , associ
  1. A

    generates a compilation error due to duplicate keys.

  2. B

    The program generates the output:

    The program generates the output:
  3. C

    The program generates the output:

    The program generates the output:
  4. D

    The program generates the output:

    The program generates the output:
Show answer

Correct answer

  • B

    The program generates the output:

    The program generates the output:

Question 9

+7 marksOne correct option

Consider the following Java code.

Choose the correct option when the class is executed as:

Consider the following Java code.
  1. A

    This code generates output:

  2. B

    This code generates AssertionError:

  3. C

    This code generates AssertionError:

  4. D

    This code generates AssertionError:

Show answer

Correct answer

  • C

    This code generates AssertionError:

Question 10

+7 marksOne correct option

Consider the following Java code.

What will the output be?

Consider the following Java code.
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 11

+7 marksOne correct option

Consider the Java code given below.

Choose the correct option to fill in place of so that the output is:

Please note the following methods from types and : : Removes the object at the top of this stack and returns it. : Retrieves and removes the head of this deque, or returns null if empty. : Retrieves, but does not remove, the head of this deque, or returns null if empty.

Consider the Java code given below.
Consider the Java code given below.
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • C
    Figure from the original question paper

Question 12

+7 marksOne correct option

Consider the code given below about an aircraft maintenance record.

What will the output be?

Consider the code given below about an aircraft maintenance record.
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • A
    Figure from the original question paper

Question 13

+7 marksOne correct option

Consider the following Java code that uses chained exceptions in the context of a sports match analysis system.

What can the output of this code be?

Consider the following Java code that uses chained exceptions in the context of a sports match analysis system.
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • A
    Figure from the original question paper

Question 14

+8 marksOne or more correct options

Consider the Java code given below that should print the names of individuals whose BMI is between 18 and 25 (both inclusive).

Choose the correct option(s) to fill in place of to obtain the right answer.

Consider the Java code given below that should print the names of individuals whose BMI is between 18 and 25 (both inclu

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • C
    Figure from the original question paper
  • D
    Figure from the original question paper

Question 15

+7 marksOne or more correct options

Consider the code given below. maps each element of to its frequency of occurrence in list.

Identify the appropriate option(s) to fill in the blank at , such that the output is:

Consider the code given below.  maps each element of  to its frequency of occurrence in list.
Consider the code given below.  maps each element of  to its frequency of occurrence in list.

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • C
    Figure from the original question paper
  • D
    Figure from the original question paper