UGC NET Paper 2 Computer Science – December 2022 (Shift 1) – Question Paper with Answer Key
Solved by The Binary Brothers: every question has the correct answer and an explanation. Open any question for its full solution, or practice it in the unit-wise mock tests.
- ~P ∨ Q
- ~Q → ~P
- ~(P ∧ ~Q)
- ~Q → P
Seven people enter a lift. The lift stops only at three floors (which are unspecified). At each of the three floors, no one enters the lift, but at least one person leaves the lift. After the three floor stops, the lift is empty. In how many ways this can happen?
- 1844
- 2187
- 1806
- 343 x2y3z2
- C(7, 3) × C(5, 2)
- C(7, 2) × C(5, 3)
- C(7, 3) × C(7, 2)
- C(5, 3) × C(5, 2)
- 7
- 13
- 36
- 14
In 16-bit 2's Complementation representation, the decimal number 28 is
- 1111 1111 0001 1100
- 1111 1111 1111 0100
- 1111 1111 1110 0100
- 1111 1111 1110 0011
Simplify using a K-map: F(A, B, C, D) = Σ(3, 4, 5, 6, 7, 11, 15)
- AB + C′D
- A′B + CD
- AC + BD
- A′B + B′C
Consider a 3-bit counter designed using T flip-flops as shown (Tp = R, Tq = P′, Tr = Q′, all clocked together). If the initial state PQR is 000, what are the next three states?

- 011, 101, 000
- 001, 010, 111
- 011, 101, 111
- 001, 010, 000
- R1 = 1011 and R2 = 1110
- R1 = 1100 and R2 = 1010
- R1 = 0011 and R2 = 0100
- R1 = 1001 and R2 = 1111
In the context of Binding which one of the following is incorrect?
- Static binding is done at Compile Time
- Absolute addresses are known at Load Time
- Internal functions are known at link time
- Target of a function is known at runtime
Given int arr[3][4][2] = {{{2,4},{7,8},{3,4},{5,6}}, {{7,6},{3,4},{5,3},{2,3}}, {{8,9},{7,2},{3,4},{5,1}}}; which of the following can be used to refer to the element 1?
- arr[3][4][2]
- *(*(*(arr + 2) + 3) + 1)
- *(arr + 2) + *(arr + 3) + *(arr + 1)
- arr[2][3][2]
- Derived polymorphism
- Compile-time polymorphism
- Static polymorphism
- Run-time polymorphism
- B-spline curve
- Boxline curve
- Bezier curve
- Gaussian curve
- difference
- union
- cartesian product
- project
- {P, Q, R, S}
- {R, Q, X}
- {V, X}
- None of the above
- Level 0
- Level 1
- Level 2
- Level 3
If we convert a decision tree to a set of logical rules, then:
- The internal nodes in a branch are connected by AND and branches by AND
- The internal nodes in a branch are connected by OR and branches by OR
- The internal nodes in a branch are connected by AND and branches by OR
- The internal nodes in a branch are connected by OR and branches by AND
Model of protection can be viewed as
- Owner matrix
- Domain matrix
- Access Matrix
- Global matrix
Process in memory also contain the heap section. What is the use of heap section?
- Contains temporary data
- Dynamically allocate the memory during process run time
- Contains Process priority and pointers to scheduling queues
- Contains amount of CPU and real time use
How many page faults occur for optimal algorithm for the following reference string, with four frames? 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8
- 8
- 7
- 6
- 5
Degree of concurrency in thread can be arranged in the manner. > >
- one-to-one many-to-one many-to-many > >
- one-to-one many-to-many many-to-one >
- many-to-many > many-to-one one-to-one
- None of the above
Which of the following is not one of the principles of good coding?
- Create unit tests before you begin coding.
- Create visual layout that aids understanding.
- Refractor the code after you completes the first coding pass.
- Write self-documenting code not program documentation.
If P is the risk probability, L is the loss, then Risk exposure (RE) is computed as ______
- R E=P / L
- R E=P+L
- R E=P * L RE = 2 + (P ∗L)
- Black-box wrapping
- Clear-box wrapping
- Gray-box wrapping
- White-box wrapping
The cyclomatic complexity metric provides the designer with information regarding the number of -____
- Cycles in the program
- Errors in the program
- Independent logic paths in the program
- Statements in the program a
- Balanced binary tree
- Weight-balanced binary tree
- Height-balanced tree
- Unbalanced binary tree
- Encryption, time
- Encryption, frequency
- Compression, time
- Compression, frequency
Given six weights 4, 15, 25, 5, 8, 16, construct a 2-tree (binary tree). What is the minimum weighted path length?
- 231
- 172
- 73
- 77 n
- greater than 1/5
- greater than 1/2
- less than 1/2
- less than 1/5
In Pumping Lemma for context-free languages, to say a language is satisfying pumping lemma, vx what is the minimum length of ' ' together, if you consider the string as 'uvwxy'?
- 0
- 1 n
- 2
- ε
While processing a string by an LR parser, the reading of the given string by the parser is-
- From right to left
- From left to right
- Can be either from left to right or right to left
- From the centre of the given string
What is the minimum and maximum number of initial, dead, unreachable and final states in a n valid ' ' state finite automaton, where the φ language accepted is not ' '?
- Minimum 1, 1, 1, 1; Maximum 1, n − 1, n − 1, n
- Minimum 1, 0, 0, 0; Maximum 1, n − 1, n − 1, n
- Minimum 1, 0, 0, n; Maximum 1, n, n − 1, n − 1
- Minimum 1, 0, 0, 1; Maximum 1, n − 1, n − 1, n
Which protocol is used to acquire the MAC Address of a host whose IP address is known?
- Dynamic Host control protocol
- Address Resolution Protocol
- Reverse Address Resolution Protocol
- User Datagram Protocol
In CRC coding if the data word is 111111 , divisor is 1010 and the remainder is 110 . Which of the following code is true?
- 011111101
- 001010110
- 111111110
- 110111111 S
In Go-back-N protocol, the values of f (Send = 3, S window, the first outstanding packet) n (Send window, the next packet to be send) =7, after receiving the packet with AckNo.6, the S value of n is _____
- 6
- 7
- 5
- 4
- S
- S + 1
- 1
- 0
Which search technique is complete and optimal, h(n) when is consistent?
- Best First Search
- Depth First Search A∗
- Search
- Breadth First Search
What is the process of capturing inference process as a single inference rule?
- Ponens
- Clauses
- Generalized modus ponens
- Variables
Fuzzy logic is a form of ____
- Two valued logic
- Crisp set logic
- Binary set logic
- Many valued logic 4 Ws
The problem canvas helps in identifying 4 Ws the key elements related to the problem. problem canvas is a part of ____
- Problem scoping
- Data acquisition
- Data modeling
- Problem Evaluation
Consider: A. A group can have zero elements. B. A group cannot have any idempotent element except the identity. C. An isomorphism from a group ⟨G, *⟩ to ⟨G, *⟩ is called an automorphism. D. If every element in a group is its own inverse, the group must be abelian.
- B,C and D are correct
- Only A and C are correct
- Only B and C are correct
- All A, B, C and D are correct.
Consider: A. The number of labelled binary trees possible with n nodes is (2n)!/(n + 1)!. B. The number of binary search trees possible with n nodes is (2n)!/((n + 1)! n!). C. The number of unlabelled binary trees possible with n nodes is C(2n, n)/(n + 1)!. D. The number of simple, undirected, labelled graphs possible with n vertices is 2^(n(n−1)/2).
- (A, B) and (C) are only correct
- (A, B) and (D) are only correct
- (B, C) and (D) are only correct
- (A, C) and (D) are only correct
The relation R = {(1, 3), (1, 1), (3, 1), (1, 2), (3, 3), (4, 4)} {1, 2, 3, 4} defined in is ____
- Reflexive, Symmetric but not Transitive
- Symmetric, anti-symmetric and transitive
- Asymmetric, anti-symmetric and not transitive
- Not reflexive, not symmetric and not transitive
Consider F = (X + Y + Z)(X′ + Y)(Y′ + Z). Which of the following are equivalent to F′? A. (X′ + Y′ + Z′)(X + Y′)(Y + Z′) B. XY′ + Z′ C. (X + Z′)(Y′ + Z′) D. XY′ + YZ′ + X′Y′Z′
- A, B and C Only
- B, C and D Only
- A, C and D Only
- A, B and D Only
Which of the following statement is/are True?
A. The processor has direct access to both primary and secondary memory
B. Primary memory stores the active instructions and data for the program being executed on the process
C. Secondary memory is used as a backup memory
D. Memory system is implemented on a single level memory
- A and B only
- B and C only
- A, B and C only
- A and D Only
A. Shared interfaces
B. Run-time polymorphism
C. Less redundant information
D. Dynamic binding
Choose the correct answer from the options given below:
- A, B, C only
- A, B, D only
- B, C, D only
- A, C, D only
Which of the following is correct using the constructor?
A. string s1;
B. string s2 (s1);
C. string s3{7};
D. string s4{'a'};
E. string s5{7, 'a'};- A, B, D, E only
- A, B, C only
- A, B, D only
- A and B only
Suppose that a corporate website appearance varies according to the department that owns various documents. All the documents need to follow the corporate look and feel. The HR department does not need a separate style sheet. It needs only the sheet containing the difference from the corporate sheet. Which of the following statements justify the above scenario?
A. The styles sheets cannot stack on each other
B. The style sheets can stack on each other
C. The style sheets can override each other
D. The style sheets cannot override each other
Choose the most appropriate answer from the options given below:
- A, C Only
- B, C Only
- B, D only
- A, D only
Let T1 transfer ₹50 from account A to account B: 1 Read(A); 2 A := A − 50; 3 Write(A); 4 Read(B); 5 B := B + 50; 6 Write(B). What is the state of the database just after step 3 but before step 5?
- Always consistent
- May be temporarily inconsistent
- Must be abort
- Always rollback
Consider the relation Student(stuid, dept, clsroll) with FDs: FD1: stuid → dept, FD2: dept → stuid, FD3: stuid → clsroll, FD4: clsroll → stuid, FD5: dept → clsroll. Which FDs can be removed to obtain a canonical cover? A. FD2 and FD3 B. FD1 and FD5 C. FD5 D. FD1
- A, B only
- A, C only
- B, C only
- A, B, C only
A. If the time quantum is extremely small, round robin can result in a large number of context switches.
B. The average turnaround time of a set of processes does not necessarily improve as the time-quantum size increases.
C. The average turnaround time can be improved if most processes finish their next CPU burst in a single time quantum.
Choose the correct answer from the options given below:
- A only
- A, B only
- B, C only
- A, B, C
Consider processes A (arrival 0, burst 6), B (3, 2), C (5, 4), D (7, 6), E (10, 3), times in ms. Using shortest remaining time first scheduling, the average turnaround time is
- 7.2
- 8.2
- 6
- 9
A. A page-replacement algorithm is used if there is no free frame
B. The process is continued by restarting the instruction that caused the trap
C. The location of the desired page is found on disk
D. The desired page is brought into the newly freed frame and the page and frame tables are updated
- A, B, D, C
- C, D, A, B
- C, A, D, B
- A, D, B, C
Given below are two statements:
Statement I: Software testing must be recognized as a significant effort, and its planning must begin at the earliest possible time.
Statement II: The cost of software testing is an important contribution in determining overall software development costs. In the light of the above statements, choose the correct answer from the options given below
- Both Statement I and Statement II are true.
- Both Statement I and Statement II are false.
- Statement I is true but Statement II is false.
- Statement I is false but Statement II is true.
A. Algorithmic performance
B. Number of lines of code
C. Error handling
D. Execution paths
Choose the correct answer from the options given below:
- A, B, C only
- A, B, D only
- A, C, D only
- B, C, D only
A. LL rotation: the new node is inserted in the left subtree of the left subtree of the critical node.
B. RR rotation: the new node is inserted in the right subtree of the right subtree of the critical node.
C. LR rotation: the new node is inserted in the right subtree of the left subtree of the critical node.
D. RL rotation: the new node is inserted in the left subtree of the right subtree of the critical node.
Choose the correct answer from the options given below:
- A, D only
- A, C Only
- A, B, C and D
- B, C Only
Which of the following are correct about Hamiltonian problems? A. The Hamiltonian cycle problem is NP-complete. B. If G is an undirected bipartite graph with an odd number of vertices, then G is Hamiltonian. C. The Hamiltonian path problem cannot be solved in polynomial time on a directed acyclic graph. D. If G is a connected undirected graph with at least three vertices, then G³ (obtained by connecting all pairs of vertices joined by a path of length at most 3 in G) is Hamiltonian. E. If any NP-complete problem is polynomial-time solvable, then P = NP.
- A, B, C only
- B, D, E only
- A, D, E only
- A, C, E only
For matrix multiplication with a simple divide-and-conquer algorithm: A. the running time is T(n) = Θ(n³) B. the running time is T(n) = Θ(n² log n) C. the recurrence is T(n) = 8T(n/2) + Θ(n²) D. the recurrence is T(n) = 8T(2n) + Θ(n² log n) E. one of the cases of the master theorem applies
- A, C, E only
- A, D, E only
- B, D, E only
- B, C, D only
Which of the following finite automata recognize L = {a, b}*? (Transition tables A–D are shown; in each, the start state q0 is accepting.)
- A and B
- A and D
- A, B and C
- A, B, C and D
A. Syntax-directed translation can be applied in type checking.
B. Syntax-directed translation can be used in 3-address code generation.
C. Syntax-directed translation can be used in the construction of syntax trees.
D. Syntax-directed translation can be used to recognise valid tokens.
Choose the most appropriate answer from the options given below:
- A, B and C
- A, B, and D
- A, C and D
- B, C and D
Consider a computer network using the distance vector routing algorithm in its network layer. The Objective is to find the shortest cost path from router R to routers P and Q. Assume that R does not initially know the shortest routes to P and Q. R Assume that has three neighboring routers, X, Y Z R namely: and . During one iteration measures its distance as 3,2 , and 5 from its X, Y Z R neighbors and , respectively. Router getting routing vectors from its neighbors that indicates a distance of 7,6 and 5 from router X, Y Z P and to router , respectively. The routing vector also indicates that the distance to Q X, Y Z router from Routers and are 4, 6, 8 respectively. Which of the following statements is/are Ture with respect to the new routing table R at router after updation during this iteration. R P
A. The distance from to will be stored as 10 R Q
B. The distance from to will be stored as 7 R P
C. The next hop router for a packet from to Y is R Q
D. The next hop router for a packet from to Z is
Choose the correct answer from the options given below:
- B and C only
- A and C only
- C and D only
- B and D only
An organization's routing table has: 12.20.164.0/255.255.252.0 → R1; 12.20.170.0/255.255.254.0 → R2; 12.20.168.0/255.255.254.0 → Interface 0; 12.20.166.0/255.255.254.0 → Interface 1; default → R3. Which prefixes can be used together to aggregate all these subnets? A. 12.20.164.0/20 B. 12.20.164.0/22 C. 12.20.164.0/21 D. 12.20.168.0/22
- A and B Only
- A and C Only
- C and D Only
- B and D Only
Consider two hosts P and Q are connected through a router (R). The maximum transfer unit (MTU) value of the link between (P) and (R) is 1500 bytes and between (R) and (Q) is 820 bytes. A TCP segment of size 1400 bytes is transferred from P to Q through R with IP identification value of 0×1234. Assume that IP header size is 20 bytes. Further, the packet is allowed to be fragmented, meaning the Don't Fragment (DF) flag in the IP Header is not set by P. Which of the following statements is/are not true?
A. Two fragments are created at (R) and IP datagram size carrying the second fragment is 620 bytes
B. If the second fragment is lost then (R) resend the fragment with IP Identification value of 0×1234
C. If the second fragment is lost then P is required to resend the entire TCP segment
D. TCP destination port can be determined by analyzing the second fragment only
Choose the correct answer from the options given below:
- A and B Only
- A and C Only
- C and D Only
- B and D Only
Consider the following features of Neural networks.
A. It is essentially a machine learning algorithm.
B. It is useful when solving the problems for which the data set is very large.
C. They are able to extract features without input from the programmer.
D. These are systems modeled on the human brain and nervous system.
- A Only
- A & B Only
- A, B & C Only
- A, B, C & D
Consider the following draw backs is/are of Rule based approach is/are:
A. The learning is static.
B. Any changes made to the original data will not be considered.
C. Once trained the model cannot improve on the basis of feedback.
- All the above statements are correct
- The statements A & B only are not correct
- The statements B & C only are not correct
- All the above statements are not correct
Match List I with List II

- A-IV; B-III; C-I; D-II
- A-III; B-IV; C-II; D-I
- A-II; B-IV; C-I; D-III
- A-III; B-IV; C-I; D-II
Match List I with List II

- A-IV, B-II, C-I, D-III
- A-IV, B-III, C-II, D-I
- A-IV, B-II, C-III, D-I
- A-III, B-IV, C-II, D-I
Match List I with List II

- A-I, B-III, C-II, D-IV
- A-III, B-I, C-IV, D-II
- A-III, B-I, C-II, D-IV
- A-I, B-II, C-IV, D-III
Match List I with List II

- A-III, B-IV, C-II, D-I
- A-III, B-IV, C-I, D-II
- A-IV, B-III, C-II, D-I
- A-IV, B-II, C-I, D-III
Match List I with List II

- A-II, B-I, C-III, D-IV
- A-II, B-I, C-IV, D-III
- A-III, B-I, C-II, D-IV
- A-III, B-I, C-IV, D-II
Match List I with List II

- A-II, B-III, C-IV, D-I
- A-III, B-I, C-IV, D-II
- A-IV, B-I, C-II, D-III
- A-III, B-IV, C-I, D-II
Match List I with List II

- A-I, B-II, C-III, D-IV
- A-I, B-IV, C-II, D-III
- A-IV, B-I, C-II, D-III
- A-II, B-III, C-IV, D-I
Match List I with List II

- A-III, B-IV, C-I, D-II
- A-III, B-II, C-I, D-IV
- A-II, B-III, C-IV, D-I
- A-II, B-IV, C-I, D-III
Match List I with List II

- A-III, B-II, C-I, D-IV
- A-II, B-III, C-I, D-IV
- A-III, B-I, C-II, D-IV
- A-II, B-IV , C-I , D-III
Match List I with List II

- A-I , B-II, C-I , D-II
- A-II, B-II, C-I, D- II
- A-I , B- II, C-II, D-I
- A-II , B- II , C-II , D-I
- k(n − 1)
- n(k − 1)
- n + k − 2
- n − k
The sequence of events that happen during a typical fetch operation is/are:
A. Memory
B. MBR
C. MAR
D. PC
E. IR
Choose the correct order from the options given below:
- A, B, C, D, E
- D, C, A, B, E
- E, D, C, B, A
- D, C, A, E, B
A. Merge sort
B. Linear search
C. Bubble sort
D. Binary search
Choose the correct answer from the options given below:
- D, B, A, C
- B, D, A, C
- B, D, C, A
- B, A, D, C
Consider the schedule S: t1: R2(X), R3(Y); t2: W2(X), W3(Y); t3: R1(Y), R4(X); t4: W1(Y), W4(X); t5: R3(X); t6: W3(X). Choose the correct serial execution order equivalent to S.
- T3-T2-T1-T4
- T2-T3-T1-T4
- T2-T4-T3-T1
- T4-T2-T3-T1
A disk has 300 cylinders ( 0 to 299 ). If the initial position of the read-write head is at cylinder 101 , moving towards the higher end of the disk, calculate the total head movement following C_LOOK policy for the read request sequence: 123, 45, 197, 87, 250, 198, 280
- 456
- 450
- 458
- 445
- A reasonable approach when requirements are well defined.
- A good approach when a working core product is required quickly.
- The best approach to use for projects with large development teams.
- A revolutionary model that is not used for commercial products.
Consider the graph given below. What is the order in which the nodes mentioned in the options are to be traversed to find the shortest path from A to Z using best first search?

A. Node-A
B. Node-B
C. Node-C
D. Node-D
E. Node-E
Choose the correct answer from the options given below:
- A → C → F → D → E
- A → C → E → B
- A → C → F → E → B
- A → C → D → F
- Star, Concatenation, Union
- Union, Star, Concatenation
- Union, Concatenation, Star
- Star, Union, Concatenation
Arrange the following in the correct order which respect to key generation for RSA algorithm. 1 < e < λ
A. Choose an integer e such that (n) n = p∗q
B. Compute Key length d 1/e
C. Find which is equal to p q
D. Choose two large prime numbers and λ(n)
E. Compute
Choose the correct answer from the options given below:
- A-B-C-D-E
- D-C-B-E-A
- D-B-E-A-C
- A-B-D-E-C
Which of the following is related to function of layers in a neural network? → →
A. Information Input layer Hidden layer → →
B. Bias output layer hidden layer. → →
C. Hidden layer algorithm output layer. → →
D. Input layer output layer algorithms.
- Only sequence ' A ' is correct.
- Only sequence ' B ' is correct.
- Only sequence ' C' is correct.
- Only sequence ' D ' is correct.
Given below are the two statements:
Statement I: The main objective for using virtual memory is to increase the effective capacity of the memory system
Statement II : The size of virtual memory can be larger than the main memory In the light of the above statements, choose the correct answer from the options given below
- Both Statement I and Statement II are true.
- Both Statement I and Statement II are false.
- Statement I is true but Statement II is false.
- Statement I is false but Statement II is true.
Given below are the two statements:
Statement I : Any retrieval request that is specified in the basic relational algebra can also be specified in relational calculus.
Statement II : Any retrieval request that is specified in the relational calculus can also be specified in basic relational algebra. In the light of the above statements, choose the correct answer from the options given below:
- Both Statement I and Statement II are true.
- Both Statement I and Statement II are false.
- Statement I is true but Statement II is false.
- Statement I is false but Statement II is true.
The primary objectives of the SWE-IPT are to:
A. Solicit stakeholder needs and expectations.
B. Specify the software requirements for the product and post-development processes.
C. Generate the integrated technical plans for accomplishing the software development effort.
D. Translate stakeholder requirements into a complete, specified architectural description.
E. Ensure that the software technical data package is sufficiently detailed to facilitate an efficient and effective software implementation.
- All the statements are correct.
- Only B & C are correct.
- Only A & E are correct.
- Only C, D & E are correct.
Consider the following statements:
(A) For every regular language, we can design Turing Machine
(B) For every context free language, we can design Turing Machine Which of the following is correct?
- Statement-A is false and Statement-B is true.
- Statement-A and Statement-B both are false. B
- Statement-A is true and Statement- is false.
- Statement-A and Statement-B both are true.
Given below are two statements: one is labelled as Assertion A and the other is labelled as
Reason R. A: Artificial Neural Networks are the backbone of deep learning algorithms. R. Back propagation is one of the techniques used to train an ANN. In the light of the above statements, choose the most appropriate answer from the options given below:
- Both A and R are correct and R is the correct explanation of A.
- Both A and R are correct but R is NOT the correct explanation of A.
- A is correct but R is not correct.
- A is not correct but R is correct. Directions (91-95) Read the following passage and answer the given questions. Read the passage carefully and answer the question that follows For a knapsack problem,P and W are profits and weights for a set of 7 items as given below: P = {9, 5, 2, 7, 6, 16, 9} W = {2, 5, 6, 11, 1, 9, 3}
Directions (Q91–95): For a knapsack problem, P and W are the profits and weights of a set of 7 items:
P = {9, 5, 2, 7, 6, 16, 9}
W = {2, 5, 6, 11, 1, 9, 3}
- 43
- 40
- 45
- 44
Directions (Q91–95): For a knapsack problem, the profits and weights of 7 items are P = {9, 5, 2, 7, 6, 16, 9} and W = {2, 5, 6, 11, 1, 9, 3}.
What is the maximum value of items you can carry if maximum weight allowed is 25 with a fractional knapsack?
- 48.1
- 49
- 47.9
- 40 (P = 5, W = 2)
If new item is added to the list, total items is 8 and capacity is 25 , then the best-case time of fractional knapsack for this case is _____
- O(8)
- O(64)
- O(24)
- O(56)
- Divide and Conquer
- Dynamic Programming
- Greedy Algorithm
- Backtracking
Which of the following statements is correct for a knapsack?
- 0/1 knapsack can be applied for all kinds of problems but fractional knapsack can be applied only if the problem meets certain conditions.
- There is no difference between the two. They give the same solution for any problem.
- We use the greedy algorithm for 0 / 1 knapsack and dynamic programming for fractional knapsack.
- In 0/1 knapsack problem, items cannot be divided into smaller portions and in fractional knapsack we can divide the item into required proportions of weight. Directions (96-100) Read the following passage and answer the given questions. Use the following schema of the academic institution relational database: student (rollno, name, degree, year, sex, deptno, advisor) department (deptid, name, hod, phone) professor (empid, name, sex, startyear, deptno, phone) course (courseid cname, credits, deptno) enrollment (rollno, courseid, sem, year, grade) teaching (empid, courseid, sem, year, classroom) prerequisite (precourseid, courseid) deptno is foreign key in the student, professor and course relations referring to deptid of department relation; advisor is a foreign key in the student relation referring to empid of professor relation; hod is a foreign key in the department relation referring to empid of professor relation; rollno is a foreign key in the enrollment relation referring to rollno of student relation; courseid is a foreign key in the enrollment, teaching relations referring to courseid of course relation; empid is a foreign key of the teaching relation referring to empid of professor relation; precourseid and courseid are foreign keys in the prerequisite relation referring to courseid of the course relation;
Directions (Q96–100): Academic database schema: student(rollno, name, degree, year, sex, deptno, advisor); department(deptid, name, hod, phone); professor(empid, name, sex, startyear, deptno, phone); course(courseid, cname, credits, deptno); enrollment(rollno, courseid, sem, year, grade); teaching(empid, courseid, sem, year, classroom); prerequisite(precourseid, courseid). deptno in student, professor and course refers to department.deptid; advisor refers to professor.empid; hod refers to professor.empid; enrollment.rollno refers to student.rollno; courseid in enrollment and teaching refers to course.courseid; teaching.empid refers to professor.empid; precourseid and courseid in prerequisite refer to course.courseid.
Which of the following queries would retrieve the roll number and names of students who have enrolled for all the prerequisite courses of the course number 324 ?
- Select s.rollno, s.name From student s, enrollment e Where e.rollno = s.rollno and e.courseid = ANY (select precourseid from prerequisite p where p.courseid = "324")
- Select s.rollno, s.name From student s, enrollment e Where e.rollno =s.rollno and e.courseid = ALL (select precourseid from prerequisite p where p.courseid = "324")
- Select s.rollno, s.name From student s Where NOT EXISTS (select * prerequisite p where p.courseid = " 324 ") and NOT EXISTS (select * from enrollment e where e.courseid = p.precourseid and e.rollno = s.rollno))
- Select s.rollno, s.name From student s Where EXISTS (select * prerequisite p where p.courseid = "324") and EXISTS (select * from enrollment e where e.courseid = p.precourseid and e.rollno = s.rollno))
Given query: select s.rollno from students where s.sex = ALL (select f.sex from professor f where f.empid = s.advisor). Consider the following statements about the given query that retrieves the set of all students whose gender is same as the gender of their advisor: S1. It has a correlated subquery S2. It has an uncorrelated subquery S3. If we replace ALL by ANY in the above query, its result will be different S4. If we replace ALL by ANY in the above query, its result will be same. Identify all the statement that are TRUE:
- S1 and S3 are true
- S1 and S4 are true
- S2 and S3 are true
- S2 and S4 are true
Which of the following queries would compute, for each department, the total credits of all the courses offered by the department?
- select deptid, name, sum(credits) as totalcredits from department, course where deptid=deptno group by deptid, name;
- select deptid, name, count(credits) as totalcredits from department, course where deptid=deptno
- group by deptid, name; select deptid, name, sum(credits) as totalcredits from department, course
- select deptid, name, sum(credits) as totalcredits from department, course group by deptid, name having deptid=deptno;
Which of the following queries would retrieve the dept id and name of all the departments that are such that the total of the credits of all the offered courses by the department is strictly greater than 40 ?
- select deptid, name, sum(credits) as totalcredits from department, course where totalcredits >40 group by deptid, name having deptid = deptno;
- select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno and totalcredits >40 group by deptid, name;
- select deptid, name, sum(credits) as totalcredits from department, course group by deptid, name having deptid = deptno and totalcredits >40
- select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno group by deptid, name having totalcredits >40
Given query: select s.rollno, s.name from student s where EXISTS (select c.courseid from course c Where c.deptno =5 and EXISTS (select e.* from enrollment e where e.courseid = c.courseid and e.rollno = s.rollno)); Which one of the following statements is correct with respect to the given query?
- It retrieves the roll number and names of students who have not enrolled for all course offered by department number 5 .
- It retrieves the roll number and names of students who have enrolled for all course offered by department number 5 .
- It retrieves the roll number and names of students who have enrolled for at least one course offered by department number 5
- It retrieves the roll number and names of students who are such that there exists at least one course offered by department number 5 which is not enrolled by the student.
Answer key
- 1 – D
- 2 – C
- 3 – B
- 4 – C
- 5 – C
- 6 – B
- 7 – A
- 8 – B
- 9 – C
- 10 – B
- 11 – D
- 12 – C
- 13 – B
- 14 – A
- 15 – B
- 16 – C
- 17 – C
- 18 – B
- 19 – A
- 20 – B
- 21 – D
- 22 – C
- 23 – B
- 24 – C
- 25 – D
- 26 – D
- 27 – B
- 28 – C
- 29 – B
- 30 – B
- 31 – B
- 32 – D
- 33 – B
- 34 – C
- 35 – B
- 36 – B
- 37 – C
- 38 – C
- 39 – D
- 40 – A
- 41 – A
- 42 – B
- 43 – D
- 44 – B
- 45 – B
- 46 – C
- 47 – A
- 48 – B
- 49 – B
- 50 – B
- 51 – D
- 52 – A
- 53 – C
- 54 – A
- 55 – B
- 56 – C
- 57 – C
- 58 – A
- 59 – D
- 60 – A
- 61 – A
- 62 – D
- 63 – D
- 64 – D
- 65 – A
- 66 – B
- 67 – B
- 68 – B
- 69 – B
- 70 – D
- 71 – B
- 72 – C
- 73 – B
- 74 – C
- 75 – B
- 76 – D
- 77 – B
- 78 – A
- 79 – C
- 80 – A
- 81 – B
- 82 – A
- 83 – C
- 84 – C
- 85 – A
- 86 – A
- 87 – A
- 88 – A
- 89 – D
- 90 – B
- 91 – B
- 92 – A
- 93 – C
- 94 – C
- 95 – D
- 96 – C
- 97 – A
- 98 – A
- 99 – D
- 100 – C