GATE CS 2021 (Afternoon) — Question 33

Programming in CFunctions, Parameter Passing, Scope Rules, RecursionNAT1 markMedium

Consider the following ANSI C function:
c
1int SomeFunction(int x, int y)
2{
3    if ((x == 1) || (y == 1)) return 1;
4    if (x == y) return x;
5    if (x > y) return SomeFunction(x - y, y);
6    if (y > x) return SomeFunction(x, y - x);
7}
8
The value returned by SomeFunction(15, 255) is _________.
Practise the full 2021-AN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAWhat rank do your marks get?GATE score, likely All-India Rank and qualifying marks for your category.
Practise more on Functions, Parameter Passing, Scope Rules, RecursionTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group