The following function isTech( ) is a part of some class which is used to check if a given number…
The following function isTech( ) is a part of some class which is used to check if a given number is a Tech number or not. 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.
A number is Tech number if the count of digits is even and the square of the sum of its two equal halves is equal to the number itself.
Example: $2025 = 20 + 25 = (45)^2 = 2025$
boolean isTech(int n)
{
String s = String.valueOf(n);
int len = ?1?;
if (len % 2 != 0)
return ?2?;
int first = Integer.parseInt(s.substring(0, len / 2));
int second = Integer.parseInt(s.substring(len / 2));
int sum = first + second;
return ?3? == n;
}What are the expressions or statements at ?1?, ?2? and ?3?Answer
Answer
AIWritten by AI (antigravity) - it can contain mistakes.
?1? = s.length()
?2? = false
?3? = sum * sum
From ISC 2026 Computer Science Paper 1, question 2(iv).