MauryaHub PYQ Practice

Programming Concepts using Java · End Term · May 2026 · AN

Programming Concepts using Java · End Term · May 2026 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 · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Immediately after the execution of Line 8, the activation record of which method is at the top of the stack of activation records?
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 Q2

Question 3 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 Q3

Question 4 MCQ · 4.0 marks

Consider the code given below.
Source diagram or notation
Choose the correct option regarding the code.
A.
Compiler error at
Source diagram or notation
because the method
Source diagram or notation
cannot be invoked on
Source diagram or notation
object
B.
Compiler error at
Source diagram or notation
because the method
Source diagram or notation
cannot be invoked on
Source diagram or notation
object
C.
The code generates the output:
Source diagram or notation
D.
Compiler error at
Source diagram or notation
because method
Source diagram or notation
is not defined in class
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q4

Question 5 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct option.
A.Source diagram or notation
and
Source diagram or notation
generates a compilation error because method
Source diagram or notation
is already defined with the same signature.
B.Source diagram or notation
and
Source diagram or notation
generates a compilation error because method
Source diagram or notation
is already defined with the same signature.
C.
Only
Source diagram or notation
generates a compilation error because method
Source diagram or notation
is already defined with the same signature.
D.
This program generates output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q5

Question 6 MCQ · 4.0 marks

Consider the code given below.
Source diagram or notation
Choose the correct option to fill in place of
Source diagram or notation
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 Q6

Question 7 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will the output be?
A.
This program generates the output:
Source diagram or notation
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 Q7

Question 8 MCQ · 4.0 marks

Consider the 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 Q8

Question 9 MCQ · 4.0 marks

Consider the following block of code.
Source diagram or notation
Assume that assertions are enabled during program execution. Which among the following code blocks can replace the given code in order to generate an
Source diagram or notation
with a customized assertion error as shown below?
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 Q9

Question 10 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 Q10

Question 11 MCQ · 4.0 marks

Consider the Java code given below.
Source diagram or notation
What will the output be for the above Java 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 Q11

Question 12 MCQ · 4.0 marks

Method
Source diagram or notation
returns an
Source diagram or notation
describing the specified value, if non-null, otherwise returns an empty
Source diagram or notation
. Based on this description, consider the code given below, and answer the question that follows.
Source diagram or notation
Choose the correct option.
A.
This program generates the output:
Source diagram or notation
B.
This program generates the output:
Source diagram or notation
C.
This program terminates abnormally due to
Source diagram or notation
without printing any value.
D.
This program terminates abnormally due to
Source diagram or notation
after printing the value:
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
Choose the correct option.
A.
This program generates the output:
Source diagram or notation
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 Q13

Question 14 MCQ · 4.0 marks

Consider the 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 Q14

Question 15 MCQ · 4.0 marks

Consider the code given below.Assume that the file
Source diagram or notation
contains the following lines of text in it.
Source diagram or notation
Source diagram or notation
Choose the correct option.
A.Source diagram or notation
generates
Source diagram or notation
.
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 Q15

Question 16 MCQ · 4.0 marks

Consider the following code which converts temperatures given in Centigrade scale to Fahrenheit scale and vice versa, using two threads. Once the conversion is finished, the program should check whether there is a temperature value in the array which is the same in both the scales. import java.util.*; class Centigrade extends Thread{ double[] f_temp = null; public Centigrade(double[] arr) { f_temp = arr; if public void run() { // converts the temperatures in f_temp to centigrade for(int i = 0; i < f_temp.length; i++) { f_temp[i] = ((£_temp[i] - 32)/9.0)*5; } , class Fahrenheit extends Thread{ double[] c_temp = null; public Fahrenheit (double[] arr) { c_temp = arr; + public void run() { // converts the temperatures in c_temp to fahrenheit for(int i = 0; i < c_temp.length; i++) { c_temp[i] = ((9.0/5.0)*c_temp[i]) + 32.0; } } public class Test{ public static void main(String args[]) { double temp_in_fahrenheit[] = {29.67, -40.0, 50.0, 32.0}; double temp_in_centigrade[] = {100.0, -92.54, 32.0, -40.0}; Centigrade cobj = new Centigrade(temp_in_fahrenheit) ; Fahrenheit fobj = new Fahrenheit (temp_in_centigrade) ;
Source diagram or notation
Source diagram or notation
is the only temperature which is same in both the scales. Choose the correct option which should be written in place of
Source diagram or notation
, so that this program produces the result as
Source diagram or notation
on every execution.
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 Q16

Question 17 MCQ · 5.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct option to fill in the blank at
Source diagram or notation
such that the program generates the following output.
Source diagram or notation
A.Source diagram or notation
B.Source diagram or notation
C.Source diagram or notation
D.
All of these.

A published solution is not available for this question yet.

Report a correction for Q17

Question 18 MCQ · 5.0 marks

Method
Source diagram or notation
of interface
Source diagram or notation
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 scores of players and answer the question that follows.
Source diagram or notation
Choose the correct option regarding the code.
A.
It generates the output:
Source diagram or notation
B.
It generates the output:
Source diagram or notation
C.
It generates the output:
Source diagram or notation
D.
It generates
Source diagram or notation
during runtime.

A published solution is not available for this question yet.

Report a correction for Q18

Question 19 MCQ · 5.0 marks

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

A published solution is not available for this question yet.

Report a correction for Q19

Question 20 MCQ · 5.0 marks

The Java code given below produces a toggle button. With the first click, the traffic signal should be switched to green, with the next click it should be switched to red, and on the next click it should be switched to green again, and so on. Based on the requirement, answer the question that follows the code.
Source diagram or notation
Choose the correct code segment inside method
Source diagram or notation
such that the given behaviour can be implemented correctly.
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 · 5.0 marks

Consider the following Java code and choose the correct option.
Source diagram or notation
A.
This program prints
Source diagram or notation
followed by
Source diagram or notation
with message
Source diagram or notation
.
B.
This program generates
Source diagram or notation
.
C.
This program generates output:
Source diagram or notation
D.
This program generates output:
Source diagram or notation

A published solution is not available for this question yet.

Report a correction for Q21

Question 22 MCQ · 5.0 marks

Consider the code given below.
Source diagram or notation
Identify the appropriate option to fill in the blank at
Source diagram or notation
, such that the threads
Source diagram or notation
and
Source diagram or notation
execute the
Source diagram or notation
function in parallel.
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 MSQ · 5.0 marks

Consider the Java code given below.
Source diagram or notation
Choose the correct option(s).
A.
The program will always generate the output:
Source diagram or notation
B.
The program will always generate the output:
Source diagram or notation
C.
The output can be
Source diagram or notation
or
Source diagram or notation
or
Source diagram or notation
or
Source diagram or notation
and can also cycle back and start again.
D.
The program may not generate any output.

A published solution is not available for this question yet.

Report a correction for Q23

Question 24 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 Q24