• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 2021 | Set 2

Question 31

Suppose that P is a 4×5 matrix such that every solution of the equation Px=0 is a scalar multiple of [2 5 4 3 1]T. The rank of P is __________ .
  • 4
  • 5
  • 1
  • 2

Question 32

Suppose that f : R→R is a continuous function on the interval [−3,3] and a differentiable function in the interval (−3,3) such that for every x in the interval, f′(x)≤2. If f(−3)=7, then f(3) is at most __________ .

  • 19

  • 17

  • 22

  • 10

Question 33

Consider the string abbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties:
  • For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter.
  • For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a code whose length is at most the length of the code assigned to the other letter.
Among the set of all binary code assignments which satisfy the above two properties, what is the minimum length of the encoded string?
  • 21
  • 23
  • 25
  • 30

Question 34

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?
  • S1 is true and S2 is false
  • S1 is false and S2 is true
  • S1 is true and S2 is true
  • S1 is false and S2 is false

Question 35

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 : 00100011000011100
Output sequence : 00000001000001100 
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?
  • t = s+b y = sb
  • t = b y = sb
  • t = b y = sb\'
  • t = s+b y = sb\'

Question 36

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. 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)?
  • First QuesA and then QuesB. Expected marks 14
  • First QuesB and then QuesA. Expected marks 14
  • First QuesB and then QuesA. Expected marks 22
  • First QuesA and then QuesB. Expected marks 16

Question 37

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) 
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
  • employees in the department
  • employees in the company
  • female employees in the department
  • female employees in the company

Question 38

Let S be the following schedule of operations of three transactions T1, T2 and T3 in a relational database system:
R2(Y),R1(X),R3(Z),R1(Y)W1(X),R2(Z),W2(Y),R3(X),W3(Z) 
Consider the statements P and Q below:
  • P: S is conflict-serializable.
  • Q: If T3 commits before T1 finishes, then S is recoverable.
Which one of the following choices is correct?
  • Both P and Q are true
  • P is true and Q is false
  • P is false and Q is true
  • Both P and Q are false

Question 39

A bag has r red balls and b black balls. All balls are identical except for their colours. In a trial, a ball is randomly drawn from the bag, its colour is noted and the ball is placed back into the bag along with another ball of the same colour. Note that the number of balls in the bag will increase by one, after the trial. A sequence of four such trials is conducted. Which one of the following choices gives the probability of drawing a red ball in the fourth trial?
  • A
  • B
  • C
  • D

Question 40

Consider the following ANSI C program:

#include < stdio.h >
#include < stdlib.h >
struct Node{
int value;
struct Node *next;};
int main( ) {
struct Node *boxE, *head, *boxN; int index=0;
boxE=head= (struct Node *) malloc(sizeof(struct Node));
head → value = index;
for (index =1; index<=3; index++){
boxN = (struct Node *) malloc (sizeof(struct Node));
boxE → next = boxN;
boxN → value = index;
boxE = boxN; }
for (index=0; index<=3; index++) {
printf(“Value at index %d is %d\\n”, index, head → value);
head = head → next;
printf(“Value at index %d is %d\\n”, index+1, head → value); } }

Which one of the following statements below is correct about the program?

  • Upon execution, the program creates a linked-list of five nodes

  • Upon execution, the program goes into an infinite loop

  • It has a missing return which will be reported as an error by the compiler

  • It dereferences an uninitialized pointer that may result in a run-time error

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion