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?

2
3
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.

This code generates output:
[[IMAGE:18fa07d0680eb2d0_4_4]]

This code generates output:
[[IMAGE:18fa07d0680eb2d0_4_5]]

This code generates output:
[[IMAGE:18fa07d0680eb2d0_4_6]]

This code generates a compilation error because the method [[IMAGE:18fa07d0680eb2d0_4_7]]
cannot be overridden

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.

The program generates output:
[[IMAGE:18fa07d0680eb2d0_5_9]]

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



[[IMAGE:18fa07d0680eb2d0_5_13]] generates run time error because there is ambiguity in which
[[IMAGE:18fa07d0680eb2d0_5_14]] method is being invoked.


The program generates output:
[[IMAGE:18fa07d0680eb2d0_5_15]]

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




[[IMAGE:18fa07d0680eb2d0_6_20]]

[[IMAGE:18fa07d0680eb2d0_6_21]]

[[IMAGE:18fa07d0680eb2d0_6_22]]

[[IMAGE:18fa07d0680eb2d0_7_23]]

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?

[[IMAGE:18fa07d0680eb2d0_8_25]]

[[IMAGE:18fa07d0680eb2d0_8_26]]

[[IMAGE:18fa07d0680eb2d0_8_27]]

[[IMAGE:18fa07d0680eb2d0_8_28]]

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.



[[IMAGE:18fa07d0680eb2d0_9_32]]

[[IMAGE:18fa07d0680eb2d0_9_33]]

[[IMAGE:18fa07d0680eb2d0_9_34]]

Method [[IMAGE:18fa07d0680eb2d0_9_35]] cannot be invoked from an outside class.

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.

This program generates compiler error at [[IMAGE:18fa07d0680eb2d0_10_37]]
Reason: An interface reference cannot be passed as a constructor argument.

This program generates the output:
[[IMAGE:18fa07d0680eb2d0_11_38]]

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






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.


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.

Compilation error at [[IMAGE:18fa07d0680eb2d0_12_48]] because private variable [[IMAGE:18fa07d0680eb2d0_12_49]]
cannot be accessed without using an accessor method.


The program generates the output:
[[IMAGE:18fa07d0680eb2d0_12_50]]

The program generates the output:
[[IMAGE:18fa07d0680eb2d0_12_51]]

The program generates the output:
[[IMAGE:18fa07d0680eb2d0_12_52]]

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.

Line 7 and Line 11
Line 4 and Line 5
Line 15 and Line 20
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]]



[[IMAGE:18fa07d0680eb2d0_14_57]]

[[IMAGE:18fa07d0680eb2d0_14_58]]

[[IMAGE:18fa07d0680eb2d0_14_59]]

[[IMAGE:18fa07d0680eb2d0_15_60]]

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.

This code generates the output:
[[IMAGE:18fa07d0680eb2d0_15_62]]

This code generates the output:
[[IMAGE:18fa07d0680eb2d0_15_63]]

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



[[IMAGE:18fa07d0680eb2d0_16_67]] generates runtime error because there is ambiguity in which
[[IMAGE:18fa07d0680eb2d0_16_68]] method is being invoked.


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?

[[IMAGE:18fa07d0680eb2d0_16_70]]

[[IMAGE:18fa07d0680eb2d0_17_71]]

[[IMAGE:18fa07d0680eb2d0_17_72]]

[[IMAGE:18fa07d0680eb2d0_17_73]]

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



[[IMAGE:18fa07d0680eb2d0_18_77]]

[[IMAGE:18fa07d0680eb2d0_18_78]]

[[IMAGE:18fa07d0680eb2d0_18_79]]

[[IMAGE:18fa07d0680eb2d0_18_80]]

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.

[[IMAGE:18fa07d0680eb2d0_18_82]] generates compilation error because the method
[[IMAGE:18fa07d0680eb2d0_18_83]] is not abstract.


[[IMAGE:18fa07d0680eb2d0_18_84]] generates compilation error because class [[IMAGE:18fa07d0680eb2d0_18_85]]
cannot implement two interfaces.


[[IMAGE:18fa07d0680eb2d0_19_86]] generates compilation error because class [[IMAGE:18fa07d0680eb2d0_19_87]] is
not declared as abstract.


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






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



[[IMAGE:18fa07d0680eb2d0_19_97]]

[[IMAGE:18fa07d0680eb2d0_20_98]]

[[IMAGE:18fa07d0680eb2d0_20_99]]

[[IMAGE:18fa07d0680eb2d0_20_100]]

A published solution is not available for this question yet.