GATE 2024
64 questions
MCQ 36 · MSQ 12 · NAT 161-mark 29 · 2-mark 35
Questions 31–35 of 64
The fundamental operations in a double-ended queue D are:
insertFirst(e) - Insert a new element at the beginning of .
insertLast(e) - Insert a new element at the end of D .
removeFirst()-Remove and return the first element of D.
removeLast () - Remove and return the last element of D.
In an empty double-ended queue, the following operations are performed:
insertFirst (10)
insertLast (32)
removeFirst ()
insertLast (28)
insertLast(17)
removeFirst ()
removeLast ()
The value of is _________ .
insertFirst(e) - Insert a new element at the beginning of .
insertLast(e) - Insert a new element at the end of D .
removeFirst()-Remove and return the first element of D.
removeLast () - Remove and return the last element of D.
In an empty double-ended queue, the following operations are performed:
insertFirst (10)
insertLast (32)
removeFirst ()
insertLast (28)
insertLast(17)
removeFirst ()
removeLast ()
The value of is _________ .
Answer: 17
Follow each operation, writing the deque from first to last:
1. insertFirst(10): D = [10]
2. insertLast(32): D = [10, 32]
3. removeFirst(): removes and returns 10, so a = 10. Now D = [32]
4. insertLast(28): D = [32, 28]
5. insertLast(17): D = [32, 28, 17]
6. removeFirst(): removes and returns 32, so a = 32. Now D = [28, 17]
7. removeLast(): removes and returns 17, so a = 17. Now D = [28]
The last assignment gives the final value of a.
Answer: 17
1. insertFirst(10): D = [10]
2. insertLast(32): D = [10, 32]
3. removeFirst(): removes and returns 10, so a = 10. Now D = [32]
4. insertLast(28): D = [32, 28]
5. insertLast(17): D = [32, 28, 17]
6. removeFirst(): removes and returns 32, so a = 32. Now D = [28, 17]
7. removeLast(): removes and returns 17, so a = 17. Now D = [28]
The last assignment gives the final value of a.
Answer: 17
Let be the function .
The value of the derivative of at where is _________ (rounded off to two decimal places).
Note: denotes the set of real numbers.
The value of the derivative of at where is _________ (rounded off to two decimal places).
Note: denotes the set of real numbers.
Answer: 0.24
Start with the function:
Differentiate it:
This can be written as:
So we get:
At the point where :
Answer: 0.24
Differentiate it:
This can be written as:
So we get:
At the point where :
Answer: 0.24
The sample average of 50 data points is 40. The updated sample average after including a new data point taking the value of 142 is
Answer: 42
The new average is the new total divided by the new count. The old total is the old average times the number of points.
Here the old average is , the number of points is and the new point is .
This is exact, since .
Answer: 42
Here the old average is , the number of points is and the new point is .
This is exact, since .
Answer: 42
Consider the matrix .
The determinant of ( ) is _________ .
The determinant of ( ) is _________ .
Answer: 0
Start with .
Apply and . These row operations do not change the determinant, so equals the determinant of
Here and are equal, so this determinant is 0. So .
Now , and . So
Answer: 0
A fair six-sided die (with faces numbered ) is repeatedly thrown independently.
What is the expected number of times the die is thrown until two consecutive throws of even numbers are seen?
What is the expected number of times the die is thrown until two consecutive throws of even numbers are seen?
Answer: (C)
Let be the expected number of throws needed to see two even numbers in a row, starting fresh. Let be the expected number of further throws needed, given that the last throw was even. An even number () has probability , and so does an odd number.
From a fresh start, one throw is used:
Even: we are now in the state with more throws to go. Odd: we are back at the start with more throws to go.
After an even throw, one more throw is used:
Even: we are done after this throw. Odd: we start again.
Solve. Equation (1) gives , so . Equation (2) gives .
Put this in: , so and .
Answer: (C)
From a fresh start, one throw is used:
Even: we are now in the state with more throws to go. Odd: we are back at the start with more throws to go.
After an even throw, one more throw is used:
Even: we are done after this throw. Odd: we start again.
Solve. Equation (1) gives , so . Equation (2) gives .
Put this in: , so and .
Answer: (C)