ISC · Computer Science
Question 2
1 markCISCE ISC 2025 specimen paper · Computer Science · Q2
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.

