GATE 2025 (Session 1)
65 questions
MCQ 30 · MSQ 13 · NAT 221-mark 30 · 2-mark 35
Questions 31–35 of 65
Consider the given function .
If the function is differentiable everywhere, the value of must be ________. (rounded off to one decimal place)
If the function is differentiable everywhere, the value of must be ________. (rounded off to one decimal place)
Answer: -2.1 to -1.9
If is to be differentiable at , it must first be continuous there. After that, the one-sided derivatives must be equal.
Continuity: the left-hand value and the right-hand value . So .
Equal derivatives: the left derivative . The right derivative , taken at : . So .
Put this back in the continuity equation: .
Answer: -2.0
Continuity: the left-hand value and the right-hand value . So .
Equal derivatives: the left derivative . The right derivative , taken at : . So .
Put this back in the continuity equation: .
Answer: -2.0
A box contains 5 coins: 4 regular coins and 1 fake coin. When a regular coin is tossed, the probability and for a fake coin, . You pick a coin at random and toss it twice, and get two heads. The probability that the coin you have chosen is the fake coin is _______. (rounded off to two decimal places)
Answer: 0.49 to 0.51
Use Bayes' theorem: .
A fake coin always gives heads: . For a regular coin: .
and .
.
.
Answer: 0.50
A fake coin always gives heads: . For a regular coin: .
and .
.
.
Answer: 0.50
The pseudocode of a function fun() is given below:
fun(int A[0,...,n-1])
{
for i=0 to n-2
for j=0 to n-i-2
if (A[j] > A[j+1])
then swap A[j] and A[j+1]
}
Let be an array storing 30 distinct integers in descending order. The number of swap operations that will be performed, if the function fun() is called with as argument, is __________. (Answer in integer)Answer: 435
This is the standard bubble-sort pseudocode. The array is in descending order, so every comparison of adjacent elements finds them out of order. A swap therefore happens on every comparison. No comparison skips the swap.
The total number of comparisons, and so the number of swaps, for an array of elements. Putting in : .
Answer: 435
The total number of comparisons, and so the number of swaps, for an array of elements. Putting in : .
Answer: 435
#include <stdio.h>
void foo(int *p, int x) {
*p = x;
}
int main() {
int *z;
int a = 20, b = 25;
z = &a;
foo(z, b);
printf("%d", a);
return 0;
}
The output of the given C program is __________. (Answer in integer) Answer: 25
The statement sets to hold the address of , whose value is now .
The call sends (the address of ) and the value of () to . So inside , points to and .
The statement stores at the place points to. That place is itself, because a pointer gives direct access to the variable of the caller. So is now .
Then prints the updated value of .
Answer: 25
The call sends (the address of ) and the value of () to . So inside , points to and .
The statement stores at the place points to. That place is itself, because a pointer gives direct access to the variable of the caller. So is now .
Then prints the updated value of .
Answer: 25
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node. Suppose a Min-Heap stores 32 keys. The height of is _____________. (Answer in integer)
Answer: 5
A min-heap that has keys is kept as a nearly complete binary tree. Its height (the most edges from the root to a leaf) is .
Level has node, level has , level has , level has , and level has . Together, nodes fill levels to fully. So the nd key has to go on a new level, level 5.
Answer: 5
Level has node, level has , level has , level has , and level has . Together, nodes fill levels to fully. So the nd key has to go on a new level, level 5.
Answer: 5