BHARATH VIDYA MANDIR
REVISION TEST II
INFORMATICS PRACTICES (065)
DATE: 27.10.2023 MARKS: 80
CLASS: XII BAJRA DURATION:180 MINS
General Instructions:
1. This question paper contains the sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 7 Very Short Answer type questions carrying 02 marks each.
5. Section C has 5 Short Answer type questions carrying 3 marks each.
6. Section D has 2 questions carrying 04 marks each.
7. Section E has 3 question carrying 05 marks each.
SECTION A (40 MINS) (18*1 = 18 MARKS)
1. Each table comprises of and .
(A) rows, columns (B) data, information (C) database, table (D) None of these
2. The design of the database is known as what?
(A) Attribute (B) Database Schema (C) obstruction (D) Database Oriented
3. A relational database is a collection of
(A) Attributes (B) Tables (C) Records (D) Fields
4. Which statement is valid?
(A) ALTER TABLE EMPLOYEE MODIFY(last_name CHAR2(2000));
(B) ALTER TABLE EMPLOYEE CHANGE(last_name CHAR2(2000));
(C) ALTERTABLE EMPLOYEE CHANGE(last_name VARCHAR2(2000));
(D) ALTER TABLE EMPLOYEE MODIFY(last_name VARCHAR2(2000));
5. To display the detail of employee having ‘e’ in their name in descending order of salary. The
correct SQL statement is:
(A) SELECT*FROM emp WHERE ename LIKE “e%” ORDER BY SAL;
(B) SELECT*FROM emp ORDER BY SAL DESC WHERE ename LIKE“%e%”;
(C) SELECT*FROM emp WHERE ename LIKE “%e%” ORDER BY DESC SAL;
(D) SELECT*FROM emp WHERE ename LIKE “%e%” ORDER BY SAL DESC;
6. Which SQL statement will not generate any error message?
(A) SELECT*FROM EMP WHERE EMPNO LIKE(1,2,3,4);
(B) SELECT*FROM EMP WHERE SAL BETWEEN 3000 TO 15000;
(C) SELECT*FROM EMP WHERE COMM IS NOT NULL;
(D) All of the above
7. We use which operator with select for condition based on pattern matching?
(A)In (B) Like (C) Between (D) Is
8. To specify a list of values ....................... operator is used.
(A)In (B) Like (C) Between (D) Is
8. For conditional retrieval of rows from a table with SELECT, which clause is used?
(A)Where (B) Having (C) Group By (D) Order by
9. Select statement has four clauses 1.Where 2.Having 3.Group By 4.Orderby
The correct order of all clauses in a select is:-
(A)1,2,3&4 (B)1,3,2&4 (C)1,4,3&2 (D)1,3,4&2
10. How can you insert a new row into the “STORE” table.
(A)INSERT ROW(1,‟RAMSINGH‟)INTO STORE;
(B)INSERT VALUES(1,‟RAMSINGH‟)INTO STORE;
(C) INSERT INTO(1,‟RAMSINGH‟)STORE;
(D)INSERT INTO STORE VALUES(1,‟RAMSINGH‟);
11. Which is a valid CREATE TABLE statement?
(A)Create table emp add(id integer(3)); (B) Create table emp(id integers(3));
(C) Create table emp modified(id integer(3)); (D) Create table emp(id integer(3));
12. The command that is used to access database in MySQL is:
(A)Open <databasename>; (B) USE <databasename>;
(C) Access <databasename>; (D) (a)&(b) both
13. Which is not a way to represent comment in MySQL?
(A)/* */ (B) -- (C) # (D) //
14. The default date format in MySQL is:
(A)DD/MM/YYYY (B) YYYY/MM/DD (C) MM-DD-YYYY (D) YYYY-MM-DD
15. Which of the following is not a numeric type?
(A)Int (B) Float (C) Boolean (D) Double
In the following questions a statement of Assertion (A) is followed by a statement of Reason(R),
Mark the correct choice as:
A) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A)
B) Both assertion (A) and reason (R) are true and reason (R) is not the correct explanation of
assertion (A)
C) Assertion (A) is true but reason (R) is false
D) Assertion (A) is false but reason (R) is true
16. Assertion (A): A database consists of a number of tables.
Reason (R): Each table comprises of rows and records.
17. Assertion (A): TCL stands for Transaction Control Language.
Reason (R): These commands perform retrieval, insertion, deletion and modification etc. on
data-bases.
SECTION B (30 MINS) (7*2 = 14 MARKS)
18. State difference between date functions NOW( ) and SYSDATE( ) of MySql.
19. A SQL table ITEMS contains the following columns: INO, INAME, QUANTITY, PRICE,
DISCOUNT, Write the SQL command to remove the column DISCOUNT from the table.
20. Differentiate between Candidate Key and Primary Key in the context of Relational Database
Model.
21. Mr. Roger is using a table LIBRARY. It has the following columns: BCode, BName, Price,
and author. He wants to display maximum price Author wise. He wrote the following command:
SELECT Author, Max(Price) FROM LIBRARY;
But he did not get desired result. Rewrite the above query with necessary change to help him
get the desired output and explain the reason.
22. Differentiate ORDER BY and GROUP BY with an example.
23. A table FLIGHT has 4 rows and 2 columns and another table AIRHOSTESS has 3 rows and 4
columns. How many rows and columns will be there if we obtain the Cartesian product of these
two tables?
24. What is the purpose of DROP TABLE command in MySql? How is it different from DELETE
command?
SECTION C (50 MINS) (5*3 = 15 MARKS)
25. i) What are the differences between DELETE and DROP commands of SQL?
ii) What do you understand by MySQL Client?
26. Define the terms: i) Database Abstraction ii) Data inconsistency
27. Consider the table ‘School’ whose fields are shown below.
Admno, Class, Mobile, Fees, Name
Write the queries to perform the following task. i. Display all names in uppercase.
ii. Display the last two characters from column Name. iii. Display the lowest fees.
28. Identify the following functions:
i. I am a mathematical function and return the remainder.
ii. I am a string function and help to convert lower case string to upper case.
iii. I am a date and time function, return the month name from the specified date.
29. Explain the following function with examples.
i. dayname ( ) ii. Instr ( ) iii. Now ( )
SECTION D (20 MINS) (2*4 = 8 MARKS)
30. Consider the table RESULT given below Write commands in MySql for (i) to (iv).
(i) To list the names of those students, who have obtained Division as FIRST in the ascending
order of Name.
(ii) To display a report listing NAME, SUBJECT and Annual stipend received assuming that
the stipend column has monthly stipend.
(iii) To count the number of students, who have either Accounts or Informatics as Subject.
(iv) To insert a new row in the table Result: 7, "Mohan", 500, "English", 73, "Second";
31. Consider the following table named “SBOP” with details of account holders. Write commands
of MySQL for (i) to (iv) and output for (v) to (vi).
(i) To display Accountno, Name and DateOfopen of account holders having transactions more than
8.
(ii) To display all information of account holders whose transaction value is not mentioned.
(iii) To add another colurnn Address with datatype and size as VARCHAR(25).
(iv) To display the month day with reference to DateOfopen for all the account holders.
(v) SELECT Count(*) FROM SBOP;
(vi) SELECT Name, Balance FROM SBOP WHERE Name LIKE "%i";
SECTION E (30 MINS) (3*5 = 15 MARKS)
32. Consider the table given below. Write SQL queries for (i) to (vii).
33. Consider the following two tables Customer and Salesman.
Q1. Write a SQL query to display Salesman, cust_name and city from above table where the
salesperson and customer belongs to same city.
Q2. Write a SQL query to display ord_no, purch_amt, cust_name, city of those orders where order
amount exists between 500 and 2000.
Q3. Write a SQL query to display Customer Name, City, Salesman, Commission of all the
salesperson(s) and their respective customer(s).
34. Find the output of the following SQL statements.
1. SELECT CHAR(69);
2. SELECT CHAR(73,80);
3. SELECT CHAR(80,82,65,67);
4. SELECT CONCAT(“MR”,”ANIL”);
5. SELECT CONCAT(“MS”,”AARTI”);
6. SELECT LOWER(“AAkarsh”);
7. SELECT LOWER(“KUMAR”);
8. SELECT UPPER(“AAkarsh”);
9. SELECT UPPER(“kumar”);
10. SELECT LENGTH(“KUMAR”);
(LAST 10 Mins for Checking)
PRACTICALS
SUBJECT CODE: 065
SCHOOL CODE: 55474
MAX. TIME: 30 MINS MAX MARKS: 10
QUESTIONS
1. Creating a python program to perform operations on a DataFrame (rename, count, update,
replace).
2. Creating a Python program to display the data of a DataFrame row-wise and column-wise
using iterrows() and iteritems().
ANSWER KEY
1. Each table comprises of and
(A) rows, columns (B) data, information (C) database, table (D) None of these
2. The design of the database is known as what?
(A) Attribute (B) Database Schema(C) obstruction (D) Database Oriented
3. A relational database is a collection of
(A) Attributes (B) Tables (C) Records (D) Fields
4. Which statement is valid?
(A) ALTER TABLE EMPLOYEE MODIFY(last_name CHAR2(2000));
(B) ALTER TABLE EMPLOYEE CHANGE(last_name CHAR2(2000));
(C) ALTERTABLE EMPLOYEE CHANGE(last_name VARCHAR2(2000));
(D) ALTER TABLE EMPLOYEE MODIFY(last_name VARCHAR2(2000));
5. To display the detail of employee having ‘e’ in their name in descending order of salary. The correct SQL statement
is:
(A) SELECT*FROM emp WHERE ename LIKE “e%” ORDER BY SAL;
(B) SELECT*FROM emp ORDER BY SAL DESC WHERE ename LIKE“%e%”;
(C) SELECT*FROM emp WHERE ename LIKE “%e%” ORDER BY DESC SAL;
(D) SELECT*FROM emp WHERE ename LIKE “%e%” ORDER BY SAL DESC;
6. Which SQL statement will not generate any error message?
(a) SELECT*FROM EMP WHERE EMPNO LIKE(1,2,3,4); (b) SELECT*FROM EMP WHERE SAL BETWEEN 3000 TO 15000;
(c) SELECT*FROM EMP WHERE COMM IS NOT NULL; (d) All of the above
7. We use operator with select for condition based on pattern matching.
(A) In (B) Like (C) Between (D) Is
8. To specify a list of values ................. Operator is used.
(A) In (B) Like (C) Between (D) Is
9. Conditionally retrieval of rows from a table with SELECT, which clause is used?
(A) Where (B) Having (C) Group By (D) Order by
10. Select statement has four clauses 1.Where 2.Having 3.Group By 4.Orderby
The correct order of all clauses in a select is:-
(A)1,2,3&4 (B)1,3,2&4 (C)1,4,3&2 (D)1,3,4&2
11. How can you insert a new row into the “STORE” table.
(A) INSERT ROW(1,‟RAMSINGH‟)INTO STORE; (B) INSERT VALUES(1,‟RAMSINGH‟)INTO STORE;
(C) INSERT INTO(1,‟RAMSINGH‟)STORE; (D) INSERT INTO STORE VALUES(1,‟RAMSINGH‟);
12. Which is a valid CREATE TABLE statement?
(A) Create table emp add(id integer(3)); (D) Create table emp(id integers(3));
(C) Create table emp modified(id integer(3)); (D) Create table emp(id integer(3));
13. The command is used to access database in MySQL is-
(A) Open <databasename>; (B) USE <databasename>; (C) Access <databasename>; (D) (a)&(b) both
14. Which is not a way to represent comment in MySQL?
(A)/* */ (B) -- (C) # (D) //
15. The default date format in MySQL is:
(A) DD/MM/YYYY (B) YYYY/MM/DD (C) MM-DD-YYYY (D) YYYY-MM-DD
16. Which is not a numeric type?
(A) Int (B) Float (C) Boolean (D) Double
17. C
18.C
19. SYSDATE( ) returns the time at which it executes. This differs from the behaviour for NOW(), which returns a
constant time that indicates the at which the statement began to execute.
20. ALTER TABLE ITEMS DROP COLUMN DISCOUNT; OR
ALTER TABLE ITEMS DROP DISCOUNT;
21. A table may have more than one or a combination of attribute(s)that identifies a tuple uniquely. All such
attribute(s) are known as Candidate Keys.
Out of all the Candidate keys, the most appropriate one, which is used for unique identification of the Tuples, is called
the Primary Key.
22. SELECT Author, Max(Price) FROM LIBRARY GROUP BY AUTHOR;
Group By clause is used to group the rows together that contain the same values in a specified column.so to display
maximum price of each author , the table must be grouped author wise using group by clause.
23. Order By : Order by keyword sort the result-set either in ascending or in descending order. This clause sorts the
result-set in ascending order by default. In order to sort the result-set in descending order DESC keyword is used.
Order By Syntax –
SELECT column_1, column_2, column_3...........
FROM Table_Name
ORDER BY column_1, column_2, column_3 ASC|DESC;
Group By : Group by statement is used to group the rows that have the same value. It is often used with aggregate
functions for example:AVG(), MAX(), COUNT(), MIN() etc. One thing to remember about the group by clause is that the
tuples are grouped based on the similarity between the attribute values of tuples.
Group By Syntax –
SELECT function_Name(column_1), column_2
FROM Table_Name
WHERE condition
GROUP BY column_1, column_2 ORDER BY column_1, column_2;
24. Rows = 4 rows of FLIGHT × 3 rows of AIRHOSTESS = 12 rows.
Columns = 2 columns of FLIGHT + 4 columns of AIRHOSTESS = 6 columns.
25. The DROP TABLE command is used to remove a table from the database, and also removes all of its data. The
DELETE command only deletes rows from a MySQL database but the table remains in the database.
26. i)DELETE is DML command while DROP is a DDL command. Delete is used to delete rows from a table while DROP
is used to remove the entire table from the database.
ii) What do you understand by MySQL Client?
27. Ans: Database system provides the users only that much information that is required by them, and hides certain
details like, how the data is stored and maintained in database at hardware level. This concept/process is Database
abstraction.
ii. Data inconsistency Ans: When two or more entries about the same data do not agree i.e. when one of them stores
the updated information and the other does not, it results in data inconsistency in the database.
31. (i) SELECT Name FROM Result WHERE Division=’FIRST’ ORDER BY Name;
(ii) SELECT Name, Subject, Stipend*12 AS ‘Annual Stipend’ FROM Result;
(iii) SELECT COUNT(*) FROM Result WHERE Subject=’Accounts’ OR Subject=’Informatics’;
(iv) INSERT INTO Result VALUES (7, "Mohan", 500, "English", 73, "Second");
32. (i) SELECT Accountno, Name, DateOfopen FROM SBOP WHERE Transaction>8;
(ii) SELECT * FROM SBOP WHERE Transaction IS NULL;
(iii) ALTER TABLE SBOP ADD (Address varchar(25));
COUNT
(*)
5
IV) SELECT DAYOFMONTH(Dateofopen) FROM SBOP;
Name Balance
Mrs.Sakshi 45000.00
SECTION E
33.
34. Q1. Write a SQL query to display Salesman, cust_name and city from above table where the
salesperson and customer belongs to same city.
Ans:
SELECT s.name AS "Salesman", c.cust_name, c.city
FROM salesman s, customer c WHERE s.city=c.city;
OR
SELECT salesman.name AS "Salesman", customer.cust_name, customer.city
FROM salesman,customer WHERE salesman.city=customer.city;
Q2. write a SQL query to display ord_no, purch_amt, cust_name, city of those orders where order
amount exists between 500 and 2000.
Ans:
SELECT o.ord_no,o.purch_amt, c.cust_name,c.city
FROM orders o,customer c
WHERE o.customer_id=c.customer_id AND o.purch_amt BETWEEN 500 AND 2000;
Q3. Write a SQL query to display Customer Name, city, Salesman, commission the all
salesperson(s) and their respective the customer(s).
Ans:
SELECT c.cust_name AS "Customer Name", c.city, s.name AS "Salesman", s.commission
FROM customer c, salesman s WHERE c.salesman_id=s.salesman_id;
35. 1. E
2. IP
3. PRAC
4. MRANIL
5. MSAARTI
6. aakarsh
7. kumar
8. AAKARSH
9. KUMAR
10. 5