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?
An activation record is removed from the stack immediately after a local
variable is declared.
Local variables of a function are typically stored inside its activation record.
A return address is stored in the activation record so that control can return to
the caller after the execution of the called function.
All activation records in the stack correspond only to recursive function calls.
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]]



[[IMAGE:b94a2016b77e6576_3_5]]

[[IMAGE:b94a2016b77e6576_3_6]]

[[IMAGE:b94a2016b77e6576_3_7]]

[[IMAGE:b94a2016b77e6576_4_8]]

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**?

[[IMAGE:b94a2016b77e6576_4_10]] generates compilation error because the method
[[IMAGE:b94a2016b77e6576_5_11]] cannot be overridden.


[[IMAGE:b94a2016b77e6576_5_12]] generates compilation error because variable [[IMAGE:b94a2016b77e6576_5_13]]
cannot be accessed in class [[IMAGE:b94a2016b77e6576_5_14]] .



[[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]] .



[[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]] .



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.

[[IMAGE:b94a2016b77e6576_6_22]] generates compilation error because the class [[IMAGE:b94a2016b77e6576_6_23]] is not
declared as abstract.


[[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]] .




This code generates the output:
[[IMAGE:b94a2016b77e6576_6_28]]

This code generates the output:
[[IMAGE:b94a2016b77e6576_6_29]]

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.

[[IMAGE:b94a2016b77e6576_7_31]]

[[IMAGE:b94a2016b77e6576_7_32]]

[[IMAGE:b94a2016b77e6576_7_33]]

[[IMAGE:b94a2016b77e6576_7_34]]

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]]

12
18
9
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.

This code generates output: [[IMAGE:b94a2016b77e6576_9_37]]

This code generates output: [[IMAGE:b94a2016b77e6576_9_38]]

This code generates output:
[[IMAGE:b94a2016b77e6576_9_39]]

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.

This code generates output:
[[IMAGE:b94a2016b77e6576_10_41]]

This code generates output:
[[IMAGE:b94a2016b77e6576_10_42]]

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.



This code generates a compile time error since [[IMAGE:b94a2016b77e6576_11_46]] is not implemented in
class [[IMAGE:b94a2016b77e6576_11_47]]


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?

[[IMAGE:b94a2016b77e6576_12_49]]

[[IMAGE:b94a2016b77e6576_12_50]]

[[IMAGE:b94a2016b77e6576_12_51]]

[[IMAGE:b94a2016b77e6576_12_52]]

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.

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.




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






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






This program generates the output:
[[IMAGE:b94a2016b77e6576_14_70]]

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.

[[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]] .



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]]



This code generates the output:
[[IMAGE:b94a2016b77e6576_15_78]]

This code generates the output:
[[IMAGE:b94a2016b77e6576_15_79]]

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]]







[[IMAGE:b94a2016b77e6576_16_87]]

[[IMAGE:b94a2016b77e6576_16_88]]

[[IMAGE:b94a2016b77e6576_17_89]]

[[IMAGE:b94a2016b77e6576_17_90]]

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]]




[[IMAGE:b94a2016b77e6576_19_95]]

[[IMAGE:b94a2016b77e6576_19_96]]

[[IMAGE:b94a2016b77e6576_19_97]]

[[IMAGE:b94a2016b77e6576_19_98]]

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]]


[[IMAGE:b94a2016b77e6576_20_101]]

[[IMAGE:b94a2016b77e6576_20_102]]

[[IMAGE:b94a2016b77e6576_21_103]]

[[IMAGE:b94a2016b77e6576_21_104]]

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]]



[[IMAGE:b94a2016b77e6576_22_108]]

[[IMAGE:b94a2016b77e6576_22_109]]

[[IMAGE:b94a2016b77e6576_22_110]]

[[IMAGE:b94a2016b77e6576_22_111]]

A published solution is not available for this question yet.