MauryaHub PYQ Practice

Programming Concepts using Java · End Term · Sep 2025 · AN

Programming Concepts using Java · End Term · Sep 2025 AN

← Course papers · Start practice / exam

Questions and published explanations below are available without starting a test. Some questions may not have a published solution yet.

0 / 23 published solutions

Question 2 MCQ · 5.0 marks

Consider the code given below.
Source diagram or notation
Which of the following is **NOT true** about the given code?
A.
This program may generate ConcurrentModificationException.
B.
It may generate output:
Source diagram or notation
C.
It may generate output:
Source diagram or notation
D.
It may generate output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q2

Question 3 MCQ · 4.0 marks

Consider the code given below.
Source diagram or notation
How many activation records are created on the stack during the execution of the code?
A.
3
B.
4
C.
5
D.
6

A published solution is not available for this question yet.

Report a correction for Q3

Question 4 MSQ · 6.0 marks

Consider the Java code given below.
Source diagram or notation
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.
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q4

Question 5 MSQ · 5.0 marks

Consider the following Java code.
Source diagram or notation
Identify the line/s which has/have errors.
A.
Line 2
B.
Line 7
C.
Line 11
D.
Line 12
E.
Line 18

A published solution is not available for this question yet.

Report a correction for Q5

Question 6 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct option.
A.
This program generates the output: [Amit, Neha, Sita]
B.
This program generates the output: [Neha, Sita]
C.
This program generates the output: [Ravi]
D.
This program generates the output: [Amit, Ravi]

A published solution is not available for this question yet.

Report a correction for Q6

Question 7 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will happen when the button (labelled "Press") is clicked?
A.
The label will change to "Button Pressed'' when the button is clicked
B.
The label remains "Start"
C.
The code throws a runtime error
D.
The button will disappear after clicking

A published solution is not available for this question yet.

Report a correction for Q7

Question 8 MSQ · 5.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct options to be filled in place of CODE SEGMENT so that the label displays the text entered in the text field.
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q8

Question 9 MSQ · 5.0 marks

Consider the Java code given below.
Source diagram or notation
Which of the following options is/are possible result/s of the above code?
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q9

Question 10 MSQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Which of the following is/are possible output(s) of the above code?
A.
100
B.
70
C.
50
D.
20

A published solution is not available for this question yet.

Report a correction for Q10

Question 11 MCQ · 4.0 marks

Assume that the file fruits.txt contains the following lines:
Source diagram or notation
Consider the code given below.
Source diagram or notation
Choose the correct option.
A.
LINE 1 generates IOException.
B.
This program generates the output:
Source diagram or notation
C.
This program generates the output:
Source diagram or notation
D.
This program generates the output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q11

Question 12 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will the output be?
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q12

Question 13 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will the output be?
A.
null, null, 0.0
B.
A12345, null, 5000.0
C.
A12345, XYZ, 5000.0
D.
A12345, Rina, 0.0
E.
******, XYZ, 0.0

A published solution is not available for this question yet.

Report a correction for Q13

Question 14 MCQ · 4.0 marks

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.
Source diagram or notation
Choose the correct option.
A.
This program generates the output:
Source diagram or notation
B.
This program terminates due to NullPointerException after printing:
Source diagram or notation
C.
This program generates the output:
Source diagram or notation
D.
This program generates the output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q14

Question 15 MCQ · 4.0 marks

Consider the following Java code.
Source diagram or notation
Source diagram or notation
What will the output be?
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q15

Question 16 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Source diagram or notation
Source diagram or notation
Identify the appropriate statement to fill in the blank at LINE 1, such that the output is:
Source diagram or notation
A.
((Displayable)iter.get_next()).display();
B.
((Book)iter.get_next()).display();
C.
((Library)iter.get_next()).display();
D.
iter.get_next().display();

A published solution is not available for this question yet.

Report a correction for Q16

Question 17 MCQ · 4.0 marks

Method merge of interface Map has the following structure and functionality:
Source diagram or notation
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.
Source diagram or notation
Choose the correct option regarding the code.
A.
It generates the output: {Apple=10, Banana=8, Orange=8}
B.
It generates the output: {Apple=10, Banana=-2, Orange=8}
C.
It generates the output: {Banana=-2, Apple=10, Orange=8}
D.
It generates NullPointerException during runtime.

A published solution is not available for this question yet.

Report a correction for Q17

Question 18 MSQ · 6.0 marks

Consider the code given below.
Source diagram or notation
Source diagram or notation
Identify the appropriate function header for function sum, such that the output is 78.0, 33.5.
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q18

Question 19 MCQ · 4.0 marks

Consider the following Java code.
Source diagram or notation
Choose the correct option when the class is executed as: java -ea ShoppingTest
A.
This code generates output: 2600.0
B.
This code generates AssertionError: Item price must be positive
C.
This code generates AssertionError: Adding item exceeds cart limit
D.
This code generates AssertionError: Maximum limit must be positive

A published solution is not available for this question yet.

Report a correction for Q19

Question 20 MCQ · 4.0 marks

Consider the following Java code that uses chained exceptions.
Source diagram or notation
Source diagram or notation
Which of following can be the output of this code?
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q20

Question 21 MCQ · 4.0 marks

Consider the code given below.
Source diagram or notation
Choose the correct option.
A.
Compilation error at LINE 1 because method printQuality() is not overridden in class EpsonPrinter
B.
Compilation error at LINE 2 because method startPrint() is not overridden in class CanonPrinter
C.
This program generates the output:
Source diagram or notation
D.
This program generates the output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q21

Question 22 MCQ · 4.0 marks

Consider the code given below.
Source diagram or notation
Choose the correct option to fill in place of CODE BLOCK so that the output is:
Source diagram or notation
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q22

Question 23 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct option.
A.
It generates the output as:
Source diagram or notation
B.
Compilation fails because Car and Bike do not override fuel()
C.
Compilation fails because Car and Bike cannot be assigned to Vehicle
D.
It generates the output as:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q23

Question 24 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will the output be?
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q24