PRASHNIKAप्रश्निका
‹ Back to the paper

The following is a function of some class. What will be the output of the function test ( ) when…

Computer Science20205 marksShort answer
The following is a function of some class. What will be the output of the function test ( ) when the value of count is equal to 4 ? Show the dry run / working.
void test (int count)
{
    if (count == 0)
        System.out.println(" ");
    else
    {
        System.out.println("Bye" + count);
        test(--count);
        System.out.println(" " + count);
    }
}

Answer

No answer yet.

Recursion

From ISC 2020 Specimen Computer Science Paper 1, question 3.