Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 31(c)

1 mark

Computer ScienceISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1MCQImplementation of algorithms to solve problems

Choose the correct option.

What is the statement or expression at ?3?

  • (i)s
  • (ii)rev
  • (iii)f
  • (iv)digit * 10
Show the code
boolean Palindrome(int N)
{
    int rev = ?1?;
    int num = N;
    while (num > 0)
    {
        int f = num / 10;
        int s = ?2?;
        int digit = num - ?3?;
        rev = ?4? + digit;
        num /= ?5?;
    }
    if(rev == N)
        return true;
    else
        return false;
}

Answer

Answer

Correct option: (i)

Answer: (i) s With s = f*10, num - s is the last digit.