GATE 2021 (Session 1)
65 questions
MCQ 34 · MSQ 13 · NAT 181-mark 30 · 2-mark 35
Questions 16–20 of 65
Let the representation of a number in base 3 be 210. What is the hexadecimal representation of the number?
Answer: (A)
Convert base 3 to decimal:
Split 21 as 16 + 5 Hex form:
Answer: 15
Split 21 as 16 + 5 Hex form:
Answer: 15
Let p and q be two propositions. Consider the following two formulae in propositional logic.
Which one of the following choices is correct?
Which one of the following choices is correct?
Answer: (B)
S1. . So S1 is . If is true, then is true, so S1 is true for every value. S1 is a tautology.
S2. Put . Then is true, but is false, because is false. A true statement implying a false one is false, so S2 is false here. S2 is not a tautology.
Answer: (B)
S2. Put . Then is true, but is false, because is false. A true statement implying a false one is false, so S2 is false here. S2 is not a tautology.
Answer: (B)
Consider the following two statements.
S1: Destination MAC address of an ARP reply is a broadcast address.
S2: Destination MAC address of an ARP request is a broadcast address.
Which one of the following choices is correct?
S1: Destination MAC address of an ARP reply is a broadcast address.
S2: Destination MAC address of an ARP request is a broadcast address.
Which one of the following choices is correct?
Answer: (C)
- ARP request: the sender knows the IP address but not the MAC address, so it sends the request to the broadcast MAC address (FF:FF:FF:FF:FF:FF). S2 is true.
- ARP reply: the replying host already knows the requester's MAC address (from the request), so it sends the reply directly to that address as a unicast. S1 is false.
Answer: (C)
- ARP reply: the replying host already knows the requester's MAC address (from the request), so it sends the reply directly to that address as a unicast. S1 is false.
Answer: (C)
Consider the following array.
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
Which algorithm out of the following options uses the least number of comparisons (among the array elements) to sort the above array in ascending order?
Answer: (C)
The array is already in sorted order.
- Insertion sort: every element is compared just once with the element on its left n 1 = 7 comparisons (best case).
- Selection sort always makes n(n 1)/2 = 28 comparisons.
- Merge sort needs more than 7 comparisons (about 12 here).
- Quicksort with the last element as pivot, on sorted input, gives the worst case (28).
Answer: Insertion sort
- Insertion sort: every element is compared just once with the element on its left n 1 = 7 comparisons (best case).
- Selection sort always makes n(n 1)/2 = 28 comparisons.
- Merge sort needs more than 7 comparisons (about 12 here).
- Quicksort with the last element as pivot, on sorted input, gives the worst case (28).
Answer: Insertion sort
A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?
Answer: (D)
Check just the root and its children:
- If the root has a right child, then some element is bigger than the root, so the root is not the maximum choose the root.
- If not, the root is the maximum, and its left child is smaller choose the left child.
Only a fixed number of steps is needed .
Answer:
- If the root has a right child, then some element is bigger than the root, so the root is not the maximum choose the root.
- If not, the root is the maximum, and its left child is smaller choose the left child.
Only a fixed number of steps is needed .
Answer: