ISRO Computer Science (CSE) 2026 - Question 31

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2026

Topic: Database Management Systems / SQL

What is the output of the query below?
SELECT department_id, AVG(max_score) AS avg_top_score FROM (SELECT s.department_id, MAX(e.actual_marks) AS max_score FROM Students s JOIN registrations e ON s.student_roll_no = e.student_roll_no GROUP BY s.department_id, s.student_roll_no) AS student_bests GROUP BY department_id HAVING department_id = 'CS';

  • A. 96
  • B. 99
  • C. 91
  • D. 93

Answer: D. 93

Explanation: The inner query calculates the maximum `actual_marks` for each student (grouped by `department_id` and `student_roll_no`). For the 'CS' department, there are two students: roll_no 1 (Geetha) and roll_no 4 (Ramya). From the registrations table, roll_no 1 scored 96, and roll_no 4 scored 90. The inner query returns rows (CS, 96) and (CS, 90). The outer query calculates the average of these max_scores for the 'CS' department. The average of 96 and 90 is 93.

| | All questions of ISRO Computer Science (CSE) 2026