Quiz for Sudo GATE 2021

  • Last Updated : 18 Dec, 2020

Question 1
Which of the following choice(s) is/are correct ? Note - This question is multiple select questions (MSQ).
A
If a table has only one candidate key then table can not be in 2 NF.
B
A relation will be in 2NF if it is in 1NF and all non-key attributes are fully functional dependent on the primary key.
C
First Normal Form (1NF) does not eliminate redundancy, but rather, it’s that it eliminates repeating groups.
D
Relation should not have any attribute in Functional Dependency which is non-prime, the attribute that doesn’t occur in any candidate key.
Quiz for Sudo GATE 2021    
Discuss it


Question 1 Explanation: 
Only options (A), (B), and (C) are correct. Option (D) is false. Refer - Normalization Process in DBMS
Question 2
Which of the option(s) is/are correct ? Note - This question is multiple select questions (MSQ).
A
Relation R have attributes {a1, a2, a3,...,an} can have maximum number of super keys are 2(n-1)
B
Relation R have attributes {a1, a2, a3,... ,an} and the candidate key is “a1 a2 a3” then the possible number of super keys are 2(n-3).
C
A relation R(A, B, C, D, E, F, G, H) with set of functional dependencies {CH → G, A → BC, B → CFH, E → A, F → EG} has 120 superkeys.
D
The maximum number of superkeys for the relation schema R(E,F,G,H) with E as the key is 4.
Quiz for Sudo GATE 2021    
Discuss it


Question 2 Explanation: 
Only option (A) is false. Relation R have attributes {a1, a2, a3,...,an} can have maximum number of super keys are 2n-1. Refer - Number of possible Superkeys in DBMS
Question 3
Consider the following data for B-tree and B+ tree,
Block size is  8 KB,  
Data pointer is 10 B,  
Block pointer is of 15 B and 
key size is 10 B 
Which of the following option is correct ? Note - This question is multiple select questions (MSQ).
A
Maximum order of leaf node of B-tree is 230
B
Maximum order of leaf node of B+ tree (Q) is 405
C
Difference of maximum order of leaf node of B-tree (P) and maximum order of leaf node of B+ tree (Q) -175
D
All of these are correct.
Quiz for Sudo GATE 2021    
Discuss it


Question 3 Explanation: 
Given,
Block size = 8 KB,  
Data pointer or record pointer = Rp = 10 byte
Block pointer or child pointer = Bp = 15 byte
Key size/pointer = Kp = 10 byte 
Since, maximum order (P) of leaf node of B tree is given by formula:
P(Bp) + (P-1)*(Kp + Rp) ≤ Block size
P(15) + (P-1)*(10+10) ≤	8 KB
15P + 20P - 20 ≤ 8*1024
35P ≤ 8192+20
35P ≤ 8212
35P ≤ 8212/35
P ≤ 234.63
P = 234 
Take floor value for maximum. And, maximum order (Q) of leaf node of B+ tree is given by formula:
(Q-1)*(Kp + Rp) + (Bp) ≤ Block size
(Q-1)*(10+10) + 15 ≤ 8 KB
20Q - 20 + 15 ≤ 8*1024
20Q - 5 ≤ 8192
20Q ≤ 8192+5
Q ≤ 8197/20
Q ≤ 409.85
Q = 409 
Take floor value for maximum. Therefore P - Q = 234 - 409 = -175 So, only option (C) is correct.
Question 4
Consider the following statements regarding minimum number of table required in relational algebra for converting ER diagram with cardinality and participation. 1. If there are only Partial participations:
  • One-One: 2 Tables, Merge Relation to any of the side.
  • Many-One or One-Many: 2 Tables, Merge Relation to Many side.
  • Many-Many: 3 tables (separate table for relation)
2. Any one of the side has full participation:
  • Full participation on Many Side: 2 Tables
  • Full Participation on one side: 1 Table
3. Both Side full participations:
  • Always one table irrespective of Cardinality.
Note - This question is multiple select questions (MSQ).
A
Statement 1 is correct
B
Statement 2 is correct
C
Statement 3 is correct
D
All 1, 2, and 3 are false.
Quiz for Sudo GATE 2021    
Discuss it


Question 4 Explanation: 
According to minimization of ER diagram, and participation and cardinalities of given relations. 1. If there are only Partial participations:
  • One-One: 2 Tables, Merge Relation to any of the side.
  • Many-One or One-Many: 2 Tables, Merge Relation to Many side.
  • Many-Many: 3 tables (separate table for relation)
2. Any one of the side has full participation:
  • Full participation on Many Side: 2 Tables
  • Full Participation on one side: 1 Table
3. Both Side full participations:
  • Always one table irrespective of Cardinality.
So, all statements 1, 2, and 3 are correct.
Question 5
The following table has two attributes A and C where A is the primary key and C is the foreign key referencing A with on-delete cascade.
A   C
-----
4   6
5   6
6   5
7   4
9   4
11  7
8   6 
The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple (4,6) is deleted is: Note - This question is multiple select questions (MSQ).
A
(11, 7)
B
(7, 4)
C
(4,6)
D
(9, 4)
Quiz for Sudo GATE 2021    
Discuss it


Question 5 Explanation: 
When (4,6) is deleted. Since C is a foreign key referring A with delete on cascade, all entries with value 4 in C must be deleted. So (7, 4) and (9, 4) are deleted. As a result of this 7 and 9 are deleted from A which causes (11, 7) to be deleted. So, options (A), (B), and (D) are correct.
Question 6
A program is called reentrant if it can be interrupted in the middle of its execution, and then be safely called again ("re-entered") before its previous invocations complete execution. The interruption could be caused by an internal action such as a jump or call, or by an external action such as an interrupt or signal. Once the reentered invocation completes, the previous invocations will resume correct execution. Which of the following program(s) is/are reentrant ? Note - This question is multiple select questions (MSQ).
A
int t;

void swap(int *x, int *y)
{
    t = *x;
    *x = *y;

    // hardware interrupt might invoke isr() here!
    *y = t;
}

void isr()
{
    int x = 1, y = 2;
    swap(&x, &y);
}
B
int t;

void swap(int *x, int *y)
{
    int s;

    s = t; // save global variable
    t = *x;
    *x = *y;

    // hardware interrupt might invoke isr() here!
    *y = t;
    t = s; // restore global variable
}

void isr()
{
    int x = 1, y = 2;
    swap(&x, &y);
}
C
void swap(int *x, int *y)
{
    int t = *x;
    *x = *y;

    // hardware interrupt might invoke isr() here!
    *y = t;
}

void isr()
{
    int x = 1, y = 2;
    swap(&x, &y);
}
D
None of these
Quiz for Sudo GATE 2021    
Discuss it


Question 6 Explanation: 
Code given in option (A) of a swap() function that fails to be reentrant. Option (B) and (C) are correct.
Question 7
Consider following processes with their arrival time and burst time:
Process IDArrival TimeBust Time
P157
P229
P305
P403
P518
P61525
Which of the following option(s) is/are correct using preemptive shortest job first scheduling algorithm and all the time in nanoseconds. Note - This question is multiple select questions (MSQ).
A
Average waiting time is 9.66 ns
B
Completion time of process P2 is 32
C
Turn Round Time of process P5 is 22
D
Total Turn Round Time is 115
Quiz for Sudo GATE 2021    
Discuss it


Question 7 Explanation: 
Using preemptive shortest job first scheduling algorithm, Gantt chart will be Since, Turn Round Time = Completion time - arrival time, so
P1 = 15 - 5 = 10
P2 = 32 - 2 = 30
P3 = 8 - 0 = 8
P4 = 3 - 0 = 3
P5 = 23 - 1 = 22
P6 = 57 - 15 = 42 
Total Turn Round Time is 115. And, Waiting time = Turn around time - burst time, so
P1 =  10 - 7 = 3
P2 = 30 - 9 = 21
P3 = 8 - 5  = 3
P4 = 3 -3 = 0
P5 = 22 - 8 = 14
P6 = 42 - 25 = 17 
Process IDArrival TimeBust TimeTurn Arround TimeWaiting Time
P157103
P2293021
P30583
P40330
P5182214
P615254217
Hence,
Average waiting time  
= (3 + 21 + 3 + 14 + 17) / 6 = 9.66 ns 
So, all options are correct.
Question 8
Consider the virtual page reference string
1, 2, 3, 2, 4, 1, 3, 2, 4, 1 
On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Then Note - This question is multiple select questions (MSQ).
A
For FIFO: total no of page faults are 6
B
For optimal: total no of page faults are 5
C
For LRU: total no of page faults are 10
D
None
Quiz for Sudo GATE 2021    
Discuss it


Question 8 Explanation: 
Only option (A) and (B) are correct. Refer - GATE CS 2012 | Question 40
Question 9
A shared variable x, initialized to one, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing x to memory. Semaphore S is initialized to two. Which of the following set(s) has/have possible value of x after all processes complete execution? Note - This question is multiple select questions (MSQ).
A
{-2, -1, 0, 1, 2}
B
{-3, -2, -1, 0, 1, 2}
C
{-3, -2, -1, 0, 1, 2, 3}
D
{-4, -3, -2, -1, 0, 1, 2}
Quiz for Sudo GATE 2021    
Discuss it


Question 9 Explanation: 
Minimum possible value = -4 Maximum possible value = 2 So, option (A), (B), and (D) are correct. Refer - GATE CS 2013 | Question 65
Question 10
Consider the following system there are total 12 instances of resources A, 10 instances of resources B and 11 instances of resources C:
Process   Allocation        Maximum           
          A  B  C           A  B  C         
P0        0  2  3           3  3  6         
P1        2  4  2           2  5  3
P2        3  1  2           3  5  3
P3        5  2  2           6  5  4
If Banker's algorithm is applied for deadlock avoidance this system is in safe state. Which of the following option will be permitted with additional request? Note - This question is multiple select questions (MSQ).
A
Request: P3 - 1 instance of A, 2 instances of B, 3 instances of C
B
Request: P2 - 1 instance of A, 2 instances of B, 3 instances if C
C
Request: P1 - 1 instance of A, instances of B, 3 instances of C
D
Request: P0 - 1 instance of A, 2 instances of B, 3 instances of C
Quiz for Sudo GATE 2021    
Discuss it


Question 10 Explanation: 
Currently, the system is in the safe state. When addition requests are made: Available Instances are
A B C
2 1 2
Request: P3 - 1 instance of A, 2 instances of B, 3 instances of C Need matrix:
A B C
3 1 3
0 1 1
0 4 1
2 5 5
Since 2 instances of A, 1 instance of B, 2 instances of C. System is in safe state and start processing from P1. Request: P2 - 1 instance of A, 2 instances of B, 3 instances of C Need matrix:
A B C
3 1 3
0 1 1
1 6 4
1 3 2
Since 2 instances of A, 1 instance of B, 2 instances of C. System is in safe state and start processing from P1. Request: P1 - 1 instance of A, 2 instances of B, 3 instances of C Need matrix:
A B C
3 1 3
1 3 4
0 4 1
1 3 2
The system is unsafe. Since 2 instances of A, 1 instance of B, 2 instances of C. Request: P0 - 1 instance of A, 2 instances of B, 3 instances of C Need matrix:
A B C
3 3 6
0 1 1
0 4 1
1 3 2
Since 2 instances of A, 1 instance of B, 2 instances of C. System is in safe state and start processing from P1. So, request of option (C) will not be permitted. Option (A), (B), and (D) are correct.
There are 55 questions to complete.
My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.