GATE DA 2025 — Question 63

Programming, Data Structures and AlgorithmsProgramming in PythonNAT2 marksMedium

Consider the following Python code snippet.
python
1def f(a,b):
2    if (a==0):
3        return b
4    if (a%2==1):
5        return 2*f((a-1)/2,b)
6    return b+f(a-1,b)
7print(f(15,10))
8
The value printed by the code snippet is ____________(Answer in integer)
Practise the full 2025 paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on Programming in PythonTimed, 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