GATE 2017 (Session 2)
65 questions
MCQ 45 · NAT 201-mark 30 · 2-mark 35
Questions 56–60 of 65
Consider the following database table named top_scorer.
Consider the following SQL query:
The number of tuples returned by the above SQL query is ___________.
Consider the following SQL query:
SELECT ta.player FROM top_scorer AS ta
WHERE ta.goals >ALL (SELECT tb.goals
FROM top_scorer AS tb
WHERE tb.country = 'Spain')
AND ta.goals >ANY (SELECT tc.goals
FROM top_scorer AS tc
WHERE tc.country = 'Germany') The number of tuples returned by the above SQL query is ___________.
Answer: 7
Check each condition one by one:
- No player is from Spain. So the condition " ALL (empty set)" is true for every player.
- The condition " ANY (German goals: 16, 14, 11, 10, 10)" means goals 10, the smallest value.
Players with more than 10 goals are Klose, Ronaldo, G Müller, Fontaine, Pelé, Klinsmann and Kocsis. That makes 7 players.
Answer: 7
- No player is from Spain. So the condition " ALL (empty set)" is true for every player.
- The condition " ANY (German goals: 16, 14, 11, 10, 10)" means goals 10, the smallest value.
Players with more than 10 goals are Klose, Ronaldo, G Müller, Fontaine, Pelé, Klinsmann and Kocsis. That makes 7 players.
Answer: 7
If the ordinary generating function of a sequence then is equal to ______.
Answer: 15
Series expansion: , so the general term is .
Value at n = 3: , and at n = 0: . Then
Answer: 15
Value at n = 3: , and at n = 0: . Then
Answer: 15
If a random variable X has a Poisson distribution with mean 5, then the expectation equals ______________.
Answer: 54
For a Poisson distribution with mean , the variance is also , so (this is exact, not an approximation).
Use :
Now expand and use linearity of expectation:
Answer: 54
Use :
Now expand and use linearity of expectation:
Answer: 54
In a tree, if the search -key value is 8 bytes long, the block size is 512 bytes and the block pointer size is 2 bytes, then maximum order of the tree is _______________.
Answer: 52
A node of order p holds p block pointers and p 1 search keys.
Use the block size limit:
Answer: 52
Use the block size limit:
Answer: 52
A message is made up entirely of characters from the set X= {P,Q,R,S,T}. The table of probabilities for each of the characters is shown below:
If a message of 100 characters over X is encoded using Huffman coding, then the expected length of the encoded message in bits is_____
If a message of 100 characters over X is encoded using Huffman coding, then the expected length of the encoded message in bits is_____
Answer: 225
Huffman steps: T (0.08) and R (0.17) merge to 0.25; S (0.19) and P (0.22) merge to 0.41; 0.25 and Q (0.34) merge to 0.59; then 0.41 and 0.59 merge.
Code lengths: Q 2, S 2, P 2, T 3, R 3.
Average length = 0.342 + 0.192 + 0.222 + 0.083 + 0.173 = 2.25 bits. For 100 characters, this gives 225 bits.
Answer: 225
Code lengths: Q 2, S 2, P 2, T 3, R 3.
Average length = 0.342 + 0.192 + 0.222 + 0.083 + 0.173 = 2.25 bits. For 100 characters, this gives 225 bits.
Answer: 225