CS Class XII Paper

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

Pre-Board Examination (2022-23)

Class: XII Max. Marks: 70


Subject: Computer Science Time Duration: 3 Hrs.

General Instructions:
i. This question paper contains five parts Part A, B, C, D and E. Each part is compulsory.
ii. Section A has 18 questions carrying 01 mark each.
iii. Section B has 07 Very Short Answer type questions carrying 02 marks each.
iv. Section C has 05 Short Answer type questions carrying 03 marks each.
v. Section D has 02 Case-based questions carrying 04 marks each.
vi. Section E has 03 Long Answer type questions carrying 05 marks each.
vii. All programming questions are to be answered using Python Language only.

PART- A
1. Find the valid identifier from the following
[1]
(A). 2_Myname (B). My name (C). True (D). Myname_2
2. Which of the following operator can be used with string data type?
[1]
(A) ** (B) % (C) + (D) /
3. Identify the output of the following Python statements.
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]] [1]
y = x[1][2] print(y)
4. What will be the output of the following Python code?
i= 1
while True:
if i%0O7 == 0: [1]
break
print(i)
i += 1
5. The variable declared outside all the functions is called a. .. …………variable. [1]
6. Identify the output of the following Python statements.
L= [10, 15, 20, 25, 30]
L.insert( 3, 4) [1]
L.insert( 2, 3)
print (lst1[-5])
7. The... ….. of a variable is the area of the program where it may be referenced. [1]
8. "One device per connection" is an advantage of:
[1]
(A) Star topology (B) Tree topology (C) Bus topology (D) Ring topology
9. The…. function creates a file object used to call other support methods associated with it. [1]
10. ……….. means organization of data. [1]
11. Which protocol is used for the transfer of hypertext content over the web? [1]
(A) HTML (B) HTTP (C) TCP/IP (D) FTP
12. …………is a freely-available open-source RDBMS that implements SQL. [1]
13. ………… method of pickle module is used to write an object into binary file. [1]
14. What is the output of the following code?
def fun (n) :
if (n > 100): [1]
return n - 5
return fun (fun (n+11))
print (fun (45))
15. Tricking people through authentic-looking emails or websites is called………… [1]
16. Which clause is used in query to place the condition on groups in MySQL?
[1]
(A) WHERE (B) HAVING (C) GROUP BY (D) Both (A) & (B)
17. In a Stack, if a user tries to remove an element from an empty Stack, the situation is called:
[1]
(A) Underflow (B) Overflow (C) Empty collection (D) Garbage collection
18. …………is known as range operator in MySQL.
[1]
(A) DISTINCT (B) IN (C) IS (D) BETWEEN

PART- B
19. Write the short note on protocol. Also writes the name of two protocols. [2]
OR
Explain following terms-
(A). Circuit Switching
(B). Trojan Horse
20. What is a function? How is it useful? [2]
OR
Predict the output of the Python code given below:
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
21. Write a query that counts the number of sales people registering orders for each day from the table [2]
‘orders’ with their ‘id’. (If a salesperson has more than one order on a given day, he or she should be
counted only once.)
22. Ravi has written a code to input a number and check whether it is prime or not. His code is having errors. [2]
Rewrite the correct code and underline the corrections made.
def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)
23. How is a hacker different from a cracker? [2]
OR
Explain following terms-
(A). Topology
(B). Ethernet Card
24. Write the output of the code given below: [2]
d={}
my_dict = {"name": "Suman", "age": 34}
d=my_dict
my_dict['age'] = 32
my_dict['address'] = "Delhi"
print(d.items())
25. Differentiate between count() and count(*) functions in SQL with appropriate example. [2]
OR
Name SQL Single Row functions (for each of the following) that-
1. returns total no. of letters of the given text
2. returns text into lowercase letters
3. returns names of days, For example : ‘‘Monday’’, ‘‘Tuesday’’
4. returns month number from the given date

PART- C

26. Write a function in Python, Push(SItem) where , SItem is a dictionary containing the details of stationary [3]
items– {Sname:price}.
The function should push the names of those items in the stack who have price greater than 75. Also
display the count of elements pushed into the stack.
For example: If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
Pen
The output should be:
The count of elements in the stack is 2
27. ABC Organization has set up its new center at Delhi for its office and
web based activities. It has 4 blocks of buildings as shown in the diagram:

Distances between various blocks Number of Computers


Black A to Block B 50 m
Black A 25
Block B to Block C 150 m
Block B 50
Block C to Block D 25 m
Block C 125
Block A to Block D 170 m
Block D 10
Block B to Block D 125 m
Block A to Block C 90 m

i. Suggest a cable layout of connections between the blocks. [1]


ii. Suggest the most suitable place (i.e. block) to house the server of this organization with a suitable
reason. [1]
iii. Suggest the placement of the following devices with justification
(A). Repeater [1]
(B). Hub/Switch
28. What is stack? Write a python function named is_underflow() to check a stack is an underflow. [3]
OR
i. What will be the output if entered number (n) is 10 and 11
a=2
while a<n:
if n % a ==0:
[2]
break
print (a)
a=a+1
else:
print(“ok”)
ii. What is data visualization? Write the name of module use for data visualization in python. [1]
29. i. Name two Aggregate functions of SQL and explain them with example. [2]
ii. Write the output of the following SQL queries :
(A). select mod(-23,2); [1]
(B). SELECT ROUND(67.246,2);
30. Write a method Countline() in Python to read lines from text file ‘xyz.txt’ and display the lines which [3]
are not starting with any vowel.
Example:
If the file content is as follows:
An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.
The Countline() function should display the output as:
The number of lines not starting with any vowel :- 1

PART- D
31. Rohill, a student of class 12, is learning CSV File Module in Python. During examination, he has been
assigned an incomplete python code (shown below) to create a CSV File Student.cav (content shown
below). Help him in completing the code which creates the desired CSV File.
Incomplete Code CSV File-
1. AKSHAY, XII, A
import csv 2. ABHISHEK, XII, A
fh= open(___,___,newline=") #Statement-1 3. ARVIND, XII, A
4. RAVI, XII, A
stuwriter = csv.______ #Statement-2 5. ASHISH XII, A
data = [ ]
header = [‘ROLL_NO’, ‘NAME’, ‘CLASS’, ‘SECTION’]
data.append(header)
for in range(5):
roll_no= int(input("Enter Roll Number:"))
name= input("Enter Name:")
Class = input("Enter Class :")
section= input("Enter Section: "")
rec = [ ______ ] #Statement-3
data.append(rec)
stuwriter. _______ (data) #Statement-4
fh.close( )
i. Write the missing code for blank space in line marked as Statement-1. [1]
ii. What is the function name (with argument) that should be used in the blank space of line marked as
[1]
Statement-2?
iii. Identify the suitable code for blank space in line marked as Statement-3. [1]
iv. Identify the suitable code for blank space in the line marked as Statement-4. [1]
32. A Stationary Store is considering to maintain their inventory using SQL to store the data. As a database
administer, Rajan has decided that:
• Name of the database – STATIONARY_STORE
• Name of the table - INVENTORY
• The attributes of INVENTORY are as follows:
ItemNo - numeric Table : INVENTORY
ItemName - character of size 20
ItemNo ItemName Scode Quantity
Scode - numeric
Quantity – numeric 2005 Notebook Classic 23 60

2003 Ball Pen 0.25 22 50

2002 Get Pen Premium 21 150

2006 Get Pen Classic 21 250

2001 Eraser Small 22 220

i. Write the degree and cardinality of the table INVENTORY. [1]


ii. Write a command to insert the following data into the attributes ItemNo, ItemName and SCode
respectively in the given table INVENTORY. [1]
ItemNo = 2010, ItemName = "Sharpener" and Scode = 25
iii. Write a command to remove the table INVENTORY from the database STATIONARY_STORE. [1]
iv. Write a command to add column Price in the table with datatype as float. [1]
PART-E
33. i. Write the output of the code given below: [2]
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)
ii. 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 admin
 The table exists in a MYSQL database named school. [3]
 The details (RollNo, Name, Class and Marks) are to be accepted from the user.
Write the following missing statements to complete the code:
import mysql.connector as mysql
def sql_data():
con=mysql.connect(host="localhost",user="root",password="admin", database="school")
mycursor=_________________ #Statement 1
rno=int(input("Enter Roll Number :: "))
name=input("Enter name :: ")
class=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
querry="insert into student values({},'{}',{},{})".format(rno,name,class,marks)
______________________ #Statement 2
______________________ # Statement 3
print("Data Added successfully")
34. Table : CLUB [5]

Give the output of the following statements


i) SELECT MOD(age,5) FROM CLUB WHERE SEX=’F’;
ii) SELECT LCASE(sports) FROM CLUB;
iii) SELECT COUNT(distinct sports) FROM CLUB;
iv) SELECT MIN(age) FROM CLUB WHERE SEX=’M’;
v) SELECT AVG(pay) FROM CLUB WHERE SPORTS = ’KARATE’;
35. Name the following networking devices used to connect computers together. [5]
i) The electronic device that operates only at physical layer. It receives signal in a network before it
becomes weak and regenerates it.
ii) The device allows you to link two different networks together.
iii) The device contains multiple independent but connected modules of network and inter networked
equipment.
iv) The device that connects dissimilar networks and establish a intelligent connection.
v) The device that is used to segment networks into different subnetworks.

You might also like