uiz Space

September 2025 term · Programming Concepts using Java · BSCS2005

Programming Concepts using Java End Term: 21 December 2025 (September 2025 term)

The IIT Madras BS Programming Concepts using Java (Java) End Term paper sat on 21 Dec 2025, in the September 2025 term: 23 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
23
Marks
100
Duration
180 min
MCQ
17
MSQ
6

Updated

Official paper: Programming Concepts Using Java 18 Dec 25 · No negative marking.

Question 1

+5 marksOne correct option

Consider the code given below.

Which of the following is NOT true about the given code?

Consider the code given below.
  1. A

    This program may generate ConcurrentModificationException.

  2. B

    It may generate output:

    It may generate output:
  3. C

    It may generate output:

    It may generate output:
  4. D

    It may generate output:

    It may generate output:
Show answer

Correct answer

  • A

    This program may generate ConcurrentModificationException.

Question 2

+4 marksOne correct option

Consider the code given below.

How many activation records are created on the stack during the execution of the code?

Consider the code given below.
  1. A

    3

  2. B

    4

  3. C

    5

  4. D

    6

Show answer

Correct answer

  • D

    6

Question 3

+6 marksOne or more correct options

Consider the Java code given below.

Choose all the options which can be used in place of ARG in LINE 1 so that the code outputs the sum of two coordinates.

Consider the Java code given below.

Select all that apply.

  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answers

  • A

    —

  • C

    —

Question 4

+5 marksOne or more correct options

Consider the following Java code.

Identify the line/s which has/have errors.

Consider the following Java code.

Select all that apply.

  1. A

    Line 2

  2. B

    Line 7

  3. C

    Line 11

  4. D

    Line 12

  5. E

    Line 18

Show answer

Correct answers

  • C

    Line 11

  • D

    Line 12

  • E

    Line 18

Question 5

+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: [Amit, Neha, Sita]

  2. B

    This program generates the output: [Neha, Sita]

  3. C

    This program generates the output: [Ravi]

  4. D

    This program generates the output: [Amit, Ravi]

Show answer

Correct answer

  • B

    This program generates the output: [Neha, Sita]

Question 6

+4 marksOne correct option

Consider the Java code given below.

What will happen when the button (labelled "Press") is clicked?

Consider the Java code given below.
  1. A

    The label will change to "Button Pressed'' when the button is clicked

  2. B

    The label remains "Start"

  3. C

    The code throws a runtime error

  4. D

    The button will disappear after clicking

Show answer

Correct answer

  • A

    The label will change to "Button Pressed'' when the button is clicked

Question 7

+5 marksOne or more correct options

Consider the Java code given below.

Choose the correct options to be filled in place of CODE SEGMENT so that the label displays the text entered in the text field.

Consider the Java code given below.

Select all that apply.

  1. A
    Figure from the original question paper
  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answers

  • A
    Figure from the original question paper
  • D

    —

Question 8

+5 marksOne or more correct options

Consider the Java code given below.

Which of the following options is/are possible result/s of the above code?

Consider the Java code given below.

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

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

Question 9

+4 marksOne or more correct options

Consider the Java code given below.

Which of the following is/are possible output(s) of the above code?

Consider the Java code given below.

Select all that apply.

  1. A

    100

  2. B

    70

  3. C

    50

  4. D

    20

Show answer

Correct answers

  • B

    70

  • C

    50

Question 10

+4 marksOne correct option

Assume that the file fruits.txt contains the following lines:

Consider the code given below.

Choose the correct option.

Assume that the file fruits.txt contains the following lines:
Assume that the file fruits.txt contains the following lines:
  1. A

    LINE 1 generates IOException.

  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

  • C

    This program generates the output:

    This program generates the output:

Question 11

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

+4 marksOne correct option

Consider the Java code given below.

What will the output be?

Consider the Java code given below.
  1. A

    null, null, 0.0

  2. B

    A12345, null, 5000.0

  3. C

    A12345, XYZ, 5000.0

  4. D

    A12345, Rina, 0.0

  5. E

    ******, XYZ, 0.0

Show answer

Correct answer

  • B

    A12345, null, 5000.0

Question 13

+4 marksOne correct option

Method Optional.ofNullable(T value) returns an Optional that describes the specific value, if non-null; otherwise returns an empty Optional. Based on this description, consider the code given below, and answer the given question.

Choose the correct option.

Method Optional.ofNullable(T value) returns an Optional that describes the specific value, if non-null; otherwise return
  1. A

    This program generates the output:

    This program generates the output:
  2. B

    This program terminates due to NullPointerException after printing:

    This program terminates due to NullPointerException after printing:
  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

  • A

    This program generates the output:

    This program generates the output:

Question 14

+4 marksOne correct option

Consider the following Java code.

What will the output be?

Consider the following Java code.
Consider the following Java code.
  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 15

+4 marksOne correct option

Consider the Java code given below.

Identify the appropriate statement to fill in the blank at LINE 1, such that the output is:

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

    ((Displayable)iter.get_next()).display();

  2. B

    ((Book)iter.get_next()).display();

  3. C

    ((Library)iter.get_next()).display();

  4. D

    iter.get_next().display();

Show answer

Correct answer

  • A

    ((Displayable)iter.get_next()).display();

Question 16

+4 marksOne correct option

Method merge of interface Map has the following structure and functionality:

If the specified key is not already associated with a value or is associated with null, 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 null. Consider the code given below that uses the merge method to combine two maps, and answer the given question.

Choose the correct option regarding the code.

Method merge of interface Map has the following structure and functionality:
Method merge of interface Map has the following structure and functionality:
  1. A

    It generates the output: {Apple=10, Banana=8, Orange=8}

  2. B

    It generates the output: {Apple=10, Banana=-2, Orange=8}

  3. C

    It generates the output: {Banana=-2, Apple=10, Orange=8}

  4. D

    It generates NullPointerException during runtime.

Show answer

Correct answer

  • B

    It generates the output: {Apple=10, Banana=-2, Orange=8}

Question 17

+6 marksOne or more correct options

Consider the code given below.

Identify the appropriate function header for function sum, such that the output is 78.0, 33.5.

Consider the code given below.
Consider the code given below.

Select all that apply.

  1. A

    —

  2. B
    Figure from the original question paper
  3. C

    —

  4. D

    —

Show answer

Correct answers

  • A

    —

  • C

    —

Question 18

+4 marksOne correct option

Consider the following Java code.

Choose the correct option when the class is executed as: java -ea ShoppingTest

Consider the following Java code.
  1. A

    This code generates output: 2600.0

  2. B

    This code generates AssertionError: Item price must be positive

  3. C

    This code generates AssertionError: Adding item exceeds cart limit

  4. D

    This code generates AssertionError: Maximum limit must be positive

Show answer

Correct answer

  • C

    This code generates AssertionError: Adding item exceeds cart limit

Question 19

+4 marksOne correct option

Consider the following Java code that uses chained exceptions.

Which of following can be the output of this code?

Consider the following Java code that uses chained exceptions.
Consider the following Java code that uses chained exceptions.
  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 20

+4 marksOne correct option

Consider the code given below.

Choose the correct option.

Consider the code given below.
  1. A

    Compilation error at LINE 1 because method printQuality() is not overridden in class EpsonPrinter

  2. B

    Compilation error at LINE 2 because method startPrint() is not overridden in class CanonPrinter

  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

  • D

    This program generates the output:

    This program generates the output:

Question 21

+4 marksOne correct option

Consider the code given below.

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

Consider the code given below.
Consider the 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 22

+4 marksOne correct option

Consider the Java code given below.

Choose the correct option.

Consider the Java code given below.
  1. A

    It generates the output as:

    It generates the output as:
  2. B

    Compilation fails because Car and Bike do not override fuel()

  3. C

    Compilation fails because Car and Bike cannot be assigned to Vehicle

  4. D

    It generates the output as:

    It generates the output as:
Show answer

Correct answer

  • D

    It generates the output as:

    It generates the output as:

Question 23

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