GATE 2026 (Session 2)
65 questions
MCQ 35 · MSQ 11 · NAT 191-mark 30 · 2-mark 35
Questions 41–45 of 65
Consider the canonical parsing of the grammar below using terminals and non-terminals with as the start symbol.
Which one of the following options gives the number of shift-reduce conflicts that will occur in the ACTION table?
Which one of the following options gives the number of shift-reduce conflicts that will occur in the ACTION table?
Answer: (D)
Build the LR(0) canonical collection for . A state has a shift-reduce conflict when it holds a complete item (reduce) and also a shift item on some terminal.
Going through the automaton, these states each have a reduce item together with a shift item:
- The initial state : reduce and shift on .
- The state reached after , : reduce and shift on .
- The state on that loops to itself, : reduce and shift on .
- The state on that loops to itself, : reduce and shift on .
- The state on that loops to itself (from ), : reduce and shift on .
So there are exactly states with a conflict. The other states, such as those after fully reducing or , have only one complete item and no shift item to compete with it.
Answer: 5
Going through the automaton, these states each have a reduce item together with a shift item:
- The initial state : reduce and shift on .
- The state reached after , : reduce and shift on .
- The state on that loops to itself, : reduce and shift on .
- The state on that loops to itself, : reduce and shift on .
- The state on that loops to itself (from ), : reduce and shift on .
So there are exactly states with a conflict. The other states, such as those after fully reducing or , have only one complete item and no shift item to compete with it.
Answer: 5
In the context of schema normalization in relational DBMS, consider a set of functional dependencies. The set of all functional dependencies implied by is called the closure of . To compute the closure of , Armstrong's Axioms can be applied. Consider , and as sets of attributes over a relational schema. The three rules of Armstrong's Axioms are described as follows.
Reflexivity: If , then
Augmentation: If , then for any Z
Transitivity: If and , then
The additional rule of Union is defined as follows.
Union: If and , then
It can be proved that the additional rule of Union is also implied by the three rules of Armstrong's Axioms. Listed below are four combinations of these three rules. Which one of these combinations is both necessary and sufficient for the proof?
Reflexivity: If , then
Augmentation: If , then for any Z
Transitivity: If and , then
The additional rule of Union is defined as follows.
Union: If and , then
It can be proved that the additional rule of Union is also implied by the three rules of Armstrong's Axioms. Listed below are four combinations of these three rules. Which one of these combinations is both necessary and sufficient for the proof?
Answer: (D)
Here is the usual proof of the Union rule ():
1. We are given . Use Augmentation and add on both sides. This gives , since .
2. We are given . Use Augmentation and add on both sides. This gives .
3. Now apply Transitivity to steps 1 and 2. From and we get .
The proof uses only Augmentation and Transitivity. Reflexivity is not used at any point. So these two rules are both necessary (the proof needs both kinds of steps) and sufficient (no other rule is needed).
Answer: Augmentation and Transitivity
1. We are given . Use Augmentation and add on both sides. This gives , since .
2. We are given . Use Augmentation and add on both sides. This gives .
3. Now apply Transitivity to steps 1 and 2. From and we get .
The proof uses only Augmentation and Transitivity. Reflexivity is not used at any point. So these two rules are both necessary (the proof needs both kinds of steps) and sufficient (no other rule is needed).
Answer: Augmentation and Transitivity
Consider the transmission of data bits over a link that uses Cyclic Redundancy Check (CRC) code for error detection. If the generator bit pattern is given to be , which one of the following options shows the remainder bit pattern appended to the data bits before transmission?
Answer: (D)
The generator has degree 3, so append 3 zeros to the data: . Divide by using modulo-2 division (subtraction is XOR). When the leading bit is 0, XOR with .
Take the first 4 bits : . Bring down the next bit 0: .
. Bring down 1: .
Leading bit 0, so the result is . Bring down 0: .
. Bring down 1: .
. Bring down 1: .
. Bring down 0: .
. Bring down 0: .
Leading bit 0, so the result is . Bring down the last 0: .
Leading bit 0, so the result stays . All bits are used, so the remainder is the last 3 bits, .
The transmitted word is .
Answer: (D)
Take the first 4 bits : . Bring down the next bit 0: .
. Bring down 1: .
Leading bit 0, so the result is . Bring down 0: .
. Bring down 1: .
. Bring down 1: .
. Bring down 0: .
. Bring down 0: .
Leading bit 0, so the result is . Bring down the last 0: .
Leading bit 0, so the result stays . All bits are used, so the remainder is the last 3 bits, .
The transmitted word is .
Answer: (D)
Consider a processor that has general purpose registers and it uses -byte instruction format for all its instructions. Variable-sized opcodes are permitted. There are three different types of instructions; M-type, R-type, and C-type. Each M-type instruction has register operands and a -bit immediate operand. Each Rtype instruction has register operands. Each C-type instruction has a register operand and a -bit offset value. If there are unique M-type opcodes and unique R-type opcodes, which one of the following options gives the maximum number of unique opcodes possible for C-type instructions?
Answer: (B)
There are general-purpose registers, so one register operand takes bits. The whole instruction is bytes bits.
- M-type: There are register operands ( bits) an immediate of bits. The operand part bits. The opcode gets the rest: bits. This allows up to M-type codes. Only are used. So prefixes of bits stay free for the other instruction types.
- R-type: There are register operands ( bits). The opcode gets bits. With an expanding opcode scheme, the prefixes of bits left over from M-type each expand into codes of bits. This gives R-type slots in all. Only are used. So prefix of bits is left unused.
- C-type: There is register operand ( bits) an offset of bits, which bits. The opcode gets bits. That one unused prefix of bits expands into C-type codes of bits.
Answer: 4
- M-type: There are register operands ( bits) an immediate of bits. The operand part bits. The opcode gets the rest: bits. This allows up to M-type codes. Only are used. So prefixes of bits stay free for the other instruction types.
- R-type: There are register operands ( bits). The opcode gets bits. With an expanding opcode scheme, the prefixes of bits left over from M-type each expand into codes of bits. This gives R-type slots in all. Only are used. So prefix of bits is left unused.
- C-type: There is register operand ( bits) an offset of bits, which bits. The opcode gets bits. That one unused prefix of bits expands into C-type codes of bits.
Answer: 4
Consider the control flow graph given below.
Which one of the following options is the set of live variables at the exit point of each basic block?
Which one of the following options is the set of live variables at the exit point of each basic block?
Answer: (A)
Liveness is a backward analysis. and . Here is the variables read before being written in the block, and is the variables written.
Blocks (edges: B1 to B2 and B3, B2 to B4, B3 to B1, B4 to exit):
B1: use , def
B2: use , def
B3: use , def
B4: use , def
B4: out , so in .
B2: out , so in .
B1 and B3 depend on each other (loop), so iterate. Start with in(B3) = and in(B1) = . Then out(B1) = in(B2) in(B3) , so in(B1) . Then out(B3) = in(B1) , so in(B3) (e is removed because B3 defines it). Then out(B1) , so in(B1) again. Nothing changes, so this is the fixpoint.
Live at the exit of each block: B1 , B2 , B3 , B4 . This matches option (A). Option (C) misses b in B3, but b is read again in B1 after the loop edge and B3 never writes it.
Answer: (A)
Blocks (edges: B1 to B2 and B3, B2 to B4, B3 to B1, B4 to exit):
B1: use , def
B2: use , def
B3: use , def
B4: use , def
B4: out , so in .
B2: out , so in .
B1 and B3 depend on each other (loop), so iterate. Start with in(B3) = and in(B1) = . Then out(B1) = in(B2) in(B3) , so in(B1) . Then out(B3) = in(B1) , so in(B3) (e is removed because B3 defines it). Then out(B1) , so in(B1) again. Nothing changes, so this is the fixpoint.
Live at the exit of each block: B1 , B2 , B3 , B4 . This matches option (A). Option (C) misses b in B3, but b is read again in B1 after the loop edge and B3 never writes it.
Answer: (A)