GATE 2019
65 questions
MCQ 41 · NAT 241-mark 30 · 2-mark 35
Questions 61–65 of 65
A relational database contains two tables Student and Performance as shown below:
The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together from the primary key. Consider the SQL query given below:
The primary key of the Student table is Roll_no. For the Performance table, the columns Roll_no. and Subject_code together from the primary key. Consider the SQL query given below:
SELECT S.Student_name, sum(P.Marks)
FROM Student S, Performance P
WHERE P.Marks > 84
GROUP BY S.Student_name;The number of rows returned by the above SQL query is _________ . Answer: 5
The query has no join condition. So FROM gives a cross product, and each student is paired with every row of Performance.
The WHERE condition Marks 84 keeps 5 rows of Performance, with marks 86, 95, 90, 89 and 92. Each of these rows is paired with all 5 students.
GROUP BY Student_name makes one row for each student name 5 rows.
Answer: 5
The WHERE condition Marks 84 keeps 5 rows of Performance, with marks 86, 95, 90, 89 and 92. Each of these rows is paired with all 5 students.
GROUP BY Student_name makes one row for each student name 5 rows.
Answer: 5
Consider the following C program:
#include <stdio.h>
int main() {
float sum = 0.0, j = 1.0, i = 2.0;
while (i / j > 0.0625) {
j = j + j;
sum = sum + i/j;
printf("%f \n", sum);
}
return 0;
} The number of times variable sum will be printed When the above program is executed is _________ .Answer: 5
i stays 2. j doubles each pass.
- i/j = 2 j = 2, print (1)
- i/j = 1 j = 4, print (2)
- i/j = 0.5 j = 8, print (3)
- i/j = 0.25 j = 16, print (4)
- i/j = 0.125 j = 32, print (5)
- i/j = 0.0625 is not 0.0625 stop
Answer: 5
- i/j = 2 j = 2, print (1)
- i/j = 1 j = 4, print (2)
- i/j = 0.5 j = 8, print (3)
- i/j = 0.25 j = 16, print (4)
- i/j = 0.125 j = 32, print (5)
- i/j = 0.0625 is not 0.0625 stop
Answer: 5
Consider the following C program:
#include <stdio.h>
int main() {
int a[] = {2, 4, 6, 8, 10};
int i, sum = 0, *b = a + 4;
for (i = 0; i < 5; i++ )
sum = sum + (*b - i) - *(b - i);
printf("%d\n", sum);
return 0;
} The output of above C program is __________ . Note: This was Numerical Type question.Answer: 10
Here b points to a[4], which is 10. Each loop pass adds this term:
- Step i = 0: 10 10 = 0
- Step i = 1: 9 8 = 1
- Step i = 2: 8 6 = 2
- Step i = 3: 7 4 = 3
- Step i = 4: 6 2 = 4
Adding all the terms, sum = 0 + 1 + 2 + 3 + 4 = 10
Answer: 10
- Step i = 0: 10 10 = 0
- Step i = 1: 9 8 = 1
- Step i = 2: 8 6 = 2
- Step i = 3: 7 4 = 3
- Step i = 4: 6 2 = 4
Adding all the terms, sum = 0 + 1 + 2 + 3 + 4 = 10
Answer: 10
In an RSA cryptosystem, the value of the public modulus parameter n is 3007. If it is also is known that , where denotes Euler's Totient Function, then the prime factors of n which is greater than 50 is _________ .
Answer: 97
We have n = pq and .
From this, and .
p and q are the roots of . Solving: the primes are 97 and 31.
Answer: 97
From this, and .
p and q are the roots of . Solving: the primes are 97 and 31.
Answer: 97
Consider the following relation P(X, Y, Z), Q(X, Y, T) and R(Y, V):
How many tuples will be returned by the following relational algebra query?
Answer:______
How many tuples will be returned by the following relational algebra query?
Answer:______
Answer: 1
Left part: The tuples of R with V = V2 are (Y3, V2) and (Y2, V2). In P, only (X2, Y2, Z2) has Y = Y2 {X2}.
Right part: The tuples of Q with T 2 are (X1, Y2, 5) and (X1, Y1, 6). Both Y2 and Y1 are present in R {X1}.
Now take {X2} {X1}. This gives {X2} 1 tuple.
Answer: 1
Right part: The tuples of Q with T 2 are (X1, Y2, 5) and (X1, Y1, 6). Both Y2 and Y1 are present in R {X1}.
Now take {X2} {X1}. This gives {X2} 1 tuple.
Answer: 1