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

12TH IP SET A

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)
13 views

12TH IP SET A

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/ 7

SHREE SWAMINARAYAN ENGLISH MEDIUM SCHOOL [CBSE]- SALVAV, VAPI

HALF YEARLY EXAMINATION (2023-2024)


(SET A)
CLASS: XIIth (Com/Sci) DATE: 09/10/2023
SUBJECT: IP MAX.MARKS: 70
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 02 questions carrying 04 marks each.
(7)Section E has 03 questions carrying 05 marks each.
(8)All programming questions are to be answered using Python Language only.
SECTION A (1x18=18M)
1. We can analyse data in Python using
a)Series b)DataFrame c)Both a and b d)None of these
2. import pandas as pd
s=pd.Series([1,2,3,4,5],index=['akram','brijesh','charu','deepika','era'])
print(s['charu'])
a)1 b)2 c)3 4)4
3. Out of the following, which function can be used for customization of charts in
Python?
a) a) xlabel() b) title() c) xticks() d)All of these
4. _____ is default location of legends in the graph?
a) 1 b) 2 c) 3 d) 4
5. ____________is the argument that will change width of bars.
a) width= b) width() c) width[] d) Width=
6. ___________ shows continuous data in graph.
a) line plot b)bar graph c) histogram d)Statistical
7. ____ argument is used to specify with to_csv() to specify a separator
a) character b) char c)Separator d)sep
8. To read omit 2,4 and 5 row from read_csv() _____ is used.
a)skiprows=2,4,5 b)skiprows=(2,4,5) c)Skiprows=[2,4,5] d)skiprows=[2,4,5]
9 To omit indexing in csv file , argument written is _______.
a)Index=false b)index=False c)index=false c)index=None
10 In CSV file format ,C stands for
a) Compact b)Comma c) code d)command
11 To show name from mysql table that contains ‘A’ in it, query will be
a) select name from table where name=’%A%’ ; b) select name from table where name like
’%A%’;
c) select name from table where name like ‘A%’; d) select name from table where name like
’%A’ ;
12 ____ is a key that derives from another table.
a)Candidate key b)Alter key c) Foreign key d)Primary key

Page 1 of 7
13. Which statement will give answer 2035.3.
a) select year(curdate())+truncate(12.345,1);
b) select year(curdate())+truncate(12.345,2);
c)select year(curdate())+truncate(12.345,-1);
d) select year(curdate())+truncate(12.345);
14. _____ Keyword eliminates duplicate values from query result.
a) unique b)distinct c)only d)primary
15. Answer of the following command is :
year(curdate())+round(12.345,-2) |
a)2023 b)2123 c)2023.34 d)None
16. Select the mysql statement that will not produces the following output:
chapter 6
MY WORlD |
+----------+
| 15 |
+----------+
a) select length(trim(leading '$' from '$$$$my little world')) "MY WORlD";
b) select length(trim(leading '$' from '$$$$my little world')) ;
c) select length(trim(leading '$$$$' from '$$$$my little world')) "MY WORlD";
d) All of these
17. Assertion (A):-To create series from array, we have to import the numpy module and
then use array method.
Reasoning (R): - Numpy is numerical python library. Numpy contains a single
and multidimensional array.
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True
18. Assertion (A):- The ORDER BY clause of SELECT statement is carried out in the last after
execution of other clauses of select command.
Reasoning (R):- ORDER BY clause is carried out on the final result of the select
query.
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True

SECTION B 7X2=14M
19. Explain any two features of pandas..
OR
Differentiate between loc() and iloc() functions.
20. Explain bar() function in detail with its arguments.
21. Explain alter table and update commands.
22. Write difference between having and where in select command.
23. Write code to create csv file “MYFILE.CSV from given dataframe DF. Make sure null values
are handled properly.

Page 2 of 7
24 Consider table product with the following structure
(pno, pname, price)
programmer has to make table in such a way that all columns must contain value.
But when he is entering null in any column it is getting accepted. Tell him what mistake he
has done and also give him solution so that null cannot be entered
25. Consider table given below
Empl(eno,ename,job,sal,comm,hiredate,deptno)
write query to show avg salary of each department that has max salary >3000 .

SECTION C (5 X 3 = 15M)
26. Write a Python code to create a S e r i e s “ T e r m 1 ” a n d “ T e r m 2 ” t o s t o r e m a r k s o f
Term exams for 5 students (marks out of 500). Calculate percentage of
each term.
OR
Consider the given Data Frame ‘Exam’:
solve questions given below:
Name UT1 UT2
0 Nancy Drew 15 18
1 Hardy boys 18 22
2 Diary of a wimpy kid 22 11
3 Harry Potter 21 23
Write command for b and c
a) Write output of the command:
Exam.shape
b) Add column TOTAL to show total of UT1 and UT2.
c) Drop column UT2.
27. Write output of the following program
import pandas as pd
data={'first':pd.Series(['abc','xyz','pqr'],index=[11,12,13]),
'second':pd.Series(['The','That','This','ok'],index=[11,12,13,14])}
value=pd.DataFrame(data)
print(value)

28. Based on the SQL table CAR_SALES, write suitable queries for the following:
+ + + + + +
| NUMBER | SEGMENT | FUEL | QT1 | QT2 |
+ + + + + +
| 1 | Compact HatchBack | Petrol | 56000 | 70000 |
| 2 | Compact HatchBack | Diesel | 34000 | 40000 |
| 3 | MUV | Petrol | 33000 | 35000 |
| 4 | MUV | Diesel | 14000 | 15000 |
| 5 | SUV | Petrol | 27000 | 54000 |
| 6 | SUV | Diesel | 18000 | 30000 |
| 7 | Sedan | Petrol | 8000 | 10000 |
| 8 | Sedan | Diesel | 1000 | 5000 |
+ + + + + +
(a)Display petrol segment cars having QT1 between 50000 to 60000
(b)Delete row of Number 8
Page 3 of 7
(c) Display total quantity with heading “Total Quantity” with segment name of all the cars.
29. Explain the following functions with examples:
a) round()
b) sign()
c) power()
OR
Write Output of the following based on the table CAR_SALES given in Q.28
a) select substring(segment,2,3) from CAR_SALES where segment like ‘Compact%’;
b) select upper(right(segment,3)) from CAR_SALES where QT2<50000;
c)select instr(segment,”Com”)+mod(QT1,4) from CAR_SALES where QT1<30000;
30. Based on the SQL table CAR_SALES, write suitable queries for the following:
+ + + + + +
| NUMBER | SEGMENT | FUEL | QT1 | QT2 |
+ + + + + +
| 1 | Compact HatchBack | Petrol | 56000 | 70000 |
| 2 | Compact HatchBack | Diesel | 34000 | 40000 |
| 3 | MUV | Petrol | 33000 | 35000 |
| 4 | MUV | Diesel | 14000 | 15000 |
| 5 | SUV | Petrol | 27000 | 54000 |
| 6 | SUV | Diesel | 18000 | 30000 |
| 7 | Sedan | Petrol | 8000 | 10000 |
| 8 | Sedan | Diesel | 1000 | 5000 |
+ + + + + +
Write Output
a) select count(distinct FUEL) from CAR_SALES;
b) Select max(QT1) from CAR_SALES group by SEGMENT
c) Show QT2 of all cars in descending order.

Differentiate between MAN and WAN


SECTION D (2 X4 = 8M)
31 Write commands to perform given tasks based on the given dataframe – df

Gr Sname Std Section Gender Date Of Birth

1 1284 Shashi I A Girl 07/08/2010


2 1285 Soumy I B Boy 24/02/2011
a
3 1286 shreya I C Boy 29/12/2010

Write Output
a) df.index
b) df.dtypes
c) Add new column last_school- [‘kids nursery’,’Daisy nursery’, NaN]
d) show Gender of index 3.
OR
Predict the output of the following statement
a)df.loc[:, ‘Sname’]

Page 4 of 7
b)df.at[3,’Std’]
c)df[[‘Sname’,’Section’]]
d)df.loc[2]

32 Shreya, a database administrator has designed a database for a clothing shop.


Help her by writing answers of the following questions based on the given
table:
TABLE: CLOTH
CCODE CNAME SIZE COLOR PRICE DOP
C001 JEANS XL BLUE 990 2022-01-21
C002 JEANS M RED 599 2021-12-12
C003 TROUSER M RED 399 2021-11-10
C004 SAREE FREE GREEN 1299 2019-11-12
C005 SAREE L GREEN 399 2021-12-07
give output of the following query
i.select sum(price) from CLOTH group by size having avg price <1200;
ii.select CNAME,count(CNAME) from CLOTH group by CNAME
iii.Write a query to show costliest price from table size.
iv. Write query to get count of SIZE column. Skip duplicate values from counting.

SECTION E (5 X 3 = 15M)
33. Write commands for the following questions
a) Write statement to calculate your age.
b) Display day name of your date of birth
c) show square root of 121.
Write output
d) select mod(truncate(13.9675432,3),2);
e) select left(“Country”),right(“Manager”);
34. Rajesh is new to python and he wants to show data in cumulative histogram with 4 bins in
it. Help him write program for the same.

Data
Marks1=[200,450,300,400,420]
Marks2=[250,300,430,234,500]
OR
Complete the following graph

Page 5 of 7
35. a) write commands for the following questions based on the Series given below:

Series:s1
a 97
b 98
c 99
d 100
e 101
a) Set NaN to index ‘c’
b) Create copy of s1
c) Check datatype of s1 series.
d) Divide all values of s2 by 2
e) Show values more than 95.

Page 6 of 7
Page 7 of 7

You might also like