GATE 2018 CS Set 31) Which one the following is a closed form expression for the generating function of the sequence {a_{n}}, where a_{n} = 2n + 3 for all n = 0, 1, 2,...?
Answer: D Explanation: Given a_{n} = 2n + 3 Generating function G(x) for the sequence an is Expanding above function we get, Now substituting these values in G(x) we get, Hence, the correct option is (D). 2) Consider the following C program. The output of this program is:
Answer: A Explanation: char 'a' + 2 will become 'c' 3) A queue is implemented using a noncircular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let n denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' be implemented by deletion of a node from the tail. Which one of the following is the time complexity of the most timeefficient implementation of 'enqueue' and 'dequeue, respectively, for this data structure?
Answer: B Explanation: Create new node N: Enqueue(){ In this enqueue operation only pointer manipulation is involved which takes a constant amount of time. Hence, Time Complexity = O(1) Deletion of a node from Tail For Dequeue operation, we make next pointer of second last node of single linked list NULL. In the singly linked list, we can not access its previous node, so we need to traverse the entire linked list to get second last node of linked list, i.e., Dequeue(){ Since, we are traversing the entire linked list for each Dequeue operation. So, Time Complexity = O(n) 4) Let ⊕ and ⊙ denote the Exclusive OR and Exclusive NOR operations, respectively. Which one of the following is NOT CORRECT?
Answer: D Explanation: LHS, (p⊕p)⊕q = 1⊕q = 1.q' + 0.q = q' RHS (p⊙p')⊙(q') = 0⊙(q') = 0(q') + 1.(q')' = q Hence, LHS ≠ RHS therefore, Option (D) is the correct answer. 5) Consider the following processor design characteristics. I. Registertoregister arithmetic operations only Which of the characteristics above are used in the design of a RISC processor?
Answer: D Explanation: In RISC the Instructions length cannot vary. It is usually fixed and of 32 bit. In CISC the Instructions length can be between 16 to 64 bits. The hardwired control unit is used only when instructions are fixed. Register to register operations is always possible in RISC. CISC can have both register to register operations and memory to memory instructions. 6) Let N be an NFA with n states. Let k be the number of states of a minimal DFA which is equivalent to N. Which one of the following is necessarily true?
Answer: D Explanation: If NFA having n states then equivalent DFA can have atmost 2^{n} states. Hence, number of states in minimal DFA > k ≤ 2^{n} 7) The set of all recursively enumerable languages is
Answer: B Explanation: We know that the Recursive Enumerable Language are closed under Union, Intersection, Concatenation but not Complementation. So, we can easily say that option (A) is the correct answer. 8) Which one of the following statements is FALSE?
Answer: B Explanation: Type checking performs at semantic analysis phase, and parsing performs at the syntax analysis phase. Since Syntax analysis phase comes before semantic analysis, therefore Type Checking is always done after parsing. Hence Option (B) is false and is the correct answer. GATE 2018 CS Set 32 GATE 2018 CS Set 33 GATE 2018 CS Set 34 GATE 2018 CS Set 35 GATE 2018 CS Set 36 GATE 2018 CS Set 37 GATE 2018 CS Set 38 GATE Introduction
Next TopicGATE 2018 CS Set 32
