GATE 2024 Data Science and Artificial Intelligence (DA) Questions with Solutions

GATE 2024

64 questions

MCQ 36 · MSQ 12 · NAT 161-mark 29 · 2-mark 35

Questions 36–40 of 64

Q37Limits, Continuity and Differentiability2 marksMCQ−0.67 if wrong
Let f:R→Rf: \mathbb{R} \rightarrow \mathbb{R} be a function. Note: R\mathbb{R} denotes the set of real numbers.

f(x)={−x, if x<−2ax2+bx+c, if x∈[−2,2]x, if x>2f(x)=\left\{\begin{array}{cl} -x, & \text { if } x<-2 \\ a x^{2}+b x+c, & \text { if } x \in[-2,2] \\ x, & \text { if } x>2 \end{array}\right.

Which ONE of the following choices gives the values of a,b,ca, b, c that make the function ff continuous and differentiable?

Q38Programming in Python2 marksMCQ−0.67 if wrong
Consider the following Python code:

def count(child_dict, i): 
    if i not in child_dict.keys(): 
         return 1 
    ans = 1 
    for j in child_dict[i]: 
        ans += count(child_dict, j) 
    return ans 
 
child_dict = dict() 
child_dict[0] = [1,2] 
child_dict[1] = [3,4,5] 
child_dict[2] = [6,7,8] 
print(count(child_dict,0))
 
Which ONE of the following is the output of this code?

Q39Programming in Python2 marksMCQ−0.67 if wrong
Consider the function computeS(X)computeS(X) whose pseudocode is given below:

computeS(X)‾\underline{computeS(X)}

S[1] ← 1  
for i ← 2 to length(X) 
  S[i] ← 1 
  if X[i-1] ≤ X[i] 
      S[i] ← S[i]+S[i-1] 
  end if 
end for 
return S
Which ONE of the following values is returned by the function computeS(X)computeS(X) for X=[6,3,5,4,10]X=[6,3,5,4,10] ?

Q40Linear and Binary Search2 marksMCQ−0.67 if wrong
Let F(n)F(n) denote the maximum number of comparisons made while searching for an entry in a sorted array of size nn using binary search.
Which ONE of the following options is TRUE?

Q41Programming in Python2 marksMCQ−0.67 if wrong
Consider the following Python function:

def fun(D, s1, s2): 
       if s1 < s2: 
          D[s1], D[s2] = D[s2], D[s1] 
          fun(D, s1+1, s2-1)  
What does this Python function fun() do? Select the ONE appropriate option below.