GATE 2024 (Session 2)
65 questions
MCQ 32 · MSQ 18 · NAT 151-mark 30 · 2-mark 35
Questions 61–65 of 65
A processor uses a 32-bit instruction format and supports byte-addressable memory access. The ISA of the processor has 150 distinct instructions. The instructions are equally divided into two types, namely R-type and I-type, whose formats are shown below.
In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.
Let X be the number of bits used to encode the UNUSED field, Y be the number of bits used to encode the OPCODE field, and Z be the number of bits used to encode the immediate value/address field. The value of X + 2Y + Z is ______
In the OPCODE, 1 bit is used to distinguish between I-type and R-type instructions and the remaining bits indicate the operation. The processor has 50 architectural registers, and all register fields in the instructions are of equal size.
Let X be the number of bits used to encode the UNUSED field, Y be the number of bits used to encode the OPCODE field, and Z be the number of bits used to encode the immediate value/address field. The value of X + 2Y + Z is ______
Answer: 34
Size of each field:
- 150 instructions, 75 per type. 1 type bit + bits Y = 8.
- 50 registers bits for each register field.
- R-type: X = 6.
- I-type: Z = 12.
Answer: 34
- 150 instructions, 75 per type. 1 type bit + bits Y = 8.
- 50 registers bits for each register field.
- R-type: X = 6.
- I-type: Z = 12.
Answer: 34
Let be the language represented by the regular expression and , where denotes the length of string . The number of strings in which are also in is ___
Answer: 15
The language has one a, then pairs of a's, with any number of b's in between. So it is the set of strings with an odd number of a's.
Now count the strings with an odd number of a's whose length is :
- length 1: 1 (a)
- length 2:
- length 3:
- length 4:
Adding these:
Answer: 15
Now count the strings with an odd number of a's whose length is :
- length 1: 1 (a)
- length 2:
- length 3:
- length 4:
Adding these:
Answer: 15
Let be the group of integers with addition modulo as the group operation. The number of elements in the group that are their own inverses is
Answer: 4
An element is its own inverse only when these hold: , and .
- In : a = 0, 1 2 choices
- In : b = 0 only 1 choice
- In : c = 0, 2 2 choices
Total number of elements:
Answer: 4
- In : a = 0, 1 2 choices
- In : b = 0 only 1 choice
- In : c = 0, 2 2 choices
Total number of elements:
Answer: 4
Consider a 32-bit system with page size and page table entries of size 4 bytes each. Assume bytes. The OS uses a 2-level page table for memory management, with the page table containing an outer page directory and an inner page table. The OS allocates a page for the outer page directory upon process creation. The OS uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let denote the minimum and denote the maximum number of pages across the two levels of the page table of the process.
The value of is _____
An active process in this system accesses 2000 unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let denote the minimum and denote the maximum number of pages across the two levels of the page table of the process.
The value of is _____
Answer: 1028
The page size is so the page number has 20 bits. One page holds entries. So we use 10 bits for the outer level and 10 bits for the inner level. Each inner page-table page covers 1024 pages.
Minimum (X): the 2000 pages lie together inner pages, plus 1 outer page, so the total is 3.
Maximum (Y): each page falls in a different inner table. But the outer level has only 1024 entries so there are 1024 inner pages plus 1 outer page, which gives 1025.
Sum:
Answer: 1028
Minimum (X): the 2000 pages lie together inner pages, plus 1 outer page, so the total is 3.
Maximum (Y): each page falls in a different inner table. But the outer level has only 1024 entries so there are 1024 inner pages plus 1 outer page, which gives 1025.
Sum:
Answer: 1028
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is
Let . The number of items in the set is ____
Let . The number of items in the set is ____
Answer: 9
Look at the items of that have the dot just before S. These are and . Now move the dot over S:
1.
2.
The dot is before S in item 2, so take its closure. This adds all the S-productions:
3-7.
8. (coming from )
9. (coming from )
Answer: 9
1.
2.
The dot is before S in item 2, so take its closure. This adds all the S-productions:
3-7.
8. (coming from )
9. (coming from )
Answer: 9