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

QP Xii Ip Hy 2024-25

exam
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)
98 views9 pages

QP Xii Ip Hy 2024-25

exam
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 – (2024-25)


CLASS - XII
INFORMATICS PRACTICES (065)
MM. -70 TIME ALLOWED: 03 hrs
GENERAL INSTRUCTIONS:
 Please check this question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
 The paper is divided into 5 Sections- A, B, C, D and E.
 Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
 Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
 Section C consists of 4 questions (29 to 32). Each question carries 3 Marks.
 Section D consists of 2 case study type questions (33 to 34). Each question carries 4 Marks.
 Section E consists of 3 questions (35 to 37). Each question carries 5 Marks.
 All programming questions are to be answered using Python Language only.
 In case of MCQ, text of the correct answer should also be written.

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

1
d. None of Above

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(FEES) FROM STUDENT ;

a. 8000 b. 8004
c. 8005 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

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

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])
print(info[info>=50])
print(info>50)

4
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;


ii. SELECT MAX(CLASS) FROM SCHOOL WHERE PERCENT<90;
iii. 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:
[[101,'AMIT',98],[102,'RAJVEER',95],[103,'SAMAR' ,96], [104,'YUVI',88]]

28 Consider the given DataFrame “BOOK‟: 3


Name Price
5
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‟.
32 Write Python code to plot a bar chart for No of Games Tally in State Level Sports shown below: 5

7
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

SECTION-E(4 MARKS)
34 4

35 Consider the following Data Frame df 4

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy