International Indian School, Riyadh WORKSHEET (2020-2021) Grade - Xii - Informatics Practices - Second Term

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

INTERNATIONAL INDIAN SCHOOL, RIYADH

WORKSHEET (2020-2021)

GRADE - XII – INFORMATICS PRACTICES – SECOND TERM


UNIT -1 DATA HANDLING USING PANDAS AND DATA VISUALIZATION
1 What is Series data structure. Explain with example.
2 Series is a one-dimensional labeled array capable of holding any data type.
3 Series([],dtype=___________)
4 What will be the index values of print(pd.Series([[1,2,3]])
5 Which type of input is used in the statement: a=pd.Series(10,index=[1,2,3])
6 print(a=pd.Series([5,np.NaN,7])). What will be the data type of the output.
7 What is the shape of series data structure whose size is 4.
8 What type of output returned by print(a.values) (Consider 'a' is series data structure)
9 What will be the output of the following code.

10 What will be the output of the following program.

11 What will be returned by tail(0) in series data structure


12 What will be the output of the following python code.

13 Consider the given series s1. What will be returned by s1.count()?

14 What will be returned by print(a+c)

Page 1 of 9
15 What will be returned by the following statement. print(s>7)

16 Consider a=pd.Series(np.arange(1,20,4)).
a) What will be displayed by print(a[:4])
b) What will be displayed by print(a[::-2])?
c) What will be displayed by print(a[1:6:3])?
d) What will be displayed by print(a+7)?
print(a>10)?
17 All pandas data structures are ________ mutable but not always ____________ mutable.
18 What will be returned by the following python code.

19 Write the python code to create the following series data structure.

20 Consider the code given below, what will be the indexes of the result

21 What will be the shape of the given series data.

Page 2 of 9
22 What will be printed by the following python code:

23 What will be returned by the following statements. print(y['c']) and print(y['a'])

24 How many rows will be taken out by head() function?


25 Consider the series object T1 which stores temperature of 30 days. Write the code to
display the temperature recorded on first 10 days.
26 What is the data type of empty series data structure?
27 Expand CSV .
28 Which function can be used to delete more than one column at a time in a data frame
29 If data is an ndarray, index must be the same length as data. (True/False)
30 What will be the output produced by the following python code:

.
31 Consider a data frame 'studentdf' contains information about student having columns
rollno, name,class and section. Write the statement to add one more column as fee
32 Consider a data frame 'studentdf' contains information about student having columns
rollno, name,class and section. Write the statement to delete column fee of data frame.
33 What will be the output produced by the following code:

Page 3 of 9
34 What will be the output of the following code:

35 Write a python code to create a data frame with appropriate headings from the list given
below: [‘A101’,
‘Anil’,8000],[‘A102’,’Manish’,4000],[‘A103,’Naren’,7500],[‘A104’, ‘Dima’,5000]
Given a data frame df1 as shown below: Answer the following questions:
(i) Write a command to list the brand and price of all rows.
(ii) Write a command to list the year of rows 1 and 2
(iii) Write a command to change the names of rows into zero,one,two,three.
(iv) Write a command to delete the column Price
(v) Write the command to list the rows 0,2 and 3

36 What will be the output of the following statement. Consider a dataframe df1 given.
print(df1.iat[3,2])

37 Write the command to get the output as shown in the image below from the given input:

Page 4 of 9
38 Write a python code to create a data frame with appropriate headings/ column names from
the list given below:
[‘S101’, ‘Amy’, 70], [‘S102’, ‘Bindhu’,90],[‘S104’,’Cathy’,85],[‘S105’, ‘Gundaho’,82]
Write a python code to create a data frame df1 with heading a, b from the list given below:
[[1,2],[3,4],[5,6],[7,8]]
Given a data frame df1 as shown below:
City MaxTemp MinTemp RainFall
Delhi 40 32 24.1
Bengaluru 31 25 36.2
Chennai 35 27 40.8
Mumbai 29 21 35.2
Kolkata 39 23 41.8

i. Write a command to list Maximum temperature of all cities using loc.


ii. Write a command to list the Maximum and minimum temperature of Chennai
using loc.
iii. Write a command to list the weather details of Bengaluru and Kolkata using loc.
iv. Write a command to list the weather details of Delhi, Bengaluru and Chennai
using iloc.
v. Write a command to list Mumbai’s MaxTemp and Rainfall using iloc.
vi. Write a command to list MinTemp and Rainfall of all cities using iloc
vii. Write a command to change all cities names into capital letters.
viii. Write a command to change the column name MaxTemp and MinTemp to
TempMax and TempMin respectively.
ix. Write a command to change the order of cities to Mumbai, Kolkata, Delhi,
Bengaluru and Chennai.
x. Write a command to change the order of columns into Rainfall, MinTemp and
MaxTemp.
39 Write a python code to create a data frame commodity given below:

Page 5 of 9
40

41

42

UNIT – 2 DATABASE QUERY USING SQL


1. What is the purpose of Distinct Clause?
2. Differentiate char and varchar.
3. What is the purpose of commit and rollback statement?
4. A table “stock” in a database has 5 column and contains 17 records. What is the degree
and cardinality of this table?
5. While creating a table “customer” Simrita forgot to set the primary key for the table. Give
the statement which she should write now to set the column “CustID” as the primary key
of the table?
6. In a student table .out of RollNumber, Name, Address, which column can be set as
primary key and why?
7. The Item_No and Cost column of a table “ITEMS” are given below:

Page 6 of 9
ITEM_NO COST
101 5000
102 NULL
103 4000
104 6000
105 NULL
Based on this information . find the output of the following queries:
i. SELECT COST FROM ITEMS;
ii. SELECT COST+100 FROM ITEMS WHERE ITEM_NO>103;
8. Explain the purpose of DDL and DML commands used in SQL. Also give two examples
of each.
9. Differentiate alter table drop command and drop table command with example.
10. Consider the table TEACHER given below. Write commands in SQL FOR (1) to (4) and
output for (5) to (8)
TEACHER

i. To display all information about teacher of PGT category


ii. To list the names of female teachers of Hindi department
iii. To list names, Departments and date of hiring of all the teachers in ascending order
of date of joining.
iv. To count the number of teachers in English department.
v. SELECT Hiredate FROM Teacher;
vi. SELECT DISTINCT (Category) FROM Teacher;
vii. SELECT gender FROM TEACHER WHERE category =’PGT’;
viii. SELECT Salary FROM TEACHER group by Gender;
11. Write MySQL command that will be used to open an already existing database
STUDENT
12. The Name column of a table city is given below
Name
Abhi
Naman
Ankur
Rajeev
Based on the information, find the output of the following queries:
Page 7 of 9
1.Select Name from city WHERE Name LIKE “%N”;
2.Select Name from city WHERE Name LIKE “%E”;
13. A Table MEMBERS in a database has degree 5 and cardinality 10. What is the number of
rows and columns in it?
14. Differentiate between alternate key and candidate key.
15. AnPhone_no consisting of 10 digits is stored in a string variable strphn. Now, Mr.Ram
wants to store this number in integer type of variable intphn. Write a java statement to do
this.
16. Saumya , a student of class X, created a table EMPLOYEE. Rank is one of the column of
this table. To find the details of employees whose rank have not been entered, he wrote
the following MySQL query, which did not give the desired result.
SELECT * FROM EMPLOYEE WHERE Rank = “NULL”;
Help Saumya to run the query by removing the errors from the query and write the correct
query.
17. What is the purpose of DROP TABLE command in MySQL? How is it differ from
DELETE command?
18. Table Employee has 4 records and Table Dept has 3 records in it. Mr.Jain wants to display
all information stored in both of these related tables. He forgot to specify equi-join
condition in the query. How many rows will get displayed on execution of this query?
19. Consider the table RESULT given below. Write commands in MySql for (i) to (iv) and
output for (v) to (vii)
Table : RESULT
No. Name Stipend Subject Average Division
1. Sharon 400 English 38 THIRD
2. Amal 680 Mathematics 72 FIRST
3. Vedant 500 Accounts 67 FIRST
4. Shankeer 200 Informatics 55 SECOND
5. Anandha 400 History 85 FIRST
6. Upasna 550 Geography 45 THIRD
i. To list the name of those students, who have obtained Division as FIRST in the
ascending order of NAME.
ii. To display a report listing NAME, SUBJECT and Annual stipend received
assuming that the stipend column has monthly stipend.
iii. To count the number of students, who have Accounts or Informatics as Subject
iv. To insert a new row in the RESULT: ”Mohan”, 500, “English”, 73, “SECOND”
v. SELECT stipend FROM RESULT WHERE DIVISION =”THIRD’;
vi. SELECT DISTINCT Subject FROM RESULT;
vii. SELECT Average FROM RESULT WHERE Subject = “English”;
20. What is the benefit of Transaction?
21. What are the five states of the transaction?
22. What will happen when COMMIT statement is issued?
23. What will happen when ROLLBACK statement is issued?
24. How can you start a new transaction? Write the steps
25. Write the SQL command to create the table PRODUCT including its constraints.
Table : PRODUCT
Page 8 of 9
Name of Column Datatype Constrint
PID Int(4) PRIMARY KEY
P_Name VARCHAR(15) NOT NULL
P_Company VARCHAR(15) NOT NULL
Price DOUBLE(10) DEFAULT 1000
26. Write the MySql command for creating a table “BANK” whose structure is given below..
Table : BANK
Field Name Data Type Size Constraint
Acct_number Integer 4 Primary key
Name Varchar 3
BirthDate Date NOT NULL
Balance Integer 8 Not Null

PREPARED BY:

XI-XII BOYS SECTION

Page 9 of 9

You might also like