0% found this document useful (0 votes)
18 views11 pages

PB 2

The document is a preboard examination paper for Class XII Computer Science at Delhi Public School Agra for the academic year 2024-25. It contains 37 questions divided into five sections, covering topics such as SQL commands, Python programming, and database management. Each section has varying marks assigned, and all programming questions must be answered using Python.

Uploaded by

nidhi
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)
18 views11 pages

PB 2

The document is a preboard examination paper for Class XII Computer Science at Delhi Public School Agra for the academic year 2024-25. It contains 37 questions divided into five sections, covering topics such as SQL commands, Python programming, and database management. Each section has varying marks assigned, and all programming questions must be answered using Python.

Uploaded by

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

DELHI PUBLIC SCHOOL AGRA

(Under the aegis of The Delhi Public School Society, East of Kailash, New Delhi)

PREBOARD EXAMINATION - 2024-25


CLASS – XII
COMPUTER SCIENCE
SET-2

Time: 3 Hrs
MM: 70

General Instructions:
● 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 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 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 (Each question carries 1 mark)

1. Identify the correct SQL command to fetch all student names who scored above 80 marks:
(a) SELECT * FROM students WHERE marks > 80;
(b) SELECT name FROM students WHERE marks > 80;
(c) SELECT name FROM students WHERE marks >= 80;
(d) None of the above
2. Which of the following is used to retrieve records in descending order in SQL?
(a) ORDER BY DESC
(b) SORT DESCENDING
(c) GROUP BY DESC
(d) ARRANGE BY DESC
3. Expand CDMA.
4. ____________ is a protocol used for secure communication over a computer network.
5. Which SQL command is used to delete a column from a table?
(a) DROP COLUMN
(b) DELETE COLUMN
(c) ALTER TABLE
(d) REMOVE COLUMN
6. What will be the output of the following Python code?
lst = ["hello", 20, [5, 6]]
print(lst[1:])
7. Which of the following operators is used to perform integer division in Python?
(a) /
(b) //
(c) %
(d) div
8. ____________ is used to display the structure of a database.
9. A database table has 12 rows and 4 columns. What are its degree and cardinality?
(a) 4, 12
(b) 12, 4
(c) 5, 12
(d) 4, 5
10. What is the output of the following Python code?
t = (7, 8, (9,7))
print(len(t))
11. Write one difference between extend and append functions of a list.
12. Which data structure is implemented using LIFO (Last In First Out) principle?
(a) Queue
(b) Stack
(c) Array
(d) List
13. Which file mode allows both reading and writing, but raises an error if the file does not exist?
(a) w
(b) r+
(c) a+
(d) ab
14. Write the syntax for the tell() function in Python.
15. __________ arguments in Python functions must be passed in the exact order in which they
are defined in the function signature.
16. State whether the following statement is True or False: The except block in Python is
executed only if no exception occurs in the try block.
17. What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
18. What does the list.remove(x) method do in Python?
(A) Removes the element at index x from the list
(B) Removes the first occurrence of value x from the list
(C)Removes all occurrences of value x from the list
(D)Removes the last occurrence of value x from the list.
19. If a table which has one Primary key and two alternate keys. How many
Candidate keys will this table have?
(A) 1
(B) 2
(C) 3
(D) 4
20–21. Assertion-Reasoning Questions: Mark the correct choice.
(a) Both Assertion (A) and Reason (R) are true, and R is the correct explanation of A.
(b) Both Assertion (A) and Reason (R) are true, but R is not the correct explanation of A.
(c) Assertion (A) is true, but Reason (R) is false.
(d) Assertion (A) is false, but Reason (R) is true.
20. Assertion (A): A foreign key in SQL ensures referential integrity between tables.
Reason (R): A foreign key uniquely identifies each record in a table.
21. Assertion (A): Python lists are mutable, while tuples are immutable.
Reason (R): Mutability means that the values of the object in can be changed after it is
created.
SECTION B (Each question carries 2 marks)
22. What are the differences between a shallow copy and a deep copy in Python? Provide
examples.
23. Predict the output of the following code snippet:
y=8
def multiply():
global y
y=y*2
print(y)
multiply()
y = 16
print(y)
OR
What is LEGB? Differentiate between global and local scope.
24. Differentiate between PRIMARY KEY and UNIQUE constraints in SQL.
25. A table named EMPLOYEE has the following structure:

Field Data Type

EmpID INT (5)

Name VARCHAR(50)

Salary FLOAT

a. Write a SQL query to increase the salary of all employees by 10%.


b. Write a query to add a column named designation with datatype char(20).
OR
a. Write a query to create the above Employee table.
b. Are there any alternate keys in the table Employee, if EmpID is the primary key? Why/
Why not?
26. Consider the following nested list:
data = [["Paris", "France", 8000], ["Mumbai", "India", 1800], ["Berlin", "Germany", 3200]]
Write a Python function to create a list with city not belonging to India.
27. The code provided below is intended to swap the first and last elements of a given tuple.
However, there are syntax and logical errors in the code. Rewrite it after removing all errors.
Underline all the corrections made.
def swap(t)
if len(t)<2:
return t
nt=(t[-1],)+t[1:-1]+(t[0])
return nt
res=swap((1,2,3,4))
print(res)

28. Which communication channel is/are suitable in each of the following situations?
(i) Transfer of data from one mobile to another.
(ii) Communication in a hilly area.
OR
a. Write the difference between Bridge and gateway.
b. Expand POP. Give one use of POP in the context of networking.
SECTION C (Each question carries 3 marks)
29. Write a function in Python to read a text file, data.txt, and replaces all the occurrences of ‘s’
with ‘$’
OR

Write a function in Python to create a file upper.txt that has the content of poem.txt in
uppercase.
30. Consider the following SQL table STUDENT:

RollNo Name Marks City

101 Rahul 85 Delhi

102 Priya 92 Mumbai

103 Ankit 74 Kolkata

Write SQL queries to:


(a) Display the names of students who scored above 80 marks.
(b) Change the city of Ankit to "Chennai".
(c) Delete the record of students with marks below 75.
OR
Expertia Technologies is designing a database to manage their product sales. Consider the
following two tables:
Table: PRODUCT

PID ProductName Price Brand

201 Laptop 60000 HP

202 Smartphone 20000 Samsung

203 Tablet 30000 Lenovo

Table: SALES

SaleID PID Quantity SaleDate

501 201 5 2024-01-01

502 202 10 2024-01-03

Write SQL queries to:


(a) Display the total sales (Quantity × Price) for each product.
(b) List the products that belong to the "HP" brand.
(c) Add a new sale record to the SALES table.
31. Write a Python function to implement a stack that stores integers. The function should
include:
(a) Push operation.
(b) pop an element and return it or return None if stack is empty.

OR
Write the definition of a user-defined function `push_even(N)` which accepts a list of integers
in a parameter `N` and pushes all those integers which are even from the list `N` into a Stack
named `EvenNumbers`. Write function pop_even() to pop the topmost number from the
stack and returns it. If the stack is already empty, the function should display "Empty".
For example:
If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12]
Then the stack `EvenNumbers` should store:
[10, 8, 12]

SECTION D (Each question carries 4 marks)


32. A csv file "Happiness.csv" contains the data of a survey. Each record of the file contains the
following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that country)
● Happy (Number of persons who accepted that they were Happy)
For example, a sample record of the file may be:
[‘Signiland’, 5673000, 5000, 3426]
Write the following Python functions to perform the specified operations on this file:
(I) Read all the data from the file in the form of a list and display all those records for which
the population is more than 5000000.
(II) Count the number of records in the file.

33. Write the following SQL queries based on the EMPLOYEE table below:

EmpID Name Department Salary


101 Rahul HR 45000

102 Priya IT 55000

103 Arjun HR 40000

104 Divya Finance 60000

(a) Display the names of employees working in the HR department.


(b) Find the average salary of employees in the IT department.
(c) Update the salary of all employees in the Finance department by 10%.
(d) Delete the records of employees whose salary is below 45000.
OR
(d) Display the table structure.
34. A table named ITEM is created in a database STORE. The table contains multiple columns
whose details are as shown below:
•Ino(Item number )- integer
• Iname(Item Name) – string
• Price (Item Price) – float
• Discount (Discount) – float
Note the following to establish connectivity between Python and MySQL:
•Username – root
•Password – tiger
•Host – localhost
However, the table is to be interfaced with Python to perform certain tasks. The
incomplete code is given below:
______ #Line 1
con1= mysql.connect(host=’localhost’, user = ‘root’, password = ‘tiger’, database=’STORE’)
mycursor = con1.____ #Line 2
A=5000
query = ‘SELECT * FROM ITEM where Price > {}’.format(___) #Line3
mycursor.execute(query)
data = mycursor.___ #Line 4
for rec in data:
print(rec)
con1.close()
i) Complete line 1 to import the appropriate module.
ii) Complete Line 2 to create the cursor object
iii) Complete the query given in Line 3 to display details of all such items from the table ITEMS
whose price is more than 5000.
iv) Complete Line 4 to extract all the records.
35. Consider the following tables – FACULTY and COURSES :
Table: FACULTY

Table: COURSES

Write SQL queries for the following:


i) Display minimum and maximum fess of each faculty.
ii) Print average salary of all faculties whose name end with ‘a’.
iii) Display faculty name and course name of all faculties.
iv) Display faculty name, course name and fees of all faculties whose fees>15000;
Write the output of the queries (i) to (iv) based on the table
Table: Employee
i) SELECT NAME, PROJECT FROM EMPLOYEE ORDER BY NAME DESC;
ii) SELECT NAME, SALARY FROM EMPLOYEE WHERE NAME LIKE ‘A%’;
iii) SELECT NAME FROM EMPLOYEE WHERE SALARY BETWEEN 100000 AND 200000;
iv)SELECT * FROM EMPLOYEE WHERE PROJECT = ‘P02’;
SECTION E (Each question carries 5 marks)
36. Surya is a manager working in a recruitment agency. He needs to manage the records of
various candidates. For this, he wants the following information of each candidate to be
stored:
- Candidate_ID – integer
- Candidate_Name – string
- Designation – string
- Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
(I) Write a function to input the data of a candidate and append it in a binary file.
(II) Write a function to update the data of candidates whose experience is more than 10
years and change their designation to "Senior Manager".
(III) Write a function to read the data from the binary file and display the data of all those
candidates who are not "Senior Manager".
37. Fun Media Services Ltd is an event planning organization. It is planning to set up its India
campus in Mumbai with its head office in Delhi. The Mumbai campus will have four
blocks/buildings – ADMIN, DECORATORS, FOOD, and MEDIA.
You as a network expert need to suggest the best network-related solutions for them to
resolve the issues/problems mentioned in points (i) to (v), keeping in mind the distances
between various blocks/buildings and other given parameters.
Shortest distance between various buildings:

FROM-TO DISTANCE

ADMIN TO DECORATORS 90 meters

ADMIN TO MEDIA 75 meters

ADMIN TO FOOD 50 meters

DECORATORS TO FOOD 65 meters

DECORATORS TO MEDIA 50 meters

FOOD TO MEDIA 45 meters

DELHI Head Office to MUMBAI Campus 1475 KM

The number of computers at various buildings is as follows:

BUILDING NUMBER OF COMPUTERS

ADMIN 110

DECORATORS 75

MEDIA 12

FOOD 20

i) Suggest the most appropriate location of the server inside the MUMBAI campus (out of the
4 buildings).Justify your answer.
ii) Draw the cable layout to efficiently connect various buildings within the MUMBAI campus.
iii) Which hardware device will you suggest to connect all the computers within each
building?
iv) Which of the following will you suggest to establish online face-to-face communication
between the people in the Admin Office of the MUMBAI campus and the DELHI Head Office?
a. Cable TV
b. Email
c. Video Conferencing
d. Text Chat
v) What type of network (out of PAN, LAN, MAN, WAN) will be set up in each of the
following cases?
a. The Mumbai campus gets connected with the Head Quarter in Delhi
b. The computers connected in the MUMBAI campus

---END---

You might also like