Skip to content
1 mark2025

The following is a function of class Armstrong. This recursive function calculates
and returns the sum of the cubes of all the digits of num, where num is an integer
data member of the class Armstrong.
[A number is said to be Armstrong if the sum of the cubes of all its digits is equal
to the original number].
There are some places in the code marked by ?1?, ?2?,?3? which may be replaced
by a statement/expression so, that the function works properly.
public int sumOfPowers(int num)
{
if (num == 0)
return ?1?;
int digit = ?2?;
return (int) Math.pow(digit, 3) + ?3?;
}
(a) What is the expression or statement at ?1?
(b) What is the expression or statement at ?2?
(c) What is the expression or statement at ?3?
----------------------------------------------------------------------------------------------------------------------------------
PART II– 50 MARKS
Answer six questions in this part, choosing two questions from
SECTION - A
Answer any two questions.

Specimen paper · 2025 · CollegeDekho (mirror of CISCE PDF)

No answer recorded yet

Khojo Papers does not generate answers. This question will show one when a checked answer has been added, with its source stated.

Related questions

From the same topic and chapter, at a similar level.

Related questions