Half-Yearly
SUBJECT: - Informatics Practices
CLASS: - XII M. MARKS: - 70
Note: Read the instructions carefully. Write your name, class, section and roll number clearly on your
answer sheet. Answer all the questions. Read each question carefully before answering it.
General Instructions:
• This question paper contains five sections, Section A to E.
• All questions are compulsory.
• Section A has 18 questions carrying 01 mark each.
• Section B has 07 Very Short Answer type questions carrying 02 marks each.
• Section C has 05 Short Answer type questions carrying 03 marks each.
• Section D has 02 questions carrying 04 marks each.
• Section E has 03 questions carrying 05 marks each.
• All programming questions are to be answered using Python Language only.
SECTION- A (18X1)
(1) What is the full form of DDL?
(a) Dynamic Data Language (b) Detailed Data Language (c) Data Definition Language
(d) Data Derivation Language
(2) Which of the following types of table constraints will prevent the entry of duplicate rows?
(a) Unique (b) Distinct (c) Primary Key (d) Null
(3) Which of the following keywords will you use in the following query to display all the values of the
column dept_name ?
Select dept_name from Company;
(a) All (b) From (c) Distinct (d) Name
(4) The keyword eliminates redundant data
(a) SELECT (b) DISTINCT (c) CREATE (d) INSERT
(5) The command is used to change delimitation of existing tables.
(a) DELETE TABLE (b) ALTER TABLE (c) MODIFYING TABLE (d) INSERT TABLE
(6) Which of the following SQL functions does not belong to the Math function
(a) Power() (b) ROUND() (c) LENGTH() (d) MOD()
(7) Which of the following is not SQL type?
(a) FLOAT (b) NUMERIC (c) DECIMAL (d) CHARACTER
(8) Which one of the following could arrange in the rows in ascending order in SQL
(a)SORT BY() (b) ALIGN BY (c) GROUP BY (d) ORDER BY
(9) A condition given in a JOIN query is referred to as
(a) JOIN in SQL (b) Join in Condition (c) Join in SQL and condition (d) None of these
(10) What type of error is returned by the following statement?
import Panda as pa
[Link]([1,2,3,4]),index=[‘a’,’b’,’c’])
(a) Value error (b) Syntax Error (c) Name Error (d) Logical Error
(11) Which attribute is not used with Data Frame?
(a) Size (b) Type (c) Empty (d) Column
(12) Which of the following are modules /libraries in Python?
(a) Numpy (b) Pandas (c) Matplot lib (d) All of these
(13) Which of the following libraries allow to manipulate, transform and visualize data easily and
efficently.
(a)Pandas (b) Numpy (c) Matplot lib (d) All of these
(14) To get the transpose of a dataframe D1, you can write
(a) D1.T (b) [Link] (c) [Link] (d) All of these
(15) To delete a rowfrom s Data Frame,you may use statement
(a) remove (b) del (c) drop (d) cancel
(16) The axis 1 identifies a dataframe’s .
(a) rows (b) columns (c) value (d) datatype
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
Both A and R are true and R is the correct explanation for A
Both A and R are true and R is not the correct explanation for A
A is True but R is False
A is false but R is True
(17) Assertion : A dataframe is value mutable and size-mutable.
Reason: All changes occur in place in a dataframe
(18) Assertion: Multiple rows function when applied on a column in a table ,yield values which are not equal
to number of rows in the table
Reason: The multi-row function work with data of multiple rows at a time and return aggregated value.
SECTION- B
(19) What is the “data type”? What are main objective of datatypes? 2
OR
What is the use of Python Pandas library
(20) Write a single line Pandas statement for the following.(Assuming necessary modules have been
imported):
Declare a pandas series named Packets having dataset as: 2
[125,92,85,116,87,90]
(21) What is the purpose of Order By clause in SQL? Explain with the help of suitable example. 2
(22) Sam wanted to display the list of employees who did not get commission. Therefore, he wrote the
following query in SQL:
SELECT emp_name from emp where
Comm=NULL;
He did not get the correct answer. Identify the error and write the SQL statement. Identify the error
and write the SQL statement. 2
(23) (a) Differentiate between the Pandas Series and Numpy Arrays. 2
OR
(b) Define RDBMS. Name any two RDBMS
(24) What will be the output of the following code: 2
>>>import pandas as pd
>>>A=[Link](data=[31,41,51])
>>>print(info)
>>>print(A>40)
>>>print(info[info>40])
(25) Carefully observe the following code: 2
import pandas as pd
Year1={'Q1':5000,'Q2':8000,'Q3':12000,'Q4': 18000}
Year2={'A' :13000,'B':14000,'C':12000}
totSales={1:Year1,2:Year2}
df=[Link](totSales)
print(df)
Answer the following:
(i) List the index of the DataFrame df
(ii) List the column names of DataFrame df.
SECTION-C
(26) Observe the following tables TRANSACTIONS and CUSTOMERS carefully and answer the questions that
follow: 3
Table : TRANSACTIONS
TNO TYPE AMOUNT CNO
T1 CREDIT 1000 C3
T2 DEBIT 1500 C1
Table: CUSTOMERS
CNO CNAME
C1 ZEESHAN
C2 AMAN
C3 ARAAV
(i) What is the Degree of the table TRANSACTIONS? What is the cardinality of the table
CUSTOMERS?
(ii) Identify the primary key and candidate key from the table TRANSACTIONS.
(27) Write a Python code to create a DataFrame with appropriate column headings
from the list given below:
[[101,'Gurman',98],[102,'Rajveer',95],[103,'Samar' ,96],[104,'Yuvraj',88]] 3
(28) Differentiate between Series object and Dictionary? 3
(29) Write a program to create a DataFrame to store weight, age and names of 3 people. Print the
DataFrame and its transpose. 3
(30) What is foreign key? How do you define a foreign key in your table? 3
OR
Discuss the significance of Group by clause in detail with the help of suitable example.
SECTION-D
(31) (a) Write suitable SQL query for the following: 4
(i) Display 7 characters extracted from 7th left character onwards from the string ‘INDIASHINING’.
(ii) Display the position of occurrence of string ‘COME’ in the string ‘WELCOME WORLD’.
(iii) Round off the value 23.78 to one decimal place.
(iv) Display the remainder of 100 divided by 9.
(v) Remove all the expected leading and trailing spaces from a column userid
(vi) of the table ‘USERS’.
OR
(b) Explain the following SQL functions using suitable examples.
(i) UCASE()
(ii) TRIM()
(iii) MID()
(iv) DAYNAME()
(v) POWER()
(32) What does UNION do? Are UNION and UNION ALL the same? Why? 4
SECTION-E
(33) Consider the below given two code [Link] the produce the same output?
Why/why not? 5
(i) Fst=[9,10,11] (ii) fst=[Link](data=[9,10,11])
Ob1=[Link](data=fst*2) ob2=[Link](data=fst*2)
Print(ob1) print(ob2)
(34) Preeti manages database in a blockchain start-up. For business purposes, she created a table named
BLOCKCHAIN. 5
Assist her by writing the following queries:
(i) Write a query to display the year of oldest transaction.
(ii) Write a query to display the month of most recent transaction.
(iii) Write a query to display all the transactions done in the month of May.
(iv) Write a query to count total number of transactions in the year 2022.
(35) Kabir has created following table named exam: 5
Help him in writing SQL queries to the perform the following task:
(i) Insert a new record in the table having following values: [6,'Khushi','CS',85]
(ii) To change the value “IP” to “Informatics Practices” in subject column.
(iii) To remove the records of those students whose marks are less than 30 .
(iv) To add a new column Grade of suitable datatype.