SRI VIJAY VIDYASHRAM SR. SEC.
SCHOOL-DPI
FIRST 25%
Class 12 - Computer Science
Time Allowed: 2 hours and 30 minutes Maximum Marks: 60
Section A
1. A relational database consists of a collection of ________. [1]
a) Attributes b) Tuples
c) Keys d) Relations
2. Which of the following clauses in SQL is most appropriate to use to select matching tuples in a specific range of [1]
values?
a) IS b) BETWEEN
c) IN d) LIKE
3. Which of the following operator displays a record if either the first condition or the second condition is true? [1]
a) BETWEEN b) OR
c) AMONG d) AND
4. Which of the following join gives the intersection of two tables? [1]
a) Inner join b) Outer join
c) Equi join d) Fuller join
5. With SQL, how do you select all the records from a table named "Students" where the value of the column [1]
"FirstName" ends with an "a"?
a) SELECT * FROM Students WHERE b) SELECT * FROM Students WHERE
FirstName LIKE '%a' FirstName = '%a%'
c) SELECT * FROM Students WHERE d) SELECT * FROM Students WHERE
FirstName LIKE 'a%' FirstName = 'a'
6. Consider following SQL statement. What type of statement is this? [1]
CREATE TABLE employee (name VARCHAR, id INTEGER)
a) Integrity constraint b) DML
c) DDL d) DCL
7. Which of the following is not a valid datatype in SQL? [1]
a) DECIMAL b) DATE
c) STRING d) CHAR
8. Which clause is used with "aggregate functions"? [1]
a) GROUP BY b) WHERE
c) SELECT d) Both GROUP BY and WHERE
1/8
9. The operation whose result contains all pairs of tuples from the two relations, regardless of whether their [1]
attribute values match.
a) Intersection b) Set difference
c) Join d) Cartesian product
10. Which of the following function returns the total number of values? [1]
a) MIN b) MAX
c) COUNT d) SUM
11. Which is the subset of SQL commands used to manipulate database structures, including tables? [1]
a) Data Differential Language b) Both Data Definition Language (DDL)
and Data Manipulation Language (DML)
c) Data Definition Language (DDL) d) Data Manipulation Language (DML)
12. What is the meaning of "HAVING" clause in SELECT query? [1]
a) To filter out the row groups b) To filter out the column groups
c) To filter out the row values d) To filter out the row and column values
13. Fill in the blank. [1]
________ is a number of tuples in a relation.
a) Domain b) Cardinality
c) Attribute d) Degree
14. Which statement of SQL provides statements for manipulating the database objects? [1]
a) DCL b) TCL
c) DML d) DDL
15. Which operator performs pattern matching? [1]
a) LIKE operator b) BETWEEN operator
c) INTO operator d) EXISTS operator
16. In SQL, which command is used to SELECT only one copy of each set of duplicable rows? [1]
a) SELECT DIFFERENT b) All of these
c) SELECT UNIQUE d) SELECT DISTINCT
17. With SQL, how can you return the number of not null records in the Project field of "Students" table? [1]
a) SELECT COLUMNS(*) FROM Students b) SELECT COUNT(*) FROM Students
c) SELECT COLUMNS(Project) FROM d) SELECT COUNT(Project) FROM Students
Students
18. Consider the following query : [1]
SELECT name, instructor name, course_id FROM instructor;
To display the field heading course with a different heading as id, which keyword must be used here to rename
the field name?
a) From b) Join
2/8
c) As d) Rename
19. Aggregate functions are also known as [1]
a) group functions b) Add function
c) group method d) sum function
20. Which of the following is a SQL aggregate function? [1]
a) JOIN b) LEN
c) AVG d) LEFT
21. Which of the following group functions ignore NULL values? [1]
a) MAX b) All of these
c) SUM d) COUNT
22. Which of the following queries contains an error? [1]
a) Select empid from emp where empid = b) Select * from emp where empid = 10003;
10006;
c) Select empid from emp; d) Select empid where empid = 1009 and
lastname = 'GUPTA';
23. What is a relation? What is the difference between a tuple and an attribute? [1]
24. Give the syntax of DROP statement. [1]
25. A set of possible data values is called [1]
a) domain b) attribute
c) tuple d) degree
26. The database administrator’s function in an organisation [1]
a) to show the relationship among entity b) to develop and implement data governance
classes in a data warehouse policies
c) to define which data mining tools must be d) to be responsible for the technical aspects of
used to extract data managing the information contained
in organisational database
27. The purpose of the primary key in a database is to [1]
a) establish constraints on database operations b) uniquely identify a record
c) provide a map of the data d) unlock the database
28. Which type of database model, organised the data in the form of tree with nodes? [1]
a) Hierarchical data model b) Network data model
c) Relational data model d) Multiple data model
29. A collection of interrelated records is called a [1]
a) database b) management information system
c) spreadsheet d) utility file
30. Key to represent relationship between tables is called [1]
3/8
a) primary key b) foreign key
c) composite key d) secondary key
Section B
31. Give the output of the following SQL statements, which are based on the table APPLICANTS. [2]
TABLE: APPLICANTS
No. NAME FEE GENDER C_ID JOINYEAR
1012 Amandeep 30000 M A01 2012
1102 Avisha 25000 F A02 2009
1103 Ekant 30000 M A02 2011
1049 Arun 30000 M A03 2009
1025 Amber 40000 M A02 2011
1106 Ela 40000 F A05 2010
1017 Nikita 35000 F A03 2012
1108 Arluna 30000 F A03 2012
2109 Shakti 35000 M A04 2011
1101 Kirat 25000 M A01 2012
i. SELECT NAME, JOINYEAR FROM APPLICANTS
WHERE GENDER = 'F' AND C_ID='A02';
ii. SELECT MIN (JOINYEAR) FROM APPLICANTS
WHERE GENDER = 'M';
iii. SELECT AVG(FEE) FROM APPLICANTS WHERE
C_ID = 'A01' OR C_ID = 'A05';
32. In a table Apply, there is a column namely Experience that can store only one of these values: 'Fresher', [2]
'Private-sector-experience', 'Public-sector-experience', 'Govt.-sector experience'. You want to sort the data of
table based on column experience as per this order: 'Govt-sector-experience', 'Public-sector-experience',
'Private-sector-experience', 'Fresher'. Write an SQL query to achieve this.
33. Write the output of any three SQL queries (i) to (iv) based on the tables COMPANY and CUSTOMER given [2]
below:
Table : COMPANY
CID C_NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY CHENNAI MOBILE
666 DELL DELHI LAPTOP
4/8
Table : CUSTOMER
CUSTID CID NAME PRICE QTY
C01 222 ROHIT SHARMA 70000 20
C02 666 DEEPIKA KUMARI 50000 10
C03 111 MOHAN KUMAR 30000 5
C04 555 RADHA MOHAN 30000 11
i. SELECT PRODUCTNAME, COUNT(*)FROM COMPANY GROUP BY
PRODUCTNAME HAVING COUNT(*)> 2;
ii. SELECT NAME, PRICE, PRODUCTNAME FROM COMPANY C,
CUSTOMER CT WHERE C.CID = CU.CID AND C_NAME = 'SONY';
iii. SELECT DISTINCT CITY FROM COMPANY;
iv. SELECT * FROM COMPANY WHERE C_NAME LIKE '%ON%';
34. Write a short note on DISTINCT keyword with an example. [2]
35. Consider the table MOVIE DETAILS given below [2]
Table: MOVIE DETAILS
MOVIE ID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the Chamber of Secrets English 4 Prime Video
M015 Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotstar
i. Identify the degree and cardinality of the table.
ii. Which field should be made the primary key? Justify your answer.
36. What do you mean by data independence? Define its types. [2]
Section C
37. i. Write two examples of DBMS software. [3]
ii. What is meant by NULL value in MySQL?
iii. Table 'Club' has 4 rows and 3 columns. Table 'Member' has 2 rows and 5 columns. What will be the
cardinality of the Cartesian product of them?
38. Write SQL queries for (i) to (iv), which are based on the tables: CUSTOMERS and PURCHASES. [3]
i. To display details of all CUSTOMERS whose CITIES are neither Delhi nor Mumbai.
ii. To display the CNAME and CITIES of all CUSTOMERS in ascending order of their CNAME.
iii. To display the number of CUSTOMERS along with their respective CITIES in each of the CITIES.
5/8
iv. To display details of all PURCHASES whose Quantity is more than 15.
Section D
39. Give output for following SQL queries as per given table(s) for (i) to (v) and write sql commands for point (vi) [4]
and (vii).
Table: GARMENT
GCODE Description Price FCODE READYDATE
10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10017 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 31-OCT-08
Table: FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE
i. SELECT SUM (PRICE) FROM GARMENT WHERE FCODE = 'F01';
ii. SELECT DESCRIPTION, TYPE FROM GARMENT, FABRIC
WHERE GARMENT.FCODE = FABRIC.FCODE AND GARMENT.PRICE >= 1260;
iii. SELECT MAX (FCODE) FROM FABRIC;
iv. SELECT COUNT (DISTINCT PRICE) FROM GARMENT;
v. To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE
vi. To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and 16-
JUN-08 (inclusive of both the dates).
40. Consider the following tables STORE and SUPPLIERS and answer (a) and (b) parts of this question: [4]
Table: STORE
ItemNo Item Scode Qty Rate LastBuy
2005 Sharpener Classic 23 60 8 31-Jun-09
2003 Ball Pen 0.25 22 50 25 01-Feb-10
6/8
2002 Gel Pen Premium 21 150 12 24-Feb-10
2006 Gel Pen Classic 21 250 20 11-Mar-09
2001 Eraser Small 22 220 6 19-Jan-09
2004 Eraser Big 22 110 8 02-Dec-09
2009 Ball Pen 0.5 21 180 18 03-Nov-09
Table: SUPPLIERS
Scode Sname
21 Premium Stationers
23 Soft Plastics
22 Tetra Supply
a. Write SQL commands for the following statements:
i. To display details of all the items in the STORE table in ascending order of LastBuy.
ii. To display ItemNo and Item name of those items from STORE table whose Rate is more than 15 Rupees.
iii. To display the details of those items whose supplier code (Scode) is 22 or Quantity in Store (Qty) is more
than 110 from the table Store.
iv. To display minimum Rate of items for each supplier individually as per Scode from the table STORE.
b. Give the output of the following SQL queries:
i. SELECT COUNT(DISTINCT Scode) FROM STORE;
ii. SELECT Rate* Qty FROM STORE WHERE ItemNo = 2004;
iii. SELECT Item, Sname FROM STORE S, Suppliers P WHERE S.Scode= P.Scode AND ItemNo = 2006;
iv. SELECT MAX(LastBuy) FROM STORE;
41. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables: [4]
TABLE: BOOK
Code BNAME TYPE
F101 The Priest Fiction
L102 German easy Literature
C101 Tarzan in the lost world Comic
F102 Untold story Fiction
C102 War heroes Comic
TABLE: MEMBER
MNO MNAME CODE ISSUEDATE
M101 RAGHAV SINHA LI 02 2016-10-13
M103 S ARTHAKJ OHN FI 02 2017-02-23
M102 ANISHA KHAN C101 2016-06-12
i. To display all details from table MEMBER in descending order of ISSUEDATE.
7/8
ii. To display the BNO and BNAME of all Fiction Type books from the table Book.
iii. To display the TYPE and number of books in each TYPE from the table BOOK.
iv. To display all MNAME and ISSUEDATE of those members from table MEMBER who have books issued
(i.e., ISSUEDATE) in the year 2017.
v. SELECT MAX (ISSUEDATE) FROM MEMBER
vi. SELECT DISTINCT TYPE FROM BOOK
vii. SELECT A.CODE, BNAME, MNO. MNAME FROM BOOK A. MEMBER B WHERE A.CODE=
B.CODE
viii. SELECT BNAME FROM BOOK WHERE TYPE NOT IN ("FICTION", "COMIC")
8/8