# GATE CS 1997

• Last Updated : 01 Jun, 2021

 Question 1
The probability that it will rain today is 0.5. The probability that it will rain tomorrow is 0.6. The probability that it will rain either today or tomorrow is 0.7. What is the probability that it will rain today and tomorrow?
 A 0.3 B 0.25 C 0.35 D 0.4
Probability    GATE CS 1997
Discuss it

Question 1 Explanation:
Let A is the event that it will rain today and B is the event that it will rain tomorrow.
```probability (A intersection B) = probability ( A ) + probability (B) - probability (A union B).
probability (A intersection B) = 0.5 + 0.6 - 0.7 = 0.4 ```
 Question 2
The Newton-Raphson method is used to find the root of the equation x- 2 = 0. If the iterations are started from -1, the iterations will a. converge to -1 b. converge to √2 c. converge to -√2 d. not converge
 A a B b C c D d
Numerical Methods and Calculus    GATE CS 1997
Discuss it

 Question 3
The determinant of the matrix is A 11 B -48 C 0 D -24
Linear Algebra    GATE CS 1997
Discuss it

Question 3 Explanation:
The determinant value of a upper or lower triangular matrix is the product of the elements in the principal diagnol. This can be easily proved by expanding along the first row or the first column depending on whether the matrix is lower triangular or upper triangular. Determinant value = 6 * 2 * 4 * -1 = -48 Therefore option (B) is correct. This explanation is provided by Chirag Manwani.
 Question 4
The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list should be used?
 A singly linked list B doubly linked list C circular doubly linked list D array implementation of lists
Discuss it

Question 4 Explanation:
Singly linked list cannot be answer because we cannot find last element of a singly linked list in O(1) time. Doubly linked list cannot also not be answer because of the same reason as singly linked list.
 Question 5
The correct matching for the following pairs is
```(A) All pairs shortest path          (1) Greedy
(B) Quick Sort                       (2) Depth-First search
(C) Minimum weight spanning tree     (3) Dynamic Programming
(D) Connected Components             (4) Divide and and Conquer
```
```Codes:
A    B    C    D
a    2    4    1    3
b    3    4    1    2
c    3    4    2    1
d    4    1    2    3
```
 A a B b C c D d
Analysis of Algorithms    GATE CS 1997
Discuss it

 Question 6
In the following grammar
```X :: = X ⊕ Y / Y
Y :: = Z * Y / Z
Z :: = id
```
Which of the following is true? a. '⊕' is left associative while '*' is right associative b. Both '⊕' and '*' are left associative c. '⊕' is right associative while '*' is left associative d. None of the above
 A a B b C c D d
Parsing and Syntax directed translation    GATE CS 1997
Discuss it

Question 6 Explanation:
X :: = X ⊕ Y is left recursive grammar, so ‘⊕’ is left associative and Z * Y is right recursive grammar, so ‘*’ is right associative.
 Question 7
Which of the following is essential for converting an infix expression to the postfix from efficiently ?
 A An operator stack B An operand stack C An operand stack and an operator stack D A parse tree
Parsing and Syntax directed translation    GATE CS 1997
Discuss it

Question 7 Explanation:
Operator stack is used for converting infix to postfix expression such that operators like as +, *, (, ), / are pushed in stack where as operand stack is used for converting Postfix to Prefix evaluation such that operands are 7,2,1,2 etc. Hence, option (A) is correct.
 Question 8
A language L allows declaration of arrays whose sizes are not known during compilation. It is required to make efficient use of memory. Which of the following is true?
 A A compiler using static memory allocation can be written for L B A compiler cannot be written for L, an interpreter must be used C A compiler using dynamic memory allocation can be written for L D None of the above
Code Generation and Optimization    GATE CS 1997
Discuss it

Question 8 Explanation:
If a language L allows declaration of arrays whose sizes are not known during compilation time. It is required to use efficient use of memory. So a compiler using dynamic memory allocation can be written for L. An array is a collection of data items, all of the same type, accessed using a common name. C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely malloc, realloc, calloc and free.
 Question 9
The condition expansion facility of macro processors is provided to
 A test a condition during the execution of the expanded program B to expand certain model statements depending upon the value of a condition during the execution of the expanded program C to implement recursion D to expand certain model statements depending upon the value of a condition during the process of macros expansion
Code Generation and Optimization    GATE CS 1997
Discuss it

Question 9 Explanation:
Macro processors provided a condition expansion facility to expand the certain module statements depending upon the value of a condition during the process of macros expansion. Hence, option (D) is correct.
 Question 10
Heap allocation is required for languages
 A that support recursion B that support dynamic data structures C that use dynamic scope rules D none of the above
C Misc    GATE CS 1997
Discuss it

There are 75 questions to complete.
My Personal Notes arrow_drop_up