GATE 2021 (Session 1)
65 questions
MCQ 34 · MSQ 13 · NAT 181-mark 30 · 2-mark 35
Questions 36–40 of 65
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code
With respect to the above grammar, which one of the following choices is correct?
With respect to the above grammar, which one of the following choices is correct?
Answer: (B)
The rule always gives E.type = int, even if ID was declared as bool. So:
- Integer declarations and integer expressions (+) are type-checked correctly.
- Boolean expressions fail. !ID sees an int and reports an error.
- Nothing runs in an infinite loop.
Answer: type-check integer variable declarations and integer expressions
- Integer declarations and integer expressions (+) are type-checked correctly.
- Boolean expressions fail. !ID sees an int and reports an error.
- Nothing runs in an infinite loop.
Answer: type-check integer variable declarations and integer expressions
The following relation records the age of 500 employees of a company, where empNo ( indicating the employee number) is the key:
Consider the following relational algebra expression:
What does the above expression generate?
Consider the following relational algebra expression:
What does the above expression generate?
Answer: (C)
The join matches each employee with every employee who is younger (age age1). An employee shows up in the result if at least one other employee is younger. This means that their age is not the minimum.
Answer: Employee numbers of all employees whose age is not the minimum
Answer: Employee numbers of all employees whose age is not the minimum
Consider a 3-bit counter, designed using T flip-flops, as shown below:
Assuming the initial state of the counter given by PQR as 000, what are the next three states?
Assuming the initial state of the counter given by PQR as 000, what are the next three states?
Answer: (A)
Read the circuit: , , . A T flip-flop toggles only when T = 1.
- Start at 000: T = (0, 1, 1) 011
- Now at 011: T = (1, 1, 0) 101
- Now at 101: T = (1, 0, 1) 000
Answer: 011, 101, 000
- Start at 000: T = (0, 1, 1) 011
- Now at 011: T = (1, 1, 0) 101
- Now at 101: T = (1, 0, 1) 000
Answer: 011, 101, 000
Assume that a 12-bit Hamming codeword consisting of 8-bit data and 4 check bits is , where the data bits and the check bits are given in the following tables:
Which one of the following choices gives the correct values of x and y?
Which one of the following choices gives the correct values of x and y?
Answer: (A)
Positions: 1 c1, 2 c2, 3 d1, 4 c4, 5 d2, 6 d3, 7 d4, 8 c8, 9 d5, 10 d6, 11 d7, 12 d8 (even parity).
- c1 covers d1, d2, d4, d5, d7 = 1 + 0 + 0 + x + 1 = x. Given c1 = 0 x = 0.
- c8 covers d5, d6, d7, d8 = 0 + 0 + 1 + 1 = 0 y = 0.
(c2 and c4 also match: 1 and 0.)
Answer: x is 0 and y is 0
- c1 covers d1, d2, d4, d5, d7 = 1 + 0 + 0 + x + 1 = x. Given c1 = 0 x = 0.
- c8 covers d5, d6, d7, d8 = 0 + 0 + 1 + 1 = 0 y = 0.
(c2 and c4 also match: 1 and 0.)
Answer: x is 0 and y is 0
Consider the following recurrence relation.
Which one of the following options is correct?
Which one of the following options is correct?
Answer: (C)
The sizes of the two subproblems add up to . So the work at each level gets smaller by a constant factor:
The total work
Answer:
The total work
Answer: