GATE DA 2026 · Question 58 · Programming, Data Structures and Algorithms · Numerical answer (NAT) · 2 marks · no negative marks

Consider the given Python program.
def fun(L, i=0): if i >= len(L)-1: return 0 if L[i] > L[i+1]: L[i+1], L[i] = L[i], L[i+1] return 1+fun(L, i+1) else: return fun(L, i+1) data = [5, 3, 4, 1, 2] count = 0 for _ in range(len(data)): count += fun(data) print(count)
The output of the program is ______ . (Answer in integer )

Answer

Answer 8

Answer from the official GATE DA 2026 answer key.

The step-by-step solution, where available, is part of GATE DA Pro. See what Pro includes