0% found this document useful (0 votes)
63 views

Informatics Practices

Uploaded by

sucheta vij
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Informatics Practices

Uploaded by

sucheta vij
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

New Green Field School

Half Yearly Question Paper


Class: XII Session: 2024-25
Informatics Practices (065)
Time allowed: 3 Hours Maximum Marks: 70

General Instructions:

1. This question paper contains five sections, Section A to E.


2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 02 questions carrying 04 marks each.
7. Section E has 03 Long Answer type questions carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.
SECTION A
1 To create an empty Series object, you can use: 1
a) pd.Series(empty)
b) pd.Series( )
c) pd.Series(np.NaN)
d) all of these

2 The axis 0 identifies a dataframe's 1


a) rows
b) columns
c) values
d) datatype

3 Which of the following is not a valid plotting function of pyplot ? 1


a) barh( )
b) plot( )
c) bar( )
d) line( )

4 You have a table called "sales" that contains sales data for a retail store. Which 1
SQL aggregate function can be used to calculate the total number of rows or
records in the "sales" table?
a. MAX()
b. MIN()
c. AVG()
d. COUNT()
5 Which Python command can be utilized to create a histogram using the data in a 1
list named 'values' that represents scores of students in an exam.
a. plt.hist(values)
b. seaborn.histplot(values)
c. plt.plot_histogram(values)
d. numpy.histogram(values)
6 Which of the following SQL queries is used to retrieve rows from the "customers" 1
table where the "email" column contains NULL values?
a. SELECT * FROM customers WHERE email = NULL;
b. SELECT * FROM customers WHERE email IS NOT NULL;
c. SELECT * FROM customers WHERE ISNULL(email);
d. SELECT * FROM customers WHERE email IS NULL;

7 The correct statement to read from a CSV file in a dataframes : 1


a) <DF> .read_csv(<File>)
b) <File> . read_csv( )(<DF>)
c) <DF>= pandas.read(File)
d) <DF> = pandas.read_csv(<Files>)

8 CSV stands for: 1


a) Comma separated value
b) Comma separated variables
c) Column separated values
d) Column separated variables

9 Which of the following command will display the column labels of the dataframe? 1
a) print(df.columns())
b) print(df.column())
c) print(df.column)
d) print(df.columns)

10 Assertion (A): To make a Histogram with Matplotlib, we can use the plt.hist() 1
function.
Reason (R): The bin parameter is compulsory to create histogram.
a. Both A and R are true and R is the correct explanation for A
b. Both A and R are true but R is not the correct explanation for A
c. A is True but R is False
d. A is false but R is True
11 Assertion (A): DataFrame and its size is mutable in Pandas. 1
Reasoning (R): Data in a Series is organised in a single column.
a. Both A and R are true and R is the correct explanation for A
b. Both A and R are true but R is not the correct explanation for A
c. A is True but R is False
d. A is false but R is True
12 You have a table called "employees" with columns "department" and "salary." 1
You want to find the highest salary in each department and display the results in
descending order of salary. Which SQL clauses should you use for this query?
a. GROUP BY, HAVING, ORDER BY
b. GROUP BY, ORDER BY
c. HAVING, ORDER BY
d. HAVING, GROUP BY
13 Which of the following function is used in Pandas to display the first few rows of 1
a specific column in a DataFrame?
a. show()
b. display()
c. head()
d. view()
14 Which SQL function can be used to convert a text string to uppercase? 1
a. UCASE()
b. LENGTH()
c. MID()
d. LTRIM()
15 A Series is a one-dimensional array containing a sequence of values of any data 1
type (int, float, list, string, etc), having by default have data labels.
a. alphanumeric
b. string
c. decimal
d. numeric
16 You are working with a database that stores employee information. You need to 1
retrieve the current date and time. Which SQL function would you use for this
purpose?
a. DATE()
b. MONTH()
c. DAY()
d. NOW()
17 Predict the output of the following query: 1
SELECT ROUND(15.789, 2);
a. 15.79
b. 15.789
c. 16
d. 15.8

18 When we create a series from dictionary then the keys of dictionary become 1
________________
a) Index of the series
b) Value of the series
c) Caption of the series
d) None of the series

SECTION B
19 Consider the variable var having value 5649.7438 2
Write the SQL statement to:
a) round it off to 02 decimal places.
b) Round it to 02 places before the decimal.
OR
What will be the output of the following SQL Statements:
a) Select instr(“This is my wrist watch”);
b) Select right(“Informatics Practices”,5);
20 Consider the given dataframe: 2
Dataf1
F1 F2 F3
D1 20 30 5
D2 40 50 10
D3 60 70 15
D4 80 90 25
Fill in the blanks to get the given output:
F1 F3
D1 20 5
D3 60 15
a. print ( Dataf1.loc[ , ])

F3 F2
D4 25 90
D3 15 70
b. print ( Dataf1.loc[ , ])

21 Consider the given SQL QUERIES: 2


i. To retrieve the length of the given string "CBSE BOARD SQP @ 2023!", which
SQL function should you use?
a. LCASE()
b. MID()
c. LENGTH()
d. TRIM()
ii. To findout if ‘@’ symbol is present in the values of email id column or not, which
function out of the following should be used?
a. Find()
b. Instr()
c. FindStr()
d. OnStr()

22 Gaytri, a data analyst has stored four employee’s name and their employee code 2
in four dictionaries. Structure of one such dictionary is as follows:
Emp1={'Ename': 'Emp Name', 'Ecode’:Employee code}
She clubbed these four dictionary into a list.
Write suitable Python code to store the required data of four employees in the
form of list of dictionaries and create a DataFrame with appropriate column
headings as shown below:
23 Given are two objects, a list object namely lst1 and a Series object namely ser1, both are 2
having similar values i.e. 2, 4, 6, 8
Find the output produced by the following statements :
a) print(lst1*2)
b) print(ser1*2)
24 Find the output of the following code: 2
import pandas as pd
lst1=[20,35,40]
ser1=pd.Series([20,35,40])
print(lst1+ lst1)
print(ser1+ser1)
25 Clarify the role of the HAVING clause highlighting its distinctions from the WHERE 2
clause in SQL.
SECTION C
26 Consider the following records in 'Cars' table and answer the given questions: 3

a. Write SQL query that will give the output as:


Blu
Bla
Bro
Blu
b. Write command for the following:
To change the color of Model with code as 103 to 'Green'.
c. How many tuples are present in the cars table?
Also identify the most suitable column of the cars table to mark as primary
key column.
OR
a. SELECT Make, Model FROM Cars WHERE Price > 30000.00;
b. SELECT COUNT(*) AS ‘TotalCars’ FROM Cars WHERE Year = 2022;
c. SELECT CarID, Make, Model FROM Cars where price<22000;
27 Complete the given Python code to get the required output as "California": 3
import as pd
data = {'Yosemite': 'California', 'Yellowstone': 'Wyoming', 'Glacier':
'Montana', 'Rocky Mountain': 'Colorado'}
national_parks = pd.Series( )
print(national_parks )
28 Suppose you already have “Nutrients" table in the "FOOD" database, as described 3
below:
Table Name: Nutrients
Column Name: Food_Item (VARCHAR)
Column Name: Calorie (INT)
Write SQL statements to perform the following tasks:
i. Add a new column named “Plan_Start_Date” (Date) to the
"Nutrients" table.
ii. ii. Modify the "Calorie" column to change its data type to Float.

29 Kabir, a data analyst, has stored the voter’s name and age in a dictionary. Now, 3
Kabir wants to create a list of dictionaries to store data of multiple voters. He
also wants to create a DataFrame from the same list of dictionaries having
appropriate row labels as shown below:

Voter_Name Voter_age
Ar1001 Arjun 35
Ba3002 Bala 23
Go4002 Govind 25
Dh4007 Dhruv 19
Na6005 Navya 18

Help Kabir in writing a Python program to complete the task.

30 Consider the given DataFrame 'Employees': 3


Name Employee_ID Department
Alice EMP001 HR
Bob EMP002 Sales
Carol EMP003 IT
David EMP004 Marketing
Write suitable Python statements for the following operations:
i) Add a column called 'Salary' with the following data:
[55000, 60000, 65000, 58000].
ii) Include a new employee named 'Eve' with Employee_ID 'EMP005',
working in the 'Finance' department, and a salary of 62000.
iii) Change the name of the 'Employee_ID' column to 'ID'.

SECTION D
31 Imagine you are assigned a task to manage the inventory of an online store. The 4
store uses an SQL database to track product information in a table named
'Products.' The 'Products' table has columns for 'ProductID' (Primary Key),
‘ProductName', ‘Category’, 'QuantityInStock,' and 'PricePerUnit.'
The following scenarios represent different inventory management tasks:
i) Restocking: Due to a recent sale, the 'QuantityInStock' of a product
with 'ProductID' 101, named "Laptop," needs to be increased by 10
units.
ii) Product Availability Check: You need to check the availability of a
product named "Wireless Mouse" in the 'Electronics' category.
iii) Product Update: The price of all products in the 'Electronics' category
should be increased by 5% to account for market changes.
iv) Out of Stock: Identify and list the products that are currently out of
stock (QuantityInStock is 0).
For each scenario, provide the SQL statements to perform the
necessary action.
32 Wizbiz Corporation is recording the quarterly sales data of its three products 4
through different departments. The data is as follows:
Qtr1 Qtr2 Qtr3 Qtr4
Product1 3500 4200 4800 5100
Product2 2800 3100 3600 3900
Product3 1500 1800 2100 2400

The company stores this information in a CSV file named "Quarterly_Sales.csv."


Mr. Raj is tasked for writing a Python program to visualise this data. He wrote the
following Python code but encountered some difficulties. Help him by providing
solutions to the following situations:

import pandas as pd
import as plt #line 1
df = #line 2
df.plot( ='bar', color=['purple', 'orange', 'green', 'yellow']) #line 3
plt.title ('Quarterly Sales Report') #line 4
plt.xlabel('Product')
plt.ylabel('Sales')
plt.show()
i. Choose the correct Python library from the following options to import in line
1:
A. matplotlib
B. matplotlib.plot
C. py.plot
D. matplotlib.pyplot
ii. Choose the correct option to specify the type of graph in line 3:
A. type
B. kind
C. style
D. graph
iii. Write suitable python statement to fetch the data from 'Quarterly_Sales.csv'
into the datafarme in line 2.
OR
Write Python statement to display total sales done in 'Qtr1' and 'Qtr2' for each
product.
SECTION E
33 Attempt the following questions: 5
(i) Write a SQL query to calculate the remainder when 15 is divided by 4.
(ii) Write a SQL query to retrieve the current year.
(iii) Write a SQL query to extract the first three characters from the string
'Hello, World!'.
(iv) Write a SQL query to convert the text in the 'description' column of
the 'product' table to uppercase.
(v) Write a SQL query to display the position of '-' in values of ACC_NO
column of table Bank.
OR
Observe the given tables carefully and attempt the following questions: 5

(i) Identify the column based on which both the tables can be related or
joined. Also justify your answer.
(ii) Write a SQL query to list names of all customers with their Amount in
ascending order:
(iii) Write a SQL query to find the total amount of money across all
branches.
(iv) Write a SQL query to count the total records in CUSTOMER table.
(v) Write a SQL query to find the minimum amount in a bank.
34 Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that 5
contains the four quarter’s sales data of different stores as shown below:

Store Qtr1 Qtr2 Qtr3 Qtr4


0 Store1 300 240 450 230
1 Store2 350 340 403 210
2 Store3 250 180 145 160

Answer the following questions:


i. Predict the output of the following python statement:
a) print(df.size)
b) print(df[1:3])
ii. Delete the last row from the DataFrame.
iii. Write Python statement to add a new column Total_Sales which is the
addition of all the 4 quarter sales.
iv. Write Python statement to export the DataFrame to a CSV file named
data.csv stored at D: drive.
v. Write Python statement to display detail of all stores whose Qtr3 value
more than 400.
35 District wise total number of houses are represented in the following table: 5

Dist VII Dist VIII Dist IX Dist X


40 45 35 44
Draw the following bar graph representing the number of houses in each
District(Dist VII, Dist VIII, Dist IX, Dist X).

Also, give suitable python statement to save this chart in E: drive of the computer
with name ‘house.png’.
OR
Write a python program to plot a line chart based on the given data to depict the
weekly study patterns for all the seven days.
Day=[1,2,3,4,5,6,7]
Study_Hours=[5,4,6,5,7,8,10]
Also, give suitable python statement to save this chart in d: drive of the
computer with name ‘study.png’.

You might also like