0% found this document useful (0 votes)
92 views9 pages

QP Xii Ip Hy 2023-24

This document is the question paper for the Half Yearly Examination in Informatics Practices for Class XII at Army Public School, Patiala, covering various topics in Python and SQL. It consists of five sections with a total of 70 marks, including multiple-choice questions, short answer questions, and programming tasks. Students are instructed to answer all questions using Python language only.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views9 pages

QP Xii Ip Hy 2023-24

This document is the question paper for the Half Yearly Examination in Informatics Practices for Class XII at Army Public School, Patiala, covering various topics in Python and SQL. It consists of five sections with a total of 70 marks, including multiple-choice questions, short answer questions, and programming tasks. Students are instructed to answer all questions using Python language only.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

ARMY PUBLIC SCHOOL, PATIALA

HALF YEARLY EXAMINATION – (2023-24)


CLASS - XII
INFORMATICS PRACTICES (065)
MM. -70 TIME ALLOWED: 03 hrs
GENERAL INSTRUCTIONS:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 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 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each
8. All programming questions are to be answered using Python Language only

SECTION-A(1 MARKS)
1 Difference between loc() and iloc().: 1
a. Both are Label indexed based functions.
b. Both are Integer position-based functions.
c. loc() is label based function and iloc() integer position based function.
d. loc() is integer position based function and iloc() index position based function

2 Which function will be used to write data to a CSV file into pandas data frame? 1
a. readcsv() b. to_csv() c. read_csv() d. csv_read()
3 What is the minimum number of arguments required for plot() function in matplotlib? 1
a. 1 b. 2 c. 3 d. 4

4 Consider the following series object Named ‘Ser’: 1


0 578
1 235
2 560
3 897
4 118
What will be the output of following statements?:
print(ser.index)
a. RangeIndex(start=0, stop=5, step=1)
b. [578 235 560 897 118]
c. 0,1,2,3,4
d. None of Above

1
5 Which of the following is not a text function: 1
a. Trim() b. Truncate()
c. Mid() d. Right()
6 Out of the following, which function cannot be used for customization of charts in Python? 1
a. xlabel() b. colour() c. title() d. xticks()

7 What will be printed by the given query? 1

SELECT LENGTH(“WIN.NER”);

a. 7 b. 6
c. 8 d. 9
8 If column FEES in a table STUDENT contains the data set (5000, 8000, NULL, 5000, 8000) what will be 1
the output after execution of the given query?

SELECT MAX(FEES) + COUNT(DISTINCT FEES) FROM STUDENT ;

a. 8000 b. 8005
c. 8002 d. error
9 All aggregate functions except_____________ ignore null values in their input collection. 1

a. Count(attribute) b. Count(*)
c. Avg d. Sum
10 Given the following Series. Write the output.
1
import pandas as pd1
s = pd1.Series([1,2,3,4,5],index = ['a','b','c','d','e'])
print (s[-3:])

a. c 3 b. a 1
d 4 b 2
e 5 dtype: int64
dtype: int64

c. a 1 d. None of these
b 2
c 3
dtype: int64

11 In a DataFrame, Axis= 1 represents the_____________ elements. 1

a. Row b. column c. Both row and column d. None of these

12 Using Python Matplotlib _________ can be used to count how many values fall into each interval 1

2
a. line plot b. bar graph
c. histogram d. box plot
13 To display last five rows of a series object ‘S’, you may write: 1
a. S.Head() b. S.Tail(5) c. S.Head(5) d. S.tail()

14 In SQL, which function is used to display current date and time? 1

a. Date() b. Time()
c. Current() d. Now()
15 Which of the following can be used to specify the data while creating a DataFrame? 1

a. Series b. List of Dictionaries c. Structured ndarray d. All of these

16 If the substring is not present in the string, the instr() returns: 1


a) 0 b) -1 c) 1 d) NULLL

Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as

a. Both A and R are true and R is the correct explanation for A


b. Both A and R are true and R is not the correct explanation for A
c. A is True but R is False
d. A is false but R is True

17 Assertion (A):-To delete a column from Pandas DataFrame,drop() method is used. 1


Reasoning (R): - Columns are deleted by dropping columns with index
label.

18 Assertion (A): While accessing values of Pandas Series using slices, the values at the start and end 1
index can be also included.
Reason (R):In Pandas Series slicing using labelled index display all the values from starting to end
index.

SECTION-B(2 MARKS)

3
19 2

20 Rashmi, a database administrator needs to display house wise total number of records of ‘Red’ and 2
‘Yellow’ house. She is encountering an error while executing the following query
SELECT HOUSE, COUNT (*) FROM STUDENT GROUP BY HOUSE
WHERE HOUSE=’RED’ OR HOUSE= ‘YELLOW’;
Help her in identifying the reason of the error and write the correct query by suggesting the possible
correction (s).

21 What is the purpose of WHERE clause in SQL? How it is different from having clause? Explain with the 2
help of suitable example.
22 Write a program to create a series object using a dictionary that stores the number of students in each 2
house of class 12B of your school.
Note: Assume four house names are Beas, Chenab, Ravi and Satluj having 18, 2, 20, 18 students
respectively and pandas library has been imported as pd.

23. The python code written below has syntactical errors. Rewrite the correct code and underline the 2
corrections made.

Import pandas as pd
Monument=['Qutub Minar','Gateway of India','Red Fort','Taj Mahal']
State=['Delhi','Maharashtra','Delhi','Uttar Pradesh']
S=Pd.series(Monument,index=State)
Print(s)

24 What will be the output produced by the following program? 2

import pandas as pd

Info=pd.Series(data=[31,41,51,61,71])

4
print(info[info>=50])

print(info>50)
25 a) Fill in the blanks: 2
import __________ as pd
Year1={'L1':5000,'L2':8000,'L3':12000,'L4': 18000}
Year2={'X' :13000,'Y':14000,'Z':12000}
totSales={1:Year1,2:Year2}

df=_______.DataFrame(________)

print(df)

b) Output of command based on dataframe in part1


print(df.index)

SECTION-C(3 MARKS)
26 Write outputs for SQL queries (i) to (iii) which are based on the given table SCHOOL: 3

i. SELECT ROUND(PERCENT,1) FROM SCHOOL WHERE CLASS=11;


i. SELECT MAX(CLASS) FROM SCHOOL WHERE PERCENT<90;
ii. SELECT LENGTH(SUBSTR(STREAM,3,4)) FROM SCHOOL WHERE STREAM= ‘SCIENCE’;

or

27 Write a Python code to create a DataFrame with appropriate column headings from the list given 3
below:
5
[[101,'AMIT',98],[102,'RAJVEER',95],[103,'SAMAR' ,96], [104,'YUVI',88]]

28 Consider the given DataFrame “BOOK‟: 3


Name Price
0 Nancy Drew 150
1 Hardy boys 180
2 Diary of a wimpy kid 225
3 Harry Potter 500

Write suitable Python statements for the following:


i. Add a column called Special_Price with the following data: [135,150,200,440].
ii. Add a new book named ‘The Secret' having price 800.
iii. Remove the column Special_Price.
29 3

30 Write MySQL statements for the following:


i. To open database named school.

ii. 3

SECTION-D(5 MARKS)
31 Consider a table Teacher with the following data: 5

6
Write SQL queries using SQL functions to perform the following operations:

a) Convert all the Names into lower case.

b) Display the position of first occurrence of the string “a” in all values under Names column.

c) Display the four characters, starting from second character from all values in Department column.

d) Display the Names of all Teachers born in the month of july.

e) Display the name of Teachers born on Monday.

OR

Write suitable SQL query for the following:


i. Display 7 characters extracted from 7th left character onwards from the string ‘SHINING WORLD’.
ii. Display the position of occurrence of string ‘COME’ in the string ‘WELCOME TO NEW ERA’
iii. Round off the value 53.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 EMPID of the table “EMP‟.

7
32 5

Give proper labels and write a command to save figure

OR

Give proper labels and write a command to save the figure.


33 5

iv. Write command to create above dataframe

8
SECTION-E(4 MARKS)
34 4

35 Consider the following Data Frame df 4

A. Predict the output of the following python statement:


i. df.columns 1
ii. df.iloc[1:3,1:]
B. Write Python statement to add a new column ACC_NO
(with values as – [135,153,225,442]) before qty column
C. Write Python statement to export the DataFrame to a CSV file named data.csv stored at D:
drive.

You might also like