Given the following function definition int mystery1(int x, int y) { if(x<=y)…

PYQ TCS NQT 2026

Given the following function definition

int mystery1(int x, int y) {
if(x<=y) return x;
else
return mystery1(x-y, y);
}

What would be the return value of this function call mystery1(15,5)?

  1. A.

    5

  2. B.

    10

  3. C.

    0

  4. D.

    15

Attempted by 595 students.

Sign up free to check your answer

Sign up free

Explore the full course: Cdac C Cat Complete Preparation

Loading lesson…