0% found this document useful (0 votes)
12 views8 pages

Xii Ip CT - 2 Key

This document is a cycle test paper for Grade XII in Informatics Practices, consisting of two parts: Part-A with short answer questions and Part-B with descriptive questions. The test covers topics such as SQL queries, Pandas library usage, and data manipulation. It includes various question formats, including multiple choice, coding tasks, and theoretical explanations.

Uploaded by

magiswathi16
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)
12 views8 pages

Xii Ip CT - 2 Key

This document is a cycle test paper for Grade XII in Informatics Practices, consisting of two parts: Part-A with short answer questions and Part-B with descriptive questions. The test covers topics such as SQL queries, Pandas library usage, and data manipulation. It includes various question formats, including multiple choice, coding tasks, and theoretical explanations.

Uploaded by

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

VALLABA VIDYALAYA

CYCLE TEST – II (2025-2026)

GRADE: XII INFORMATICS PRACTICES (065) MARKS: 35


DATE: 16.07.25 TIME: 1:30 hrs

General Instructions:
1. This question paper contains two parts A and B. Each part is compulsory.
2. Part-A has short answer questions, to be answered in one word or one line.
3. Part - B is DescriptivePaper. Part- B has three sections
a. Section-I is short answer questions of 2 marks each
b. Section-II is long answer questions of 3 marks each
c. Sections III and IV consist of long answer questions.
PART-A

Q.n Questions Marks


o

1. Which of the following statement will install pandas library in python? ½


i. Pip install pandaspd
a) ii. pip install pandas as pd
iii. pip install pandas.pd
iv. pip install pandas

b) In Pandas which of the following dataframe attribute can be used to know the number
of rows and columns in a ½
dataframe
a. size b. index c. count d. shape

2. Gopi Krishna is using a table Employee. It has the following columns : 1


Code, Name, Salary, Dept_code
He wants to display maximum salary department wise. He wrote the following
command :
SELECT Dept_code, Max(Salary) FROM Employee;
But he did not get the desired result.
Rewrite the above query with necessary changes to help him get the desired output.
Gopi Krishna's query is missing a crucial part: the GROUP BY clause. To get the
maximum salary department-wise, we need to group the data by Dept_code

SELECT Dept_code, MAX(Salary)


FROM Employee
GROUP BY Dept_code;

3 If column “Marks” contains the data set (50,48,50,40, NULL), what will be the output 1
. after the execution of the given query?
SELECT AVG (Marks) FROM student;
i. 37.6 ii. 47 iii. 46 iv. 45

The AVG() function ignores NULL values in calculations.

Sum = 50 + 48 + 50 + 40 = 188

Count = 4 (not 5, because NULL is ignored)

Average = 188 / 4 = 4

4. Assertion (A): - ndim attribute in a series object will return 10 1


Reasoning (R): - Series is a one-dimensional data structure.

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

PART-B(Section-I)

5. Create the series and find which subject mark is 88 2


Index Marks
English 75
Hindi 78
Maths 82
Science 88
i)Create series by any one method [1 mark]
marks[marks == 88] [1 mark]

6. Answer the following based on the series given below: 2


import pandas as pd
list1=[1,2,3,4,5,6,7,8]
list2=['swimming','tt','skating','kho kho', 'bb', 'chess', 'football',"cricket"]
school=pd.Series(list1,index=list2)
print (school*2) #statement 1
print (school.tail(3)) # statement 2
print (school["tt"]) # statement 3
print (school[2:4]) # statement 4

#statement 1

swimming 2
tt 4
skating 6
kho kho 8
bb 10
chess 12
football 14
cricket 16
dtype: int64

#statement 2

chess 12
football 14
cricket 16

# statement 3
school["tt"]

# statement 4

skating 3
kho kho 4
dtype: int64

[OR]

Consider the following Series object, ages


Rohit 35
Dhoni 36
Virat 32
Dhawan 35

i. Write the command which will update the age of Dhoni to 41.
ii. Write the command to name the series as Players.
iii Which command gives o/p as (4,), Which command gives o/p as 1
iv. Write the command which will give name for index n
I) ages["Dhoni"] = 41 II) ages.name = "Players" III)ages.shape ages.ndim

IV) ages.index.name = "n"

7. What is the difference between order by and group by clause when used along with 2
SELECT statement? Explain with an example.

The GROUP BY statement groups rows that have the same values
into summary rows, like "find the number of customers in each
country".

The GROUP BY statement is often used with aggregate functions


(COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by
one or more columns.

Order by keyword sort the result-set either in ascending or descending


order. This clause sorts the result set in ascending order by default.
8. What will the output of the following : 2
0 1 2
0 10 20 30
1 40 50 60
2 70 80 90
print(df.count())

0 3
1 3
2 3
dtype: int64

PART-B(Section-II)

10. Find the output of the following code: 3


import pandas as pd
data = [{‘a’: 10, ‘b’: 20},{‘a’: 6, ‘b’: 32, ‘c’: 22}]
df1 = pd.DataFrame(data, index=[‘first’, ‘second’], columns=[‘a’, ‘b’])
df2 = pd.DataFrame(data, index=[‘first’, ‘second’], columns=[‘a’, ‘b1’])
print(df1)
print(df2)

o/p
a b
first 10 20
second 6 32

a b1
first 10 NaN
second 6 NaN

12. 3

i .select avg(mark),city from student group by city having avg(marks)>400;


ii.select max(mark) from student group by class;
iii. select count(*) from student group by city;

PART-B(Section-III)

14. 4
Write suitable SQL queries for the following task:
i) Dispaly all details of employee and reward table
ii) Display each department name and its corresponding average salary
iii) Display the first name and date of reward of those employees

SELECT *FROM employee, reward


WHERE employee.emp_id = reward.emp_id;

SELECT dept_name, AVG(salary) AS avg_salary FROM employee


GROUP BY dept_name;

SELECT employee.first_name, reward.reward_date FROM employee, reward


WHERE employee.emp_id = reward.emp_id;

15. Create this dataframe and apply its attributes: 4

Name Age Team


0 Rohit 35 MI
1 Dhoni 41 CSK
2 Virat 32 RCB
3 Dhawan 35 DC

import pandas as pd

# Create DataFrame
data = {
"Name": ["Rohit", "Dhoni", "Virat", "Dhawan"],
"Age": [35, 41, 32, 35],
"Team": ["MI", "CSK", "RCB", "DC"]
}

df = pd.DataFrame(data)

# Print the DataFrame


print("DataFrame:\n", df)
# Apply and print various attributes
print("\nShape of DataFrame:", df.shape) # (rows, columns)
print("Number of dimensions:", df.ndim) #2
print("Total number of elements:", df.size) # rows * columns
print("Column names:", df.columns) # Index of column names
print("Row index:", df.index) # Index of rows
print("Values (as array):\n", df.values) # Numpy array of data
print("Data types of columns:\n", df.dtypes) # Data type of each column
print("Axes of DataFrame:\n", df.axes) # [index, columns]

2+2

What will be the output of the following command?


i)Select * from student where gender = ”F” order by marks;

ii)Give the command to display average marks of all classes in descending order.

SELECT Class, AVG(Marks) AS avg_marks


FROM STUDENT
GROUP BY Class
ORDER BY avg_marks DESC;

PART-B(Section-IV)

16. Create this DF by list of series method: 5

Name Age Team


0 Rohit 35 MI
1 Dhoni 41 CSK
2 Virat 32 RCB
list of dict method:
data = [ {"Name": "Rohit", "Age": 35, "Team": "MI"},{"Name": "Dhoni", "Age": 41,
"Team": "CSK"},{"Name": "Virat", "Age": 32, "Team": "RCB"}]

df1 = pd.DataFrame(data)
print("DataFrame from List of Dicts:\n", df1)

# List of Series
s1 = pd.Series(["Rohit", 35, "MI"],["Name", "Age", "Team"])
s2 = pd.Series(["Dhoni", 41, "CSK"],["Name", "Age", "Team"])
s3 = pd.Series(["Virat", 32, "RCB"],["Name", "Age", "Team"])

df2 = pd.DataFrame([s1, s2, s3], columns=["Name", "Age", "Team"])


print("\nDataFrame from List of Series:\n", df2)

You might also like