MauryaHub PYQ Practice

cs2005_2026T2_Q1_NA.pdf

Programming Concepts using Java · Quiz 1 · May 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 MSQ · 4.0 marks

Which of the following statement(s) is/are true regarding activation records used during function calls?
  1. An activation record is removed from the stack immediately after a local variable is declared.
  2. Local variables of a function are typically stored inside its activation record.
  3. A return address is stored in the activation record so that control can return to the caller after the execution of the called function.
  4. All activation records in the stack correspond only to recursive function calls.
  5. When a function calls another function, the control link in the callee's activation record points to the activation record of the caller.

A published solution is not available for this question yet.

Question 3 MCQ · 3.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_3_2]] Choose the correct option to fill in the [[IMAGE:b94a2016b77e6576_3_3]] so that the output is: [[IMAGE:b94a2016b77e6576_3_4]]
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:b94a2016b77e6576_3_5]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_3_6]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_3_7]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_4_8]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 4 MCQ · 3.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_4_9]] Which of the following statements is **FALSE**?
Source diagram or notation
  1. [[IMAGE:b94a2016b77e6576_4_10]] generates compilation error because the method [[IMAGE:b94a2016b77e6576_5_11]] cannot be overridden.
    Source diagram or notationSource diagram or notation
  2. [[IMAGE:b94a2016b77e6576_5_12]] generates compilation error because variable [[IMAGE:b94a2016b77e6576_5_13]] cannot be accessed in class [[IMAGE:b94a2016b77e6576_5_14]] .
    Source diagram or notationSource diagram or notationSource diagram or notation
  3. [[IMAGE:b94a2016b77e6576_5_15]] generates compilation error because a variable of type [[IMAGE:b94a2016b77e6576_5_16]] cannot refer to an object of type [[IMAGE:b94a2016b77e6576_5_17]] .
    Source diagram or notationSource diagram or notationSource diagram or notation
  4. [[IMAGE:b94a2016b77e6576_5_18]] generates compilation error because a variable of type [[IMAGE:b94a2016b77e6576_5_19]] cannot refer to an object of type [[IMAGE:b94a2016b77e6576_5_20]] .
    Source diagram or notationSource diagram or notationSource diagram or notation

A published solution is not available for this question yet.

Question 5 MCQ · 3.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_5_21]] Choose the correct option.
Source diagram or notation
  1. [[IMAGE:b94a2016b77e6576_6_22]] generates compilation error because the class [[IMAGE:b94a2016b77e6576_6_23]] is not declared as abstract.
    Source diagram or notationSource diagram or notation
  2. [[IMAGE:b94a2016b77e6576_6_24]] generates compilation error because [[IMAGE:b94a2016b77e6576_6_25]] of type [[IMAGE:b94a2016b77e6576_6_26]] cannot invoke method [[IMAGE:b94a2016b77e6576_6_27]] .
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  3. This code generates the output: [[IMAGE:b94a2016b77e6576_6_28]]
    Source diagram or notation
  4. This code generates the output: [[IMAGE:b94a2016b77e6576_6_29]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 6 MCQ · 3.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_6_30]] Choose the correct option regarding the output produced by the code.
Source diagram or notation
  1. [[IMAGE:b94a2016b77e6576_7_31]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_7_32]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_7_33]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_7_34]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 7 MCQ · 3.0 marks

What is the output of the following code? [[IMAGE:b94a2016b77e6576_8_35]]
Source diagram or notation
  1. 12
  2. 18
  3. 9
  4. 15

A published solution is not available for this question yet.

Question 8 MCQ · 3.0 marks

Consider the Java program below. [[IMAGE:b94a2016b77e6576_8_36]] Choose the correct option regarding the output of the code.
Source diagram or notation
  1. This code generates output: [[IMAGE:b94a2016b77e6576_9_37]]
    Source diagram or notation
  2. This code generates output: [[IMAGE:b94a2016b77e6576_9_38]]
    Source diagram or notation
  3. This code generates output: [[IMAGE:b94a2016b77e6576_9_39]]
    Source diagram or notation
  4. This code generates a compile time error.

A published solution is not available for this question yet.

Question 9 MCQ · 3.0 marks

Consider the following Java code. [[IMAGE:b94a2016b77e6576_10_40]] Identify the correct option for the code given above.
Source diagram or notation
  1. This code generates output: [[IMAGE:b94a2016b77e6576_10_41]]
    Source diagram or notation
  2. This code generates output: [[IMAGE:b94a2016b77e6576_10_42]]
    Source diagram or notation
  3. This code generates a compile time error, since the implementations of [[IMAGE:b94a2016b77e6576_11_43]] from [[IMAGE:b94a2016b77e6576_11_44]] and [[IMAGE:b94a2016b77e6576_11_45]] are in conflict with each other.
    Source diagram or notationSource diagram or notationSource diagram or notation
  4. This code generates a compile time error since [[IMAGE:b94a2016b77e6576_11_46]] is not implemented in class [[IMAGE:b94a2016b77e6576_11_47]]
    Source diagram or notationSource diagram or notation

A published solution is not available for this question yet.

Question 10 MCQ · 3.0 marks

Consider the following Java code. [[IMAGE:b94a2016b77e6576_11_48]] What will the output be?
Source diagram or notation
  1. [[IMAGE:b94a2016b77e6576_12_49]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_12_50]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_12_51]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_12_52]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 11 MCQ · 3.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_13_53]] Choose the correct option.
Source diagram or notation
  1. This program generates compiler error at [[IMAGE:b94a2016b77e6576_13_54]] Reason: An object of [[IMAGE:b94a2016b77e6576_13_55]] cannot be created inside method [[IMAGE:b94a2016b77e6576_13_56]] because it uses an object of [[IMAGE:b94a2016b77e6576_13_57]] in its constructor.
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  2. This program generates the output: [[IMAGE:b94a2016b77e6576_13_58]] followed by runtime error Reason: A method inside class [[IMAGE:b94a2016b77e6576_13_59]] is invoking method [[IMAGE:b94a2016b77e6576_13_60]] inside class [[IMAGE:b94a2016b77e6576_13_61]] , whereas [[IMAGE:b94a2016b77e6576_13_62]] is invoking another method in class [[IMAGE:b94a2016b77e6576_13_63]] .
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  3. This program generates compiler error at [[IMAGE:b94a2016b77e6576_14_64]] Reason: A method inside class [[IMAGE:b94a2016b77e6576_14_65]] is invoking method [[IMAGE:b94a2016b77e6576_14_66]] inside class [[IMAGE:b94a2016b77e6576_14_67]] , whereas [[IMAGE:b94a2016b77e6576_14_68]] is invoking another method in class [[IMAGE:b94a2016b77e6576_14_69]] .
    Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  4. This program generates the output: [[IMAGE:b94a2016b77e6576_14_70]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 12 MCQ · 4.0 marks

Consider the code given below. [[IMAGE:b94a2016b77e6576_14_71]] Choose the correct option.
Source diagram or notation
  1. [[IMAGE:b94a2016b77e6576_15_72]] generates compilation error because a variable of type [[IMAGE:b94a2016b77e6576_15_73]] cannot refer to an object of type [[IMAGE:b94a2016b77e6576_15_74]] .
    Source diagram or notationSource diagram or notationSource diagram or notation
  2. This code generates the below output followed by runtime error at [[IMAGE:b94a2016b77e6576_15_75]] because there is ambiguity in which [[IMAGE:b94a2016b77e6576_15_76]] method is being invoked. [[IMAGE:b94a2016b77e6576_15_77]]
    Source diagram or notationSource diagram or notationSource diagram or notation
  3. This code generates the output: [[IMAGE:b94a2016b77e6576_15_78]]
    Source diagram or notation
  4. This code generates the output: [[IMAGE:b94a2016b77e6576_15_79]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 13 MCQ · 4.0 marks

Consider the code given below that checks whether two software modules are the same. Method [[IMAGE:b94a2016b77e6576_15_80]] is overridden to compare two [[IMAGE:b94a2016b77e6576_15_81]] objects as follows. If two modules have the same [[IMAGE:b94a2016b77e6576_15_82]] and [[IMAGE:b94a2016b77e6576_15_83]] , then they are considered the same. [[IMAGE:b94a2016b77e6576_16_84]] Choose the correct option to fill in place of [[IMAGE:b94a2016b77e6576_16_85]] so that the output is: [[IMAGE:b94a2016b77e6576_16_86]]
Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:b94a2016b77e6576_16_87]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_16_88]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_17_89]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_17_90]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 14 MCQ · 4.0 marks

Consider the code given below. [[IMAGE:b94a2016b77e6576_18_91]] [[IMAGE:b94a2016b77e6576_18_92]] Identify the appropriate statement to fill in the blank at [[IMAGE:b94a2016b77e6576_18_93]] , such that the output is: [[IMAGE:b94a2016b77e6576_19_94]]
Source diagram or notationSource diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:b94a2016b77e6576_19_95]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_19_96]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_19_97]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_19_98]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 15 MCQ · 4.0 marks

Consider the Java code given below. [[IMAGE:b94a2016b77e6576_20_99]] Identify the appropriate option to fill in the blank at line:1 such that output of the code will be: [[IMAGE:b94a2016b77e6576_20_100]]
Source diagram or notationSource diagram or notation
  1. [[IMAGE:b94a2016b77e6576_20_101]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_20_102]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_21_103]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_21_104]]
    Source diagram or notation

A published solution is not available for this question yet.

Question 16 MSQ · 3.0 marks

Consider the Java program below. [[IMAGE:b94a2016b77e6576_21_105]] Identify the correct option(s) to fill in the blank at [[IMAGE:b94a2016b77e6576_21_106]] , such that the output is: [[IMAGE:b94a2016b77e6576_22_107]]
Source diagram or notationSource diagram or notationSource diagram or notation
  1. [[IMAGE:b94a2016b77e6576_22_108]]
    Source diagram or notation
  2. [[IMAGE:b94a2016b77e6576_22_109]]
    Source diagram or notation
  3. [[IMAGE:b94a2016b77e6576_22_110]]
    Source diagram or notation
  4. [[IMAGE:b94a2016b77e6576_22_111]]
    Source diagram or notation

A published solution is not available for this question yet.