Pbi Xii CS QP

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

KENDRIYA VIDYALAYA SANGATHAN::HYDERABAD REGION

FIRST PREBOARD EXAMINATION 2023-24


CLASS: XII
SUBJECT: COMPUTER SCIENCE (083)
MAX.MARKS:70 TIME ALLOWED: 3 Hrs

General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 4 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.
S.NO QUESTION MARKS
SECTION A
1 State True or False: 1
“The else clause of python loop executes when the loop terminates
normally”
2 What is the maximum value that can be stored in NUMERIC (4, 2)? 1
a. 9999.99 b. 99.9999 c. 99.99 d. 9.99
3 What is the output of the following expression? 1
print( float(5+int(4.39+2.1)%2))
a. 5 b. 5.0 c.8.0 d. 8
4 Select correct output of the python code: 1
X="Swatchtha Hi Seva @ Swatcch Bharat"
Y=X.split()
print(Y)
a. ['Swatchtha Hi Seva', '@', 'Swatcch Bharat']
b. ['Swatchtha Hi', 'Seva@', 'Swatcch', 'Bharat']
c. ['SwatchthaHi’, 'Seva', '@', 'SwatcchBharat']
d. ['Swatchtha', 'Hi', 'Seva', '@', 'Swatcch', 'Bharat']
5 In the following SQL Query which type of join is mentioned? 1
SELECT customer.cust_id, order.cust_id , name, order_id from
customer,order WHERE customer.cust_id=order.cust_id;
a. Equi Join b. Natural Join c. Cross Join d. Cartesian Product
6 Network in which every computer is capable of playing the role of a 1
client, or a server or both at same time is called
a. local area network b. peer-to-peer network
c.dedicated server network d. wide area network
7 Given the following dictionaries 1
dict_fruit={"Banana":"Yellow", "DraganFruit":"Pink"}
dict_vegetable={"Chilli":"Green", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries?
a. dict_fruit.update(dict_vegetable) b. dict_fruit + dict_vegetable
c. dict_fruit.add(dict_vegetable)
d.dict_fruit.merge(dict_vegetable)
8 Which of the following statement(s) would give an error after 1
executing the following code?
Str="BharatiyaBashaUtsav" # Statement 1
print(Str) # Statement 2
Str="India @ 75" # Statement 3
Str[1]= '$' # Statement 4
Str=Str+"Thank you" # Statement 5
a. Statement 1 b. Statement3 c. Statement 4 d. Statement 5
9 Consider the statements given below and then choose the correct 1
output from the given options:
tp1=(10,15,20,60)
tp1=tp1+(3)
print(tp1)
a. (10,15,20,60,3) b. (3,10,15,20,60)
c. (10,15,20,60, (3)) d. Error
10 What could be the minimum possible and maximum possible 1
numbers generated by following code?
import random
print(random.randint(3,10)-3)
a. 0,7 b. 1,8 c.3,10 d. 2,9
11 A device that forwards data packet on dissimilar networks is called a 1
____________
a. Bridge b. Hub c. Router d. Gateway
12 Find and write the output of the following python code: 1
a=10
def call():
global a
a=15
b=20
print(a)
call()
a. 10 b. 20 c. 15 d. 25
13 State whether the following statement is True or False 1
“Every syntax error is an exception but every exception cannot be a
syntax error”
14 Fill in the blank: 1
An attribute in a relation can be a foreign key if it is the ________ key
in any other relation.
a. Candidate Key b. Foreign Key
c. Primary Key d. Unique Key
15 ______________is a communication methodology designed to establish 1
a direct and dedicated communication between an internet user and
his/her ISP.
a. VoIP b. SMTP c.PPP d.HTTP
16 Which function is used to write a list of string in a file? 1
a. writeline()
b. writelines()
c. writestatement()
d. writefullline()
Q17 and 18 are ASSERTION AND REASONING based questions.
Mark the correct choice as
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
17 Assertion(A):Key word arguments are related to the function calls 1
Reason(R): When you use keyword arguments in a function call, the
caller identifies the arguments by the parameter name
18 Assertion (A) : In Python, a stack can be implemented using a list. 1
Reasoning (R) : A stack is an ordered linear list of elements that
works on the principle of First In First Out (FIFO).
SECTION B
19 a. Expand the following: 1+1=2
i. FTP ii. IMAP
b. What is the use of XML
(OR)
Write one advantage and one disadvantage of guided over unguided
communication media.
20 Kunika, a Python programmer, is working on a project in which she 2
wants to write a function to count the number of even and odd
values in the list. She has written the following code but his code is
having errors. Rewrite the correct code and underline the corrections
made.
define EOcount(L):
evensum=oddsum=0
for i in range(0,len(L))
if L[i]%2=0:
evensum+=1
Else:
oddsum+=1
print(evensum, oddsum)
21 Write a function Show_sal(EMP) in python that takes the dictionary, 2
EMP as an argument. Display the salary if it is less than 25000
Consider the following dictionary
EMP={1:18000,2:25000,3:28000:4:15000}
The output should be:
18000
15000
EMP={1:18000,2:25000,3:35000,4:15000}
(OR)
Write a function, VowelWords(Str), that takes a string as an
argument and returns a tuple containing each word which starts
with an vowel from the given string
For example, if the string is "An apple a day keeps the doctor away”,
the tuple will have (“An”,”apple”,”a”, “away”)
22 Predict the output of the Python code given below: 2
L=[4,3,6,8,2]
Lst=[]
for i in range(len(L)):
if L[i]%2==0:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)
23 Write the Python statement for each of the following tasks using 1+1=2
BUILT-IN functions/methods only:
i. To return index position of substring in given string.
ii. To delete first occurrence of an item in the list
(OR)
A list named stu_marks stores marks of students of a class. Write
the Python command to import the required module and display the
average of the marks in the list.
24 Differentiate between Alter and Update? 2
OR
What is the difference between WHERE and HAVING clause of
SQL statement?
25 Predict the output of the following code: 2
def ChangeVal(M,N):
for i in range(N):
if M[i]%5==0:
M[i]+=5
if M[i]%3==0:
M[i]+=3
L=[5,8,15,12]
ChangeVal(L,4)
for i in L:
print(i,end='$')
SECTION C
26 Predict the output of the following code: 3
L1=[10,20,30,40,12,11]
n=2
l=len(L1)
for i in range (0,n):
y=L1[0]
for j in range(0,l-1):
L1[j]=L1[j+1]
L1[l-1]=y
print(L1)
27 Consider the table SportsClub given below and write the output of 1*3=3
the SQL queries that follow.
Table:SportsClub

i. SELECT DISTINCT Sports from SportsClub;


ii. SELECT sports, SUM(salary) FROM SportsClub GROUP BY
sports HAVING SUM(salary)>15000;
iii. SELECT pname, sports, salary FROM SportsClub WHERE
country='INDIA' ORDER BY salary DESC;

28 Write a function in Python to read a text file, Rhyme.txt and displays 3


those words which have length more than 5
(OR)
Write a function, in Python that counts the number of lines in text
file named “data.txt” and displays the lines which are starting with
“K” or ‘k’.
29 Consider the table CHIPS given below: 3

Based on the given table write SQL queries for the following:
i. Change the Flavour of the chips to “black salt “ for those chips
whose flavour is “SALTY”
ii. Display the Brand_Name ,Flavour and Total
Amount(price*quantity) of those chips whose Brandname ends
with ‘s’. Total Amount column name should also be displayed.
iii. Delete the records of those chips whose quantity is less than 10
30 Write a function in Python, Push(Cosmetics) where, Cosmetic is a 3
dictionary containing the details of products– {Pname:price}.
The function should push the names of those products in the stack
whose price is greater than 130.
Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Ditem = {“FaceWash”:105, "Facepack":150, "CleansingMilk":130,
"Sunscreen": 180, "FaceMask":115}
The stack should contain
Facepack
Sunscreen
The output should be:
The count of elements in the stack is 2
SECTION D
31 Consider the following tables BOOKS and ISSUED in a database 1*4=4
named “LIBRARY”.
Write SQL queries for the following:
i. Display bookname, Author name and quantity issued from
table Books and issued.
ii. Display the details of books in the order of qty whose price
is in between 200 to 300
iii. Display total qty of books of type “Computer”
iv. List the tables in the database Library
32 Mandeep is a Python programmer working in C-company. For storing 4
details of employees working in the company, he has created a csv
file named record.csv, to store the
The structure of record.csv is :
[Emp_Id, Emp_Name, Mobile, Salary]
Where
Emp_Id is Employee ID (integer)
Emp_Name is Employee Name (string)
Mobile is to store mobile number of employee (integer)
Salary – Salary earned by the employees(integer)
Mandeep want to write 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 andemployee salary respectively.
b) COUNTR() – To count the number of records present in the CSV
file named ‘record.csv’.
As python expert help him complete the task
SECTION E
33 A company SUN Enterprises has four blocks of buildings as shown: 1*5=5

B1 B2 B3 B4

Center to center distance between various block

Number or computers in each Block


B1 150
B2 15
B3 15
B4 25
Computers in each block are networked but blocks are not networked.
The company has now decided to connect the blocks also.
i. Suggest the most appropriate topology for the connections
between the blocks.
ii. Do you require any repeaters in network if yes state the
reason
iii. Which device will you suggest for connecting all the
computers with in each of their blocks?
iv. The company is planning to link its head office situated in
Ahmedabad with the offices in hilly areas. Suggest a way to
connect it economically
v. Suggest the most appropriate location of the server, to get
the best connectivity for maximum number of computers.
34 i. Differentiate between r and w file modes in python 2+3=5
ii. Consider a binary file “book.dat” that has structure [BookNo,
Book_Name, Author, Price].
Write a user defined function CreateFile() that takes input data for a
record and add to book.dat
(OR)
i. How are CSV files different from Binary Files
ii. Consider a binary file “MyFile.dat” that has following structure
[ empid, ename and salary].
Write a userdefined function to search records based on the salary
entered by the user and if the salary is more than 25000 then
display the record.
35 i. Define the term Degree with respect to RDBMS. Give one (1+4)=5
example to support your answer
ii. Kavyawants to write a program in Python to insert the
following recordin the table named Inventory in MYSQL database,
WAREHOUSE:
Inv_No(Inventory Number )- integer
Inv_name(Name) – string
Inv_Entry(Date )
Inv_price – Decimal
Note the following to establish connectivity between Python
andMySQL:
Username - root
Password - 12345
Host - localhost
The values of fields Inv_No, Inv_name, Inv_Entryand Inv_price has to
be accepted fromthe user. Help Kavyato write the program in Python.
OR
i. Give one difference between Primary key and candidate key.
ii. Sarithahas created a table Inventory in MYSQL database,
warehouse:
Inv_No(Inventory Number )- integer
Inv_name(Name) – string
Inv_Entry(Date )
Inv_price – Decimal
Note the following to establish connectivity between Python and
MySQL:
Username - root
Password - 12345
Host - localhost
Saritha, now wants to delete the records of inventory whose price is
more than 1000. Help Saritha to write the program in Python.

****************************

You might also like