GATE 2015 (Session 1)
65 questions
MCQ 45 · NAT 201-mark 30 · 2-mark 35
Questions 31–35 of 65
SELECT operation in SQL is equivalent to
Answer: (D)
In SQL, the SELECT list picks columns. This is the same as projection in relational algebra. The difference is that SQL does not remove duplicate rows unless DISTINCT is written.
Answer: the projection operation, except that SELECT in SQL retains duplicates
Answer: the projection operation, except that SELECT in SQL retains duplicates
A file is organized so that the ordering of data records is the same as or close to the ordering of data entries in some index. Then that index is called
Answer: (C)
If the records in the data file are kept in the same order as the index entries, or very close to it, then the index is a clustered index.
Answer: Clustered
Answer: Clustered
In the LU decomposition of the matrix , if the diagonal elements of U are both 1, then the lower diagonal entry of L is________.
Answer: 5
Given the product of L and U:
With the diagonal of U equal to 1:
This must equal A:
Multiplying and comparing entries, first row:
Solving,
First column:
Second row, second column:
Solving,
With the diagonal of U equal to 1:
This must equal A:
Multiplying and comparing entries, first row:
Solving,
First column:
Second row, second column:
Solving,
The output of the following C program is__________.
void f1(int a, int b) {
int c;
c=a; a=b; b=c;
}
void f2(int *a, int *b) {
int c;
c=*a; *a=*b; *b=c;
}
int main(){
int a=4, b=5, c=6;
f1(a,b);
f2(&b, &c);
printf("%d",c-a-b);
}Answer: -5
Go through each call:
- f1 gets only copies (call by value), so a = 4 and b = 5 do not change.
- f2 swaps using pointers, so b = 6 and c = 5.
c a b = 5 4 6 = 5
Answer: -5
- f1 gets only copies (call by value), so a = 4 and b = 5 do not change.
- f2 swaps using pointers, so b = 6 and c = 5.
c a b = 5 4 6 = 5
Answer: -5
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Answer: (B)
In the worst case a BST is skewed, so it becomes a chain with height n 1. Then both insertion and deletion may have to travel along the whole chain.
Answer: for both insertion and deletion
Answer: for both insertion and deletion