Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views7 pages

GRADE XII - COMPUTER SCIENCE (SET B) (PREBOARD-I) QUESTION PAPER (2024-25)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 7

DELHI PUBLIC SCHOOL AGRA

(Under the aegis of The Delhi Public School Society, East of Kailash, New Delhi)
PRE-BOARD- I EXAMINATION (2024-25)
CLASS – XII
COMPUTER SCIENCE
ROLL NO.: ___________________ Date – 27.12.24
NAME: ______________________ M.M. – 70
SEC.: _______________________ Time – 3 Hours

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.
● Additional time of 15 minutes will be provided for reading the question paper.
● This question paper consists of 7 printed pages.

Q No. Section-A (21x1=21 Marks) Marks


1. State True or False :– 1
“Variable declaration is implicit in Python.”
2. Identify the output of the following code snippet: 1
s = "Coding in Python Language"
s = s.lower().replace(" ", "")
print(s[::-1])
a) Codinginpythonlanguage b) cODINGINPYTHONLANGUAGE
c) egaugnalnohtypnignidoc d) EgaugnalNohtypNiGnidoc
3. Which of the following statement(s) would give an error after executing the 1
following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
a) Statement 3 b) Statement 4
c) Statement 5 d) Statement 4 and 5
4. Which of these statement about a dictionary is incorrect: 1
a) The values of a dictionary can be accessed using keys
b) The keys of a dictionary can be accessed using values
c) Dictionaries aren’t ordered
d) Dictionaries are mutable
5. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is 1
incorrect?
a) print(T[1]) b) T[2] = -29
c) print(max(T)) d) print(len(T))
6. Name the data structure that follows FIFO order. 1

7. Name the function to Check Successful Connection: 1


Page 1 of 7
8. Which of the following functions changes the position of file pointer and 1
returns its new position?
a) flush() b)tell() c) seek() d) offset()
9. Riya wants to transfer pictures from her mobile phone to her laptop. She 1
uses Bluetooth Technology to connect two devices. Which type of network
will be formed in this case?
a) PAN b) LAN c) MAN d) WAN
10. Name the Python Library modules which need to be imported to invoke the 1
following functions:(i) sin() (ii) randint ()
11. In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and 1
another table, Beta has degree 3 and cardinality 5, what will be the degree
and cardinality of the Cartesian product of Alpha and Beta?
a) 5,3 b) 8,15 c) 3,5 d) 15,8
12. Which of the following statements is FALSE about keys in a relational 1
database?
a) Any candidate key is eligible to become a primary key.
b) A primary key uniquely identifies the tuples in a relation.
c) A candidate key that is not a primary key is a foreign key.
d) A foreign key is an attribute whose value is derived from the primary key of
another relation.
13. Assertion (A): An Internet troll is a person who deliberately sows discord on the 1
Internet by starting.
Reason (R): We can download and use any material available on the Internet.
a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is false but R is True
14. Name any four parameters required by connect function. 1
15. If the following code is executed, what will be the output of the following code? 1
name="ComputerSciencewithPython"
print(name[3:10])
16. Rajesh is trying to retrieve the top element of the stack without removing it. 1
Name the term.
17. Give the output pattern of the following code: 1
for i in range(1, 4):
print("".join(chr(65 + j) for j in range(i)))

18. In SQL, write the query to display the list of tables stored in a database. 1
19. With SQL, how do you select all the records from a table named “Contacts” 1
where the value of the column “FirstName” begins with an “a”?
20. Assertion (A): Positional arguments in Python functions must be passed in 1
the exact order in which they are defined in the function
signature.
Reasoning (R): This is because Python functions automatically assign
default values to positional arguments.
a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is false but R is True

21. What is the commonly used unit for measuring the speed of data transmission? 1

Page 2 of 7
Section-B (7x2=14 Marks)
22. The code provided below is intended to swap the first and last elements of 2
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_first_last(tup)
if len(tup) < 2:
return tup
new_tup = (tup[-1],) + tup[1:-1] + (tup[0])
return new_tup
result = swap_first_last((1, 2, 3, 4))
print("Swapped tuple: " result)

23. Write a function countNow(PLAYERS) in Python, that takes the dictionary, 2


PLAYERS as an argument and displays the names (in uppercase)of the players
whose names are longer than 5 characters. For example, Consider the following
dictionary:
PLAYERS={1:"Andre",2:"Jasprit",3:"Virat",4:"Marcus",5:"Sanju"}
The output should be:
JASPRIT
MARCUS
OR
Write a function, lenWords(STRING), that takes a string as an argument
and returns a tuple containing length of each word of a string.
For example, if the string is "Slow and steady wins the race", the tuple will have
(4, 3, 6, 4, 3, 4)
24. Predict the output of the Python code given below: 2
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [12,25,17,56,35]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
25. Differentiate between count() and count(*) functions in SQL with appropriate 2
example.
OR
Categorize the following commands as DDL or DML: INSERT, UPDATE,
ALTER, DROP
26. Write a method/function DISPLAYWORDS() in python to read lines from a text 2
file STORY.TXT, and display those words, which are less than 4 characters.
27. Ravi received a mail form IRS department. On clicking “ClickHere”, he was 2
taken to a site designed to imitate an official-looking website, such as IRS.gov.
He uploaded some important information on it.
Identify and explain the cybercrime being discussed in the above scenario.
OR
How many pair of wires are there in twisted pair cable? What is the name
of port, which is used to connect Ethernet cable to a computer or a laptop?
28. If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then (Answer using built-in 2
functions only)
i. Write a statement to sort the elements of list L1 in ascending order.
ii. Write a statement to reverse the elements of list L2.

Page 3 of 7
Section-C ( 3 x 3 = 9 Marks)
29. Write a function POP(Book) in Python to delete a Book from a list of Book titles, 3
considering it to act as a pop operation of the Stack data structure.
OR
Write a function PEEK(Book) in Python to look at the top book in a list of book
titles without removing it, mimicking the peek operation of a stack data structure.
30. Write a function in Python that counts the number of “Me” or “My” words 3
present in a text file “STORY.TXT”.
If the “STORY.TXT” contents are as follows:
My first book
was Me and
My Family. It
gave me
chance to be
Known to the
world.
The output of the function should be:
Count of Me/My in file: 4
OR
Write a function AMCount() in Python, which should read each character
of a text file STORY.TXT, should count and display the occurrence of alphabets
A and M (including small cases a and m too).
Example:
If the file content is as follows:
Updated information
As simplified by official websites.
The EUCount() function should display the output as:
A or a:4
M or m :2
31. Write a program to create a tuple of Fibonacci series. 3
OR
Write a program to create a dictionary with numbers as keys and squares as
values.
Section-D (4x4=16 Marks)
32. Navdeep creates a table RESULT with a set of records to maintain the marks 4
secured by students in Sem 1, Sem2, Sem3 and their division. After creation
of the table, he has entered data of 7 students in the table.

Based on the data given above answer the following questions:


i) Identify the most appropriate column, which can be considered as Primary
key.
ii) If two columns are added and 2 rows are deleted from the table result,
what will be the new degree and cardinality of the above table?
Page 4 of 7
iii). Write the statements to:
a. Insert the following record into the table – Roll No- 108, Name Aadit, Sem1-
470, Sem2-444, Sem3-475, Div – I.
b. Increase the SEM2 marks of the students by 3% whose name begins with ‘N’.
OR (Option for Part iii only)
iii) Write the statements to:
a. Delete the record of students securing IV division.
b. Add a column REMARKS in the table with datatype as varchar with 50
characters

33. What is the advantage of using a csv file for permanent storage? 4
Write a Program in Python that defines and calls the following user defined
functions:
a) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’.
Each record consists of a list with field elements as empid, name and mobile to
store employee id, employee name and employee salary respectively.
b) COUNTR() – To count the number of records present in the CSV file named
‘record.csv’.

34. 4

Write SQL queries for the following:


(i) Display product name and brand name from the tables PRODUCT and
BRAND.
(ii) Display the structure of the table PRODUCT.
(iii) Display the average rating of Medimix and Dove brands
(iv) Display the name, price, and rating of products in descending order of rating.

Page 5 of 7
35. 4

A) Write the following queries:


(I) To display the total Quantity for each Product, excluding Products with total
Quantity less than 5.
(II) To display the orders table sorted by total price in descending order.
(III) To display the distinct customer names from the Orders table
(IV) Display the sum of Price of all the orders for which the quantity is null.
OR
B) Write the output:
(I) Select c_name, sum(quantity) as total_quantity from orders group by c_name;
(II) Select * from orders where product like '%phone%';
(III) Select o_id, c_name, product, quantity, price from orders where price
between 1500 and 12000;
(IV) Select max(price) from orders;

SECTION E (2x5=10 Marks)


36. (a) Write the output of the code given below: 5
p=5
def sum(q,r=2):
global p
p=r+q**2
print(p, end= '#')

a=10
b=5
sum(a,b)
sum(r=5,q=1)
(b) The code given below inserts the following record in the table Student:
RollNo – integer
Name – string
Clas – integer
Marks – integer
Note the following to establish connectivity between Python and MYSQL:
 Username is root
 Password is tiger
 The table exists in a MYSQL database named school.
 The details (RollNo, Name, Clas and Marks) are to be accepted from the
user.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table
Student.
Statement 3- to add the record permanently in the database
import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root", password="tiger",
database="school")
mycursor=_________________ #Statement 1
rno=int(input("Enter Roll Number :: "))
Page 6 of 7
name=input("Enter name :: ")
clas=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
querry="insert into student
values({},'{}',{},{})".format(rno,name,clas,marks)
______________________ #Statement 2
______________________ # Statement 3
print("Data Added successfully")
37. Meticulous EduServe is an educational organization. It is planning to setup 5
its India campus at Chennai with its head office at Delhi. The Chennai campus
has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and MEDIA

Number of computers in each of the blocks/Center is as follows:

a) Suggest and draw the cable layout to efficiently connect various blocks of
buildings within the CHENNAI campus for connecting the digital devices.
b) Which network device will be used to connect computers in each block to
form a local area network?
c) Which block, in Chennai Campus should be made the server? Justify your
answer.
d) Which fast and very effective wireless transmission medium should preferably
be used to connect the head office at DELHI with the campus in CHENNAI?
e) Is there a requirement of a repeater in the given cable layout? Why/Why not?
OR
e) What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the Chennai campus?
-End-

Page 7 of 7

You might also like