SQL Mock Test


This section presents you various set of Mock Tests related to SQL Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

SQL Mock Test II

Q 2 - Consider the following schema −

HONOURS_SUBJECT(subject_code, subject_name, department_head);
LOCATIONS(subject_code, department_name, location_id, city);

Which query will perform a natural join between the HONOURS_SUBJECT table and the LOCATIONS table?

A - select subject_code, subject_name, location_id, city from honours_subject cross join locations;

B - select subject_code, subject_name, location_id, city from honours_subject join locations;

C - select subject_code, subject_name, location_id, city from honours_subject outer join locations;

D - select subject_code, subject_name, location_id, city from honours_subject natural join locations;

Answer : D

Q 4 - Consider the following schema −

HONOURS_SUBJECT(subject_code, subject_name, department_head);
LOCATIONS(subject_code, department_name, location_id, city);

Select the right query for retrieving records from the tables HONOURS_SUBJECT and LOCATIONS with the USING clause

A - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h join location l using(subject_code);

B - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h natural join location l using(subject_code);

C - select h.subject_name, l.department_name, h.department_head, l.city from honours_subject h, location l using(subject_code);

D - None of the above.

Answer : A

Answer : A

Q 13 - Which of the following is not a group function?

A - SUM

B - NVL

C - COUNT

D - MIN

Answer : B

Q 14 - Which of the following functions can be used on both numeric as well as non-numeric data?

A - COUNT

B - AVG

C - STDDEV

D - VARIANCE

Answer : A

Answer : D

Q 17 - You want to calculate the sum of commissions earned by the employees of an organisation. If an employee doesn’t receive any commission, it should be calculated as zero. Which will be the right query to achieve this?

A - select sum(nvl(commission, 0)) from employees;

B - select sum(commission, 0) from employees;

C - select nvl(sum(commission), 0) from employees;

D - None of the above.

Answer : A

Q 19 - Consider the following schema −

STUDENTS(student_code, first_name, last_name, email, 
         phone_no, date_of_birth, honours_subject, percentage_of_marks);

Which of the following query will correctly list the average percentage of marks in each honours subject, when the average is more than 50 percent?

A - select honours_subject, avg(percentage_of_marks) from students where avg(percentage_of_marks) > 50.0 group by honours_subject;

B - select honours_subject, avg(percentage_of_marks) from students having avg(percentage_of_marks) > 50.0 group by honours_subject;

C - select honours_subject, avg(percentage_of_marks) from students group by honours_subject having avg(percentage_of_marks) > 50.0;

D - None of the above.

Answer : B

Q 21 - A subquery can be placed in which of the SQL clauses?

A - The WHERE clause

B - The HAVING clause

C - The FROM clause

D - All of the above.

Answer : D

Q 25 - You want to calculate the minimum percentage of marks obtained under each honours group students, where the minimum marks is more than the minimum marks in economics department. Under which clause should the subquery be?

A - WHERE clause

B - FROM clause

C - HAVING clause

D - None of the above.

Answer : C

Answer Sheet

Question Number Answer Key
1 B
2 D
3 C
4 A
5 C
6 A
7 C
8 D
9 A
10 C
11 A
12 C
13 B
14 A
15 D
16 D
17 A
18 D
19 B
20 C
21 D
22 A
23 D
24 B
25 C
sql_questions_answers.htm
Advertisements