GATE 2020
64 questions
MCQ 41 · NAT 231-mark 29 · 2-mark 35
Questions 31–35 of 64
Consider the following C program.
#include <stdio.h>
int main () {
int a[4] [5] = {{1, 2, 3, 4, 5},
{6, 7,8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17,18, 19, 20}};
printf("%d\n", *(*(a+**a+2)+3));
return(0);
}The output of the program is _______.Answer: 19
Here **a is the same as a[0][0], which is 1. So the expression becomes .
Row 3 is {16, 17, 18, 19, 20} a[3][3] is 19.
Answer: 19
Row 3 is {16, 17, 18, 19, 20} a[3][3] is 19.
Answer: 19
Consider a double hashing scheme in which the primary hash function is , and the secondary hash function is . Assume that the table size is 23. Then the address returned by probe 1 in the probe sequence (assume that the probe sequence begins at probe 0) for key value k=90 is_____________.
Answer: 13
Compute both hash values:
- Primary hash:
- Secondary hash:
Probe formula for probe i: . Value for probe 1:
Answer: 13
- Primary hash:
- Secondary hash:
Probe formula for probe i: . Value for probe 1:
Answer: 13
Consider the following grammar.
The number of reduction steps taken by a bottom-up parser while accepting the string is___________.
The number of reduction steps taken by a bottom-up parser while accepting the string is___________.
Answer: 7
Bottom-up parsing of aaadbbb takes these reduction steps:
Step 1: reduce d S
Step 2: reduce b B. Step 3: reduce aSB S
Step 4: reduce b B. Step 5: reduce aSB S
Step 6: reduce b B. Step 7: reduce aSB S
Answer: 7
Step 1: reduce d S
Step 2: reduce b B. Step 3: reduce aSB S
Step 4: reduce b B. Step 5: reduce aSB S
Step 6: reduce b B. Step 7: reduce aSB S
Answer: 7
Assume that you have made a request for a web page through your web browser to a web server. Initially the browser cache is empty. Further, the browser is configured to send HTTP requests in non-persistent mode. The web page contains text and five very small images.The minimum number of TCP connections required to display the web page completely in your browser is__________.
Answer: 6
In non-persistent HTTP, every object needs its own TCP connection. So the text page takes 1 connection, and each of the 5 images takes 1 more connection.
Answer: 6
Answer: 6
Which of the following languages are undecidable? Note that indicates encoding of the Turing machine .
{ on input w reaches state q in exactly 100 steps}
{ on input w reaches state q in exactly 100 steps}
Answer: (A)
Check each language:
- (empty language): a non-trivial property of L(M) undecidable by Rice.
- : simply run M on w for 100 steps decidable.
- (L(M) not recursive): a non-trivial property undecidable.
- (at least 21 strings): a non-trivial property undecidable.
Answer: and only
- (empty language): a non-trivial property of L(M) undecidable by Rice.
- : simply run M on w for 100 steps decidable.
- (L(M) not recursive): a non-trivial property undecidable.
- (at least 21 strings): a non-trivial property undecidable.
Answer: and only