uiz Space

May 2026 term · Programming Concepts using Java · BSCS2005

Programming Concepts using Java Quiz 2: 16 August 2026, Set 1 (May 2026 term)

The IIT Madras BS Programming Concepts using Java (Java) Quiz 2 paper sat on 16 Aug 2026, in the May 2026 term, set 1: 15 questions for 50 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
50
Duration
120 min
MCQ
13
MSQ
2

Updated

Official paper: Programming Concepts Indian Institute Of Technology, Madras - Bs In Data Science And Applications Using Java 16 Jul 26 · No negative marking.

Question 1

+3 marksOne correct option

Consider the Java code below.

Choose the correct option.

Consider the Java code below.
  1. A

    The output is:

    The output is:
  2. B

    generates compilation error because a variable of type cannot refer to an object of type .

  3. C

    The output is:

    The output is:
  4. D

    The output is:

    The output is:
Show answer

Correct answer

  • A

    The output is:

    The output is:

Question 2

+3 marksOne correct option

Consider the following Java code.

Choose the correct option.

Consider the following Java code.
  1. A

    The program generates the output:

    The program generates the output:
  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 3

+3 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
    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 4

+3 marksOne correct option

Consider the Java code given below that checks whether a necklace has a mirror pattern of beads (i.e., the sequence of bead colors is the same when viewed from both ends).

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

You may make use of the descriptions of the methods given below. These are methods inside type . : Retrieves and removes the last element of this deque, or returns if this deque is empty. : Retrieves and removes the head of this deque, or returns if this deque is empty.

Consider the Java code given below that checks whether a necklace has a mirror pattern of beads (i.e., the sequence of b
Consider the Java code given below that checks whether a necklace has a mirror pattern of beads (i.e., the sequence of b
  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 5

+3 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
    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 6

+3 marksOne correct option

Consider the Java code given below.

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

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 7

+3 marksOne correct option

Consider two Java files located in two different packages as shown below.

Choose the correct option.

Consider two Java files located in two different packages as shown below.
  1. A

    and generate compilation errors.

  2. B

    generates a compilation error, while others compile fine.

  3. C

    , , and generate compilation errors.

  4. D

    Only generates a compilation error.

Show answer

Correct answer

  • A

    and generate compilation errors.

Question 8

+3 marksOne correct option

Consider the Java code given below.

Identify the statement that throws the when the class is executed as:

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

  • B
    Figure from the original question paper

Question 9

+3 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

  • C
    Figure from the original question paper

Question 10

+3 marksOne correct option

Consider the Java code given below.

Choose the correct option.

Consider the Java code given below.
  1. A

    This program generates the output:

    This program generates the output:
  2. B

    This program generates the output:

    This program generates the output:
  3. C

    This program generates a compilation error because of type cannot invoke method .

  4. D

    and generate compilation errors because static interface methods cannot be accessed using the interface name.

Show answer

Correct answer

  • C

    This program generates a compilation error because of type cannot invoke method .

Question 11

+4 marksOne correct option

Consider the Java code given below.

After type erasure, which of the following correctly represents the class?

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

  • A
    Figure from the original question paper

Question 12

+4 marksOne correct option

Consider the Java code given below.

Choose the correct option.

Consider the Java code given below.
  1. A

    will print entries in the order in which they were inserted. will print entries in sorted order of keys.

  2. B

    will print entries in unspecified order. will print entries in sorted order of keys.

  3. C

    will print entries in sorted order of keys. will print entries in insertion order.

  4. D

    Both and will print entries in unspecified order.

Show answer

Correct answer

  • B

    will print entries in unspecified order. will print entries in sorted order of keys.

Question 13

+4 marksOne correct option

Consider the Java code given below.

Choose the correct option.

Consider the Java code given below.
  1. A

    This program generates the output:

    This program generates the output:
  2. B

    This program generates the output:

    This program generates the output:
  3. C

    This program generates the output:

    This program generates the output:
  4. D

    This program generates the output:

    This program generates the output:
Show answer

Correct answer

  • B

    This program generates the output:

    This program generates the output:

Question 14

+4 marksOne or more correct options

Consider the Java code given below that prints the highest-rated movie among a set of given objects. From among the options, identify the appropriate function header for the function that takes as input an array of objects and prints the highest rating.

Choose the correct option(s) for the function header in .

Consider the Java code given below that prints the highest-rated movie among a set of given  objects. From among the opt

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

    —

Show answer

Correct answers

  • B
    Figure from the original question paper
  • D

    —

Question 15

+4 marksOne or more correct options

Consider the Java code given below that prints the names of trees whose height is between 2 and 5 meters (both inclusive).

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

Consider the Java code given below that prints the names of trees whose height is between 2 and 5 meters (both inclusive

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

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