GATE 2021 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2021 (Session 2)

64 questions

MCQ 33 · MSQ 13 · NAT 181-mark 29 · 2-mark 35

Questions 36–40 of 64

Q37Cache Memory2 marksMCQ−0.67 if wrong
Assume a two-level inclusive cache hierarchy, L1 and L2, where L2 is the larger of the two. Consider the following statements.

S1: Read misses in a write through L1 cache do not result in writebacks of dirty lines to the L2
S2: Write allocate policy must be used in conjunction with write through caches and no-write allocate policy is used with writeback caches.

Which of the following statements is correct?

Q38Finite Automata2 marksMCQ−0.67 if wrong
Suppose we want to design a synchronous circuit that processes a string of 0's and 1's. Given a string, it produces another string by replacing the first 1 in any subsequence of consecutive 1's by a 0. Consider the following example.

Input sequence:00100011000011100Output sequence:00000001000001100\begin{array}{ll} \text{Input sequence:} & 00100011000011100 \\ \text{Output sequence:} & 00000001000001100 \end{array}

A Mealy Machine is a state machine where both the next state and the output are functions of the present state and the current input.
The above mentioned circuit can be designed as a two-state Mealy machine. The states in the Mealy machine can be represented using Boolean values 0 and 1. We denote the current state, the next state, the next incoming bit, and the output bit of the Mealy machine by the variables s, t, b and y respectively.
Assume the initial state of the Mealy machine is 0.

What are the Boolean expressions corresponding to t and y in terms of s and b?

Q39Probability Theory2 marksMCQ−0.67 if wrong
In an examination, a student can choose the order in which two questions (QuesA and QuesB) must be attempted.

If the first question is answered wrong, the student gets zero marks.
If the first question is answered correctly and the second question is not answered correctly, the student gets the marks only for the first question.
If both the questions are answered correctly, the student gets the sum of the marks of the two questions.

The following table shows the probability of correctly answering a question and the marks of the question respectively.

questionprobabiloty of answering correctlymarksQuesA0.810QuesB0.520\begin{array}{c|c|c} \text{question} & \text{probabiloty of answering correctly} & \text{marks} \\ \hline \textsf{QuesA} & 0.8 & 10 \\ \textsf{QuesB} & 0.5 & 20 \end{array}

Assuming that the student always wants to maximize her expected marks in the examination, in which order should she attempt the questions and what is the expected marks for that order (assume that the questions are independent)?

Q40Intermediate Code Generation2 marksMCQ−0.67 if wrong
Consider the following ANSI C code segment:
 z=x + 3 + y-> f1 + y-> f2;
for (i = 0; i < 200; i = i + 2) 
{
    if (z > i) 
    {
        p = p + x + 3;
        q = q + y-> f1;
    } else 
    {
        p = p + y-> f2;
        q = q + x + 3;
    }
}
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 the dereference operations (of the form y -> f1 or y -> f2) in the optimized code, respectively, are:

Q41SQL2 marksMCQ−0.67 if wrong
The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

emp(empId‾, name, gender, salary, deptId)\textsf{emp($\underline{\textsf{empId}}$, name, gender, salary, deptId)}

Consider the following SQL query:
 select deptId, count(*)
from emp
where gender = "female" and salary > (select avg(salary)from emp)
group by deptId;
The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of