CS and IT GATE 2021 SET-2 Questions with Answer

Ques 40 Programming and Data Structures


Consider the following ANSI C program:
int main() {
Integer x;
return 0;
}
Which one of the following phases in a seven-phase C compiler will throw an error?

A

Lexical analyzer

B

Syntax analyzer

C

Semantic analyzer

D

Machine dependent optimizer



Ques 41 Programming and Data Structures


Consider the following ANSI C program.

What is the output of the above program?

A

14

B

20

C

24

D

30



Ques 42 Programming and Data Structures


Consider the following ANSI C function:

The value returned by SomeFunction(15, 255) is _______.


15 to 15 is the correct answer.


Ques 43 Programming and Data Structures


Consider the following ANSI C code segment:

Assume that the variable y points to a struct (allocated on the heap) containing two fields f1 and f2, and the local variables x, y, z, p, q, and i are allotted registers. Common sub-expression elimination (CSE) optimization is applied on the code. The number of addition and dereference operations (of the form y->f1 or y->f2) in the optimized code, respectively, are:

A

403 and 102

B

203 and 2

C

303 and 102

D

303 and 2



Ques 44 Programming and Data Structures


Consider the following ANSI C program.

The output of the program upon execution is _______.


60 to 60 is the correct answer.


Ques 45 Reasoning


A transparent square sheet shown above is folded along the dotted line. The folded sheet will look like

A

B

C

D



Ques 46 Reasoning


Listening to music during exercise improves exercise performance and reduces discomfort. Scientists researched whether listening to music while studying can help students learn better and the results were inconclusive. Students who needed external stimulation for studying fared worse while students who did not need any external stimulation benefited from music.
Which one of the following statements is the CORRECT inference of the above passage?

A

Listening to music has no effect on learning and a positive effect on physical exercise.

B

Listening to music has a clear positive effect both on physical exercise and on learning.

C

Listening to music has a clear positive effect on physical exercise. Music has a positive effect on learning only in some students.

D

Listening to music has a clear positive effect on learning in all students. Music has a positive effect only in some students who exercise.



Ques 47 Reasoning


A jigsaw puzzle has 2 pieces. One of the pieces is shown above. Which one of the given options for the missing piece when assembled will form a rectangle? The piece can be moved, rotated or flipped to assemble with the above piece.

A

B

C

D



Ques 48 Reasoning


Six students P, Q, R, S, T and U, with distinct heights, compare their heights and make the following observations.
Observation I: S is taller than R.
Observation II: Q is the shortest of all.
Observation III: U is taller than only one student.
Observation IV: T is taller than S but is not the tallest.
The number of students that are taller than R is the same as the number of students shorter than _______

A

T

B

R

C

S

D

P



Ques 49 Theory of Computation


Let L ⊆ {0,1}* be an arbitrary regular language accepted by a minimal DFA with k states. Which one of the following languages must necessarily be accepted by a minimal DFA with k states?

A

L - {01}

B

L ∪ {01}

C

{0,1}* - L

D

L. L



Ques 50 Theory of Computation


Let L1 be a regular language and L2 be a context-free language. Which of the following languages is/are context-free?

A

L1L2

B

L1L2

C

L1 ∪ (L2L2)

D

(L1 ∩ L2) ∪ (L1 ∩ L2)



Ques 51 Theory of Computation


Choose the correct choice(s) regarding the following propositional logic assertion S:
S: ((P ∧ Q) → R) → ((P ∧ Q) → (Q → R))

A

S is neither a tautology nor a contradiction.

B

S is a tautology.

C

S is a contradiction.

D

The antecedent of S is logically equivalent to the consequent of S.



Ques 52 Theory of Computation


Consider the following deterministic finite automaton (DFA).

The number of strings of length 8 accepted by the above automaton is _______.


256 to 256 is the correct answer.


Unique Visitor Count

Total Unique Visitors

Loading......