GATE 2018
65 questions
MCQ 41 · NAT 241-mark 30 · 2-mark 35
Questions 56–60 of 65
The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.
Answer: 80
The root has to be 1. The other 6 numbers are shared between the left and right subtrees, 3 numbers each. The number of ways to choose them is . Inside each 3-node subtree, the smallest number is the root, and the other two numbers can swap places. That gives 2 ways for each subtree.
Total = 20 2 2 = 80
Answer: 80
Total = 20 2 2 = 80
Answer: 80
Consider the following undirected graph G:
Choose a value for x that will maximize the number of minimum weight spanning trees (MWSTs) of G. The number of MWSTs of G for this value of x is ______.
Choose a value for x that will maximize the number of minimum weight spanning trees (MWSTs) of G. The number of MWSTs of G for this value of x is ______.
Answer: 4
Call the vertices T (top), L (left), R (right), P (bottom-left) and Q (bottom-right). The edges are: T-L 4, L-P 4, T-P 1, T-Q 3, T-R x, R-Q 5, P-Q 4. An MST has 4 edges.
- T-P (1) and T-Q (3) are the lightest edges and do not form a cycle, so they are always in the MST.
- P-Q (4) would close a cycle with T-P and T-Q, so it is never used.
- L is joined by T-L (4) or L-P (4). Both cost the same and both connect L, so there are 2 choices.
- R is joined by T-R (x) or R-Q (5). If , the cheaper one is forced. If , both cost the same, so there are 2 choices. So gives the most MSTs.
Number of MSTs .
Answer: 4
- T-P (1) and T-Q (3) are the lightest edges and do not form a cycle, so they are always in the MST.
- P-Q (4) would close a cycle with T-P and T-Q, so it is never used.
- L is joined by T-L (4) or L-P (4). Both cost the same and both connect L, so there are 2 choices.
- R is joined by T-R (x) or R-Q (5). If , the cheaper one is forced. If , both cost the same, so there are 2 choices. So gives the most MSTs.
Number of MSTs .
Answer: 4
Consider the weights and values of items listed below. Note that there is only one unit of each item.
The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by . A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by .
The value of - is ____________.
The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by . A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by .
The value of - is ____________.
Answer: 16
Ratios of value to weight: item 4 = 12, item 1 = 6, item 3 = 5, item 2 = 4.
- Greedy: pick item 4 (2 kg, value 24). Item 1 (10 kg) can no longer fit. Pick item 3 (4 kg, value 20). Item 2 does not fit .
- Optimal: item 1 alone gives 60, which is better than items 2 and 4 together (52) or items 2 and 3 together (48) .
Difference = 60 44 = 16
Answer: 16
- Greedy: pick item 4 (2 kg, value 24). Item 1 (10 kg) can no longer fit. Pick item 3 (4 kg, value 20). Item 2 does not fit .
- Optimal: item 1 alone gives 60, which is better than items 2 and 4 together (52) or items 2 and 3 together (48) .
Difference = 60 44 = 16
Answer: 16
Consider the minterm list form of a Boolean function F given below.
Here, m denotes a minterm and d denotes a don't care term. The number of essential prime implicants of the function F is ______.
Here, m denotes a minterm and d denotes a don't care term. The number of essential prime implicants of the function F is ______.
Answer: 3
The cells that are 1 or don't-care are 0, 2, 3, 5, 7, 8, 9, 10, 11, 12, 14. The prime implicants (largest groups) are:
(0, 2, 8, 10), (2, 3, 10, 11), (8, 9, 10, 11), (8, 10, 12, 14), (5, 7), (3, 7).
A prime implicant is essential if it is the only one covering some required minterm (a 1, not a don't-care):
- Minterm 0 is covered only by , so it is essential.
- Minterm 5 is covered only by , so it is essential.
- Minterm 9 is covered only by , so it is essential.
These three already cover all of 0, 2, 5, 7, 9, 11. Every other minterm is covered by more than one prime implicant, so the other three are not essential.
Answer: 3
(0, 2, 8, 10), (2, 3, 10, 11), (8, 9, 10, 11), (8, 10, 12, 14), (5, 7), (3, 7).
A prime implicant is essential if it is the only one covering some required minterm (a 1, not a don't-care):
- Minterm 0 is covered only by , so it is essential.
- Minterm 5 is covered only by , so it is essential.
- Minterm 9 is covered only by , so it is essential.
These three already cover all of 0, 2, 5, 7, 9, 11. Every other minterm is covered by more than one prime implicant, so the other three are not essential.
Answer: 3
The instruction pipeline of a RISC processor has the following stages: Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Perform Operation (PO) and Writeback (WB). The IF, ID, OF and WB stages take 1 clock cycle each for every instruction. Consider a sequence of 100 instructions. In the PO stage, 40 instructions take 3 clock cycles each, 35 instructions take 2 clock cycles each, and the remaining 25 instructions take 1 clock cycle each. Assume that there are no data hazards and no control hazards.
The number of clock cycles required for completion of execution of the sequence of instructions is ______.
The number of clock cycles required for completion of execution of the sequence of instructions is ______.
Answer: 219
PO is the slowest stage, so the instructions pass through it one after another with no gap.
Total time in PO = 40 3 + 35 2 + 25 1 = 215 cycles.
The first PO is preceded by 3 cycles (IF, ID, OF), and the last PO is followed by 1 cycle (WB). So 3 + 215 + 1 = 219
Answer: 219
Total time in PO = 40 3 + 35 2 + 25 1 = 215 cycles.
The first PO is preceded by 3 cycles (IF, ID, OF), and the last PO is followed by 1 cycle (WB). So 3 + 215 + 1 = 219
Answer: 219