U.G.C. NET Exam. December 2022 Paper-II (COMPUTER SCIENCE) and Applicatations.Total Questions: 10091. Which of the following queries would retrieve the roll number and names of students who have enrolled for all the prerequisite course of the course number 324?(a) Select s.rollno, s.name From student s, enrollment e Where e.rollno = s.rollno and e.courseid = ANY(select precouseied from prerequisite p where p.courseid = "324")(b) Select s.rollno, s.name From student s, enrollment e Where e.rollno = s.rollno and e.courseid = ALL(select precouseied from prerequisite p where p.courseid = "324")(c) 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.precoursied and e.rollno = s.rollno.)(d) 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.precoursied and e.rollno = s.rollno.)Correct Answer: (c) 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.precoursied and e.rollno = s.rollno.)Solution:The correct query to retrieve the roll number and name of students who have enrolled for all the prerequisite courses of the course number 324. C. 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.precoursied and e.rollno = s.rollno.)92. 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 :(a) S1 and S3 are true(b) S1 and S4 are true(c) S2 and S3 are true(d) S2 and S4 are trueCorrect Answer: (b) S1 and S4 are trueSolution:The correct query to retrieves the set of all students whose gender is same as the gender of their advisor : S1. It has a correlated subquery S4. If we replace ALL by ANY in the above query, its result will be same. So option (b) is correct.93. Which of the following queries would compute, for each department, the total credits of all the courses offered by the department?(a) select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno group by deptid, name;(b) select depid, name, count(credits) as totalcredits from department, course where deptid=deptno group by deptid, name;(c) select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno(d) select depid, name, sum(credits) as total credits from department, course group by deptid, name having deptid = deptno;Correct Answer: (a) select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno group by deptid, name;Solution:The correct query to 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.94. Which of the following queries would retrieve the dept id and name of the all departments that are such that the total of the credits of all the offered courses by the department is strictly greater than 40?(a) Select deptid, name, sum(credits) as totalcredits from department, course where totalcredits > 40 group by deptid, name having deptid = deptno.(b) Select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno and totalcredits > 40 group by deptid, name(c) Select deptid, name, sum(credits) as totalcredits from department, course group by deptid, name having deptid = deptno and totalcredits > 40;(d) Select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno group by deptid, name having totalcredits > 40Correct Answer: (d) Select deptid, name, sum(credits) as totalcredits from department, course where deptid = deptno group by deptid, name having totalcredits > 40Solution:The correct queries to retrieve the dept id and name of the all 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 deptid = deptno group by deptid, name having totalcredits > 4095. 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 statement is correct with respect to the given query?(a) It retrieves the roll number and names of students who have not enrolled for all course offered by department number 5.(b) It retrieves the roll number and names of students who have enrolled for all course offered by department number 5.(c) It retrieves the roll number and names of students who have enrolled for at least one course offered by department number 5.(d) 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 studentCorrect Answer: (c) It retrieves the roll number and names of students who have enrolled for at least one course offered by department number 5.Solution:96. 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} Find the optimal solution for fractional knapsack problem when its maximum capacity is 15.(a) 43(b) 40(c) 45(d) 44Correct Answer: (b) 40Solution:97. 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} What is the maximum value of items you can carry if maximum weight allowed is 25 with a fractional knapsack?(a) 48.1(b) 79(c) 47.9(d) 40Correct Answer: (a) 48.1Solution:98. 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} If new item (P=5, W=2) is added to the list, total items is 8 and capacity is 25, then the bestcase time of fractional knapsack for this case is_____(a) O(8)(b) O(64)(c) O(24)(d) O(56)Correct Answer: (c) O(24)Solution:99. 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} The most efficient solution for the fractional knapsack problem with maximum capacity 15 can be obtained by using ______(a) Divide and Conquer(b) Dynamic Programming(c) Greedy Algorithm(d) BacktrackingCorrect Answer: (c) Greedy AlgorithmSolution: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} The most efficient solution for the fractional knapsack problem with maximum capacity 15 can be obtained by using Greedy Algorithm. So option (c) is correct.100. 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} Which of the following statements is correct for a knapsack?(a) 0/1 knapsack can be applied for all kinds of problems but fractional knapsack can be applied only if the problem meets certain conditions.(b) There is no difference between the two. They give the same solution for any problem.(c) We use greedy algorithm for 0/1 knapsack and dynamic programming for fractional knapsack.(d) 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.Correct Answer: (d) 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.Solution:Submit Quiz« Previous12345678910