SQL Mock Test I
SQL Mock Test I
This section presents you various set of Mock Tests related to SQL. 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.
Which of the following query would display the full name of a student, with a column
heading "Name"
Which of the following query would display the distinct honours subjects in the
STUDENTS table?
Which of the following query would display all the students with honours_subject
Eng01?
from students;
Which of the following query would display all the students whose first name starts
with the character A?
Which of the following query would display all the students where the second letter in
the first name is i?
Which of the following query would display names of all the students whose email ids
are not provided?
Which of the following query would display names of all the students whose honours
subject is English and percentage of marks more than 80, or honours subject is
Spanish and percentage of marks more than 80?
D - select first_name, last name from students where honourssubject = English or honours_subject =
Spanish and percentage_of_marks > 80;
Which of the following query would display names of all the students whose honours
subject is English, or honours subject is Spanish and percentage of marks more than
80?
C - select first_name, last name from students where honours_subject = English and
honours_subject = Spanish or percentage_of_marks > 80;
D - select first_name, last name from students where honourssubject = English and honours_subject
= Spanish and percentage_of_marks > 80;
Which of the following query would display names of all students in descending order
of percentage of marks?
Which of the following query would display names and percentage of marks of all
students sorted by honours subject, and then order by percentage of marks?
Which of the following query would correctly display the students first name, last
name, honours subject and date of birth, born between July 1st 1996, and 30th June
1999.
A - concat
B - substr
C - instr
D - coalesce
A - 11
B - 10
C - POINT
D - TUTORIALS
A - TUTORIAL
B - POINT
C - TUTORIALS
D - UTORIALS
A-T
B - NULL
C-0
D-N
A - 789.84
B - 789.83
C - 78
D - 789.00
Q 19 - What is returned by TRUNC789.8389, 2?
A - 789.84
B - 789.83
C - 78
D - 789.00
A - 33
B - 30
C-3
D - 10
Which query will display the names and honours subjects of all students and if a
student has not yet been given a honours subject yet, then it should display No
Honours Yet.
A - NVL
B - NVL2
C - NULLIF
D - COALESCE
Q 23 - For some particular assignment, you need to compare two values, if both are
equal, the result would be null, and if the values are not equal then the first value
should be returned. Which function should you use?
A - NVL
B - NVL2
C - NULLIF
D - COALESCE
C - Some rows in the first table are joined to all rows in the second table.
D - All rows in the first table are joined to some rows in the second table.
A - Natural join is based on all columns in two tables having same name
B - It selects rows from the two tables having different values in the matched columns.
C - If columns having same names have different data types, it returns error.
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;
A - When more than one column has the same name, USING clause is used for specifying the
column to be joined by equijoin.
B - It is used for matching one column only.
D - The NATURAL JOIN and the USING clauses are mutually exclusive.
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with the USING clause
A - The join condition is not separated from other search conditions in a query.
C - The join condition for natural join is basically an equijoin of all columns with same name.
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with the ON clause
B - A left or right outer join returns the results of the inner join as well as the unmatched rows in
the left or right table respectively.
C - A full outer join returns results of an inner join as well as the results of a left and right join.
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with a left outer join
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with a right outer join
Select the right query for retrieving records from the tables HONOURS_SUBJECT and
LOCATIONS with a full outer join
A - Group functions operate on sets of rows to produce multiple results per group.
A - SUM
B - NVL
C - COUNT
D - MIN
Q 39 - 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
Q 40 - Which of the following is not true about the MAX and MIN functions?
B - COUNTexp returns the number of rows with non-null values for the exp.
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, avgpercentageo fmarks from students where avgpercentageo fmarks > 50.0
group by honours_subject;
B - select honours_subject, avgpercentageo fmarks from students having avgpercentageo fmarks > 50.0
group by honours_subject;
Which of the following query will correctly display name of all the students who got
more marks than the student 0215/15?
A-
B-
C-
C - The outer and inner queries can get data from different tables.
D - All of the above.
A - Single row subqueries return one row from the inner SELECT statement.
B - Single row subqueries return one row from the outer SELECT statement.
Q 50 - 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
ANSWER SHEET
1 D
2 C
3 B
4 A
5 A
6 A
7 C
8 A
9 B
10 C
11 A
12 D
13 C
14 D
15 A
16 C
17 A
18 A
19 B
20 D
21 A
22 B
23 C
24 C
25 A
26 B
27 D
28 C
29 A
30 C
31 A
32 C
33 D
34 A
35 C
36 A
37 C
38 B
39 A
40 D
41 D
42 A
43 D
44 B
45 C
46 D
47 A
48 D
49 B
50 C