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

12-IP-Revision Assignment For PreBoard

This document contains a revision assignment for Class 12 students studying Informatics Practices. It includes questions on Python programming, Pandas, SQL, and computer networks. The questions cover topics like dataframes, series, SQL queries, network types, browsers, VOIP, firewalls, bus topology and the differences between web pages and sites and add-ons vs plugins.

Uploaded by

Dhwani Patel
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)
222 views

12-IP-Revision Assignment For PreBoard

This document contains a revision assignment for Class 12 students studying Informatics Practices. It includes questions on Python programming, Pandas, SQL, and computer networks. The questions cover topics like dataframes, series, SQL queries, network types, browsers, VOIP, firewalls, bus topology and the differences between web pages and sites and add-ons vs plugins.

Uploaded by

Dhwani Patel
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/ 4

CLASS XII

REVISION ASSIGNMENT
SUBJECT: INFORMATICS PRACTICES

Q1.
(a) What will be the output of the following program:
import pandas as pd
s = pd.Series([“C++”, “VB”, “Python”, “AI” ],index=[10,20,30,40])
(i) print(s>2) ............... error
(ii) print(s.iloc[3]) ................... AI
(iii) print (s[::2] ------------10 c++, 30 python
(iv) print(s.dtype) ----------- string
(a) Write python code to display values corresponding to the indexes 30 and 40.
Ans: s.loc[[30,40]]
(b) Write a program to create a series to store the number of students enrolled in 5
games during summer camp. The game names are the indexes and the number
of students as the data. The data is stored in a python list. Let the name of the
series be games.
Ans: import pandas as pd
import numpy as np
number=np.array([34,54,12,23,12])
games=pd.Series(number,index=['Football','Basketball','Badminton','Table Tennis','Chess'])

Q2.
(a) Write output of following code:
import pandas as pd
data = [['Ram',10],['Shyam',12],['Rima',13]]
df = pd.DataFrame(data, columns=['Name', 'Age'], dtype = float)
print( df)

Ans:
Name Age
0 Ram 10.0
1 Shyam 12.0
2 Rima 13.0

(b) Consider the CSV file named DOCTOR containing the details name, dept and
fees. Create a dataframe from the csv file using only the name and dept
columns.
Ans: import pandas as pd
doc=pd.read_csv('d:\\doctor.csv',usecols=['name','dept'])
print(doc)

(c) Hitesh wants to display the last four rows of the data frame df and has written
the following code :
df.tail( ).
But last 5 rows are being displayed. Identify the error and rewrite the correct
code so that last 4 rows get displayed.
Ans: df.tail(4)
Q3.
(a) Write python statements to create a data frame “STAFF” for the following
data.
Name Age Designation
T100 YAMINI 35 PRINCIPAL
T101 DINESH 40 SYSTEM MANAGER
T102 SHYAM 50 TEACHER
T103 VINOD 45 ACCOUNTANT
T104 SYRIA 30 RECEPTIONIST
(b) Write the python code to rename the column designation to desig in the
dataframe created in the previous question.
(c) Add one more student‟s record permanently in the dataframe.
(d) Add one more column to store the fee details.
(e) Write python code to delete column fee of data frame permanently.
(f) Write python code to delete the 3rd and 5th rows from dataframe.
(g) Write a python code to display the name and designation of employees whose
age more than 40 and less than 50.
(h) Change the designation of Shyam to Vice Principal
(i) Display the details of teachers having the index as T101, T103.

Ans: (a) import pandas as pd


data={'name':['Yamini','Dinesh','Shyam','Vinod','Syria'],'Age':[35,40,50,45,30],'design
ation':['Principal','System Manager','Teacher','Accountant','Receptionist']}
staff=pd.DataFrame(data,index=['T100','T101','T102','T103','T104'])
print(staff)

(b)staff.rename(columns={'designation':'desig'})
Note: use inplace=True, if you want permanent renaming

(c)staff.loc['T105']=['Ram',15,'Student']

(d)staff['fees']=[6000,7000,4500,4600,4900,12000]

(e) staff.drop(columns='fees',inplace=True)

(f)staff.drop(df.index[[2,4]])

(g)staff.loc[(staff.Age>40)&(staff.Age<50),['name','designation']]

(h)staff.loc[staff.name=='Shyam','desig']='Vice Principal'

(i)staff.loc[['T101','T103']]
SECTION-B
Q4.
(a) Write the difference between Single-Row Functions and Multiple-Row
Functions in SQL with example.
(b) What is the error in the given query. Rewrite the corrected code.
Select dept, max(salary) from emp where city =”Delhi”;
Ans: use of group by dept is missing
Q5. Write an SQL query to create the table „Menu‟ with the following structure.
Field Type
ICode Varchar(5)
IName Varchar(20)
Color char(10)
Category Varchar(20)
Price Decimal(5,2)
DOM datetype

Q6. Considering the table created above, write queries to do the following:
(a) WAQ to display the category wise maximum price.
(b) WAQ to display those categories of items, whose average price is less than
5000.
(c) WAQ to display the item name along with how old that item is (in terms of
months).
(d) WAQ to display the first two characters of the item code along with the price
rounded off to hundredth place for all items.
(e) WAQ to display the current date and time.
(f) WAQ to display the number of items in each colour category.
Ans 6:
(a) select category, max(price)
from menu
group by category;

(b) select category, avg(price)


from menu
group by category
having avg(price)<5000;

(c) select iname, month(curdate())-month(dom) as "age"


from menu;

(d) select left(icode,2) as "ICODE", round(price,-2) as "PRICE"


from menu;

(e) select now();

(f) select color,count(*)


from menu
group by color;
Q7. Write the output of the following SQL queries:
(a) SELECT MOD(7,3);
(b) SELECT SUBSTR (“TITANIC”,-2,3);
(c ) SELECT TRUNCATE(45.678,1);
(d) SELECT ROUND(678.345, -2);
(e) SELECT DAYOFMONTH(„2009-08-24‟);
(f) SELECT LEFT(TRIM(„ WELCOME ALL ‟),7);
Ans:
(a) 1
(b) IC
(c)45.6
(d)700
(e) 24
(f)WELCOME
Q8 Consider the following SQL string: “Python”
Write commands to display:
a) “thon”
b) “on”

Q9. What is the use of AVG() function in SQL.

SECTION-C
Q10
(a) Two doctors in the same room have connected their palm tops using Bluetooth
for working on a group presentation. Out of the following, what kind of
networks they have formed? LAN, MAN, PAN, WAN.
Ans: PAN
(b) What type of network would you suggest for following type of requirements of
an organization:
 Around 200 computers in two different buildings adjacent to one another are to
be connected.
 The cost of network should not be very high.
 It should be fairly easy to implement.
Ans: LAN
(c) Name any two most popularly used browsers.
Ans: Google Chrome, IE, Mozilla Firefox, Microsoft edge
(d) What out of the following, will you use to have an audio-visual chat with an
expert sitting in a far-away place to fix-up a technical issue?
VOIP, Email, Chat
Ans: VOIP
(e) Define: i. Firewall ii. Modem
(f) Give two demerits of bus topology.
(g) Differentiate between web page and web site?
(h) Explain the difference between add ons and plug ins giving examples?

You might also like