in Programming in Python edited by
867 views
0 votes
0 votes

​​​​​Consider the following Python function:

def $\operatorname{fun}(D, s 1, s 2)$ :
if $\mathrm{s} 1<\mathrm{s} 2$ :
$\mathrm{D}[\mathrm{s} 1], \mathrm{D}[\mathrm{s} 2]=\mathrm{D}[\mathrm{s} 2], \mathrm{D}[\mathrm{s} 1]$
fun (D, s1+1, s2-1)

What does this Python function fun ( ) do? Select the ONE appropriate option below.

  1. It finds the smallest element in $\text{D}$ from index $s 1$ to $s 2$, both inclusive.
  2. It performs a merge sort in-place on this list $\mathrm{D}$ between indices $\mathrm{s} 1$ and $\mathrm{s} 2$, both inclusive.
  3. It reverses the list $\mathrm{D}$ between indices $\mathrm{s} 1$ and $\mathrm{s} 2$, both inclusive.
  4. It swaps the elements in $\mathrm{D}$ at indices $\mathrm{s} 1$ and $\mathrm{s} 2$, and leaves the remaining elements unchanged.

in Programming in Python edited by
by
867 views

2 Answers

3 votes
3 votes

It seems no option is correct.

When $s_1 > s_2:$

Output: [5, 7, 2, 1, 1, 9, -4, -2, 0]

-------------------------------------------------------------------------------

When we assume $s_1<s_2$ then C would be correct.

https://gateoverflow.in/423666/gate-da-2024-answer-key-challenge

edited by

2 Comments

@ankitgupta.1729

Challenge not expected bro 

0
0
This does not surprised me at all.

The sad thing is they don't accept their mistakes. Even having the qualified people, Even getting almost one year to set the paper, even getting good amount of money 1800* ~1 lacs plus the challenging amount, they call a sequence as a series, a term perfect matching is defined for a graph, a question on filling the sequence, wrongly defined recurrence, copied questions with little modification and many more.

This is not only for the CSE branch, you can check for the other branches too. For example just see how many MTAs are given in ECE branch this year.

It is fine if they don't review the paper multiple times but at least accept the challenges for a logically correct answer or give the reason for the rejection. There may be people who will defend these IIT and IISc professors and may be "asking question" is wrong according to them and at the end students have to suffer.
1
1
0 votes
0 votes
C

Related questions