MauryaHub PYQ Practice

cs2005_2026T1_Q1_NA.pdf

Programming Concepts using Java · Quiz 1 · Jan 2026

← 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.

Question 2 MCQ · 6.0 marks

Consider the following Java program. [[IMAGE:18fa07d0680eb2d0_3_2]] What is the maximum number of activation records on the stack during the execution of the program?
Source diagram or notation
  1. 2
  2. 3
  3. 4
  4. 5

A published solution is not available for this question yet.

Question 3 MCQ · 6.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_4_3]] Choose the correct option regarding the given code.
Source diagram or notation
  1. This code generates output: [[IMAGE:18fa07d0680eb2d0_4_4]]
    Source diagram or notation
  2. This code generates output: [[IMAGE:18fa07d0680eb2d0_4_5]]
    Source diagram or notation
  3. This code generates output: [[IMAGE:18fa07d0680eb2d0_4_6]]
    Source diagram or notation
  4. This code generates a compilation error because the method [[IMAGE:18fa07d0680eb2d0_4_7]] cannot be overridden
    Source diagram or notation

A published solution is not available for this question yet.

Question 4 MCQ · 6.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_5_8]] Choose the correct option.
Source diagram or notation
  1. The program generates output: [[IMAGE:18fa07d0680eb2d0_5_9]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_5_10]] generates compilation error because a variable of type [[IMAGE:18fa07d0680eb2d0_5_11]] cannot refer to an object of type [[IMAGE:18fa07d0680eb2d0_5_12]] .
    Source diagram or notationSource diagram or notationSource diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_5_13]] generates run time error because there is ambiguity in which [[IMAGE:18fa07d0680eb2d0_5_14]] method is being invoked.
    Source diagram or notationSource diagram or notation
  4. The program generates output: [[IMAGE:18fa07d0680eb2d0_5_15]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 5 MCQ · 6.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_6_16]] Choose the correct option to fill in place of [[IMAGE:18fa07d0680eb2d0_6_17]] and [[IMAGE:18fa07d0680eb2d0_6_18]] so that the output is: [[IMAGE:18fa07d0680eb2d0_6_19]]
Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_6_20]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_6_21]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_6_22]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_7_23]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 6 MCQ · 6.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_7_24]] What will the output be?
Source diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_8_25]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_8_26]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_8_27]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_8_28]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 7 MCQ · 6.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_9_29]] Identify the appropriate statements to fill in place of [[IMAGE:18fa07d0680eb2d0_9_30]] in order to correctly invoke method [[IMAGE:18fa07d0680eb2d0_9_31]] inside the while loop.
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_9_32]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_9_33]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_9_34]]
    Source diagram or notation
  4. Method [[IMAGE:18fa07d0680eb2d0_9_35]] cannot be invoked from an outside class.
    Source diagram or notation

A published solution is not available for this question yet.

Question 8 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_10_36]] Choose the correct option.
Source diagram or notation
  1. This program generates compiler error at [[IMAGE:18fa07d0680eb2d0_10_37]] Reason: An interface reference cannot be passed as a constructor argument.
    Source diagram or notation
  2. This program generates the output: [[IMAGE:18fa07d0680eb2d0_11_38]]
    Source diagram or notation
  3. This program generates the output: [[IMAGE:18fa07d0680eb2d0_11_39]] followed by runtime error Reason: A method inside [[IMAGE:18fa07d0680eb2d0_11_40]] is invoking [[IMAGE:18fa07d0680eb2d0_11_41]] inside [[IMAGE:18fa07d0680eb2d0_11_42]] , whereas [[IMAGE:18fa07d0680eb2d0_11_43]] is invoking another method in [[IMAGE:18fa07d0680eb2d0_11_44]] .
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  4. This program generates compiler error at [[IMAGE:18fa07d0680eb2d0_11_45]] Reason: A method inside [[IMAGE:18fa07d0680eb2d0_11_46]] is invoking a method defined in an interface.
    Source diagram or notationSource diagram or notation

A published solution is not available for this question yet.

Question 9 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_11_47]] Choose the correct option.
Source diagram or notation
  1. Compilation error at [[IMAGE:18fa07d0680eb2d0_12_48]] because private variable [[IMAGE:18fa07d0680eb2d0_12_49]] cannot be accessed without using an accessor method.
    Source diagram or notationSource diagram or notation
  2. The program generates the output: [[IMAGE:18fa07d0680eb2d0_12_50]]
    Source diagram or notation
  3. The program generates the output: [[IMAGE:18fa07d0680eb2d0_12_51]]
    Source diagram or notation
  4. The program generates the output: [[IMAGE:18fa07d0680eb2d0_12_52]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 10 MCQ · 7.0 marks

Consider the following Java code. [[IMAGE:18fa07d0680eb2d0_13_53]] Identify the lines which have errors.
Source diagram or notation
  1. Line 7 and Line 11
  2. Line 4 and Line 5
  3. Line 15 and Line 20
  4. Line 1 and Line 2

A published solution is not available for this question yet.

Question 11 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_14_54]] Identify the correct option to fill in place of [[IMAGE:18fa07d0680eb2d0_14_55]] , such that the output is: [[IMAGE:18fa07d0680eb2d0_14_56]]
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_14_57]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_14_58]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_14_59]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_15_60]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 12 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_15_61]] Choose the correct option.
Source diagram or notation
  1. This code generates the output: [[IMAGE:18fa07d0680eb2d0_15_62]]
    Source diagram or notation
  2. This code generates the output: [[IMAGE:18fa07d0680eb2d0_15_63]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_16_64]] generates compilation error because a variable of type [[IMAGE:18fa07d0680eb2d0_16_65]] cannot refer to an object of type [[IMAGE:18fa07d0680eb2d0_16_66]] .
    Source diagram or notationSource diagram or notationSource diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_16_67]] generates runtime error because there is ambiguity in which [[IMAGE:18fa07d0680eb2d0_16_68]] method is being invoked.
    Source diagram or notationSource diagram or notation

A published solution is not available for this question yet.

Question 13 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_16_69]] What will the output be?
Source diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_16_70]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_17_71]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_17_72]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_17_73]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 14 MCQ · 7.0 marks

Consider the code given below. [[IMAGE:18fa07d0680eb2d0_17_74]] Choose the correct option to fill in place of [[IMAGE:18fa07d0680eb2d0_17_75]] so that the output is: [[IMAGE:18fa07d0680eb2d0_17_76]]
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_18_77]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_18_78]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_18_79]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_18_80]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 15 MCQ · 7.0 marks

Consider the Java code given below. [[IMAGE:18fa07d0680eb2d0_18_81]] Choose the correct option regarding the above code.
Source diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_18_82]] generates compilation error because the method [[IMAGE:18fa07d0680eb2d0_18_83]] is not abstract.
    Source diagram or notationSource diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_18_84]] generates compilation error because class [[IMAGE:18fa07d0680eb2d0_18_85]] cannot implement two interfaces.
    Source diagram or notationSource diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_19_86]] generates compilation error because class [[IMAGE:18fa07d0680eb2d0_19_87]] is not declared as abstract.
    Source diagram or notationSource diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_19_88]] , [[IMAGE:18fa07d0680eb2d0_19_89]] and [[IMAGE:18fa07d0680eb2d0_19_90]] generate compilation errors because the methods [[IMAGE:18fa07d0680eb2d0_19_91]] , [[IMAGE:18fa07d0680eb2d0_19_92]] and [[IMAGE:18fa07d0680eb2d0_19_93]] are not abstract.
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation

A published solution is not available for this question yet.

Question 16 MSQ · 8.0 marks

Consider the Java program below. [[IMAGE:18fa07d0680eb2d0_19_94]] Identify the correct option(s) to fill in the blank at [[IMAGE:18fa07d0680eb2d0_19_95]] , such that the output is: [[IMAGE:18fa07d0680eb2d0_19_96]]
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:18fa07d0680eb2d0_19_97]]
    Source diagram or notation
  2. [[IMAGE:18fa07d0680eb2d0_20_98]]
    Source diagram or notation
  3. [[IMAGE:18fa07d0680eb2d0_20_99]]
    Source diagram or notation
  4. [[IMAGE:18fa07d0680eb2d0_20_100]]
    Source diagram or notation

A published solution is not available for this question yet.