Xii Cs Preboard QP Set A Cbessc

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

COIMBATORE SAHODAYA SCHOOLS COMPLEX SET A

PRE BOARD EXAMINATION (DEC -2023)


GRADE:XII MARKS:70
SUBJECT: COMPUTER SCIENCE TIME: 3 HRS
General Instructions:
➢ The paper is divided into 4 Sections- A, B, C, D and E & contains 35 questions.
➢ 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.
Q. NO SECTION A MARKS

1. State True or False:


A dictionary key must be of a data type that is mutable. 1
2. Identify the appropriate data type for the attribute Date_of_Birth - 12/01/2004.
a) Timestamp b) varchar(11) c) Blob d) date 1
3 What will the following expression be evaluated to in Python?
print( ( - 33 // 13) * (35 % -2)* 15/3) 1
4 str="R and Data Science"
z=str.split() 1
newstr="=".join([z[2].upper(),z[3],z[2]+z[3],z[1].capitalize()])
newstr is equal to ____________________________

5 If a table AA in MySQL database is having 2 rows and 4 columns and the table BB is having
4 rows and 2 columns, the cartesian product of AA and BB will have degree and cardinality as 1
________________________.

6 Mr.Vivek Rana a network administrator of Rana Co. Ltd wants to connect his registered office
located in Mumbai with its head office in Delhi. Suggest an economic way to connect it with 1
reasonable high speed?

7. Find the output of the code:


S="eComPhyMat" 1
L=["C","a","r","e","e","r","F","a","i","r"]
D={}
for i in range(len(S)):
if i%2==0:
D[L.pop()]=S[i]
else:
D[L.pop()]=i+5
for x,y in D.items():
print(x,y,sep="#")

8 Consider the string, spstr="Next is #Rio in 24" Find the output of, spstr[-5:3:-2]. 1
9 Consider the Python statement, t=(10,20,30,40,50,60) Identify from the options below that
will result in an error. 1
a) t[4]+44 b) t[4]-44 c) t=t-(70,) d) t=t+(70,)

10 What possible output(s) are expected to be displayed on screen at the time of execution of the 1
program from the following code? Select correct options (can also choose more than one
option) from below.
import random
arr=['10','30','40','50','70','90','100']
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(arr[i],"$",end="@")
a) 30 $@40 $@50 $@70 $@90 b)30 $@40 $@50 $@70 $@90 $@
c) 30 $@40 $@70 $@90 $@ d) 40 $@50 $@

11 Which of the following is not a valid URL: 1


1. kvsangathan.nic.in 2. www.google.com
3. [email protected] 4. http://cbseacademic.nic.in/curriculum_2022.html

a)1 & 3 b) 3 & 4 c) Only 3 d)Only 4

12 Identify the missing statement of the following python code if the output produced is 500: 1
a=100
def show( ):
global a
a=100
def invoke( ):
___________ # Missing statement
a=500
show( )
invoke( )
print(a)

13 Look at the code below and identify the type of exception that will be thrown from the options
arr=[10,20,30,40,50,60,70,80,90,100] 1
for i in range(len(arr)+1):
print(arr.pop())

14 Identify the False relational database statement from the options below.
a) Alternate key(s) are the Candidate key(s) not selected as Primary key. 1
b) Foreign key of a table is a Primary key of the table it points to.
c) There can be many Candidate keys in a table.
d) Referential Integrity is enforced by the Alternate keys.

15 Suryansh wants to upload and download files from / to a remote internal server. Write the
name of the relevant communication protocol, which will let him do the same. 1
16 The <filehandle>.seek( 8 ) if applied to a text file stream object moves the read cursor /
pointer : 1
a) 8 characters backwards from its current position
b) 8 characters backward from the end of the file
c) 8 characters forward from its current position
d) 8 characters forwarded from the beginning of the file

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 of A
b) Both A and R are true and R is not the correct explanation of A
c) A is True but R is False
d) A is false but R is True

17 Assertion (A): If L is a list, then L+=range(5) is an invalid statement. 1


Reason (R): Only a list can be concatenated to a list.

18 Assertion (A): The function definition calculate(a, b, c=1,d) will give error. 1
Reason (R): All the non-default arguments must precede the default arguments.

SECTION B

19 i) Expand the following: FTP & POP 2


ii) Write the difference between web server and web browser.
OR
i) How Hub is different from switch.
ii) Explain the 80-20 rule of network design?

20 The following code that consists of a function and user input part is supposed to return the
factors of a number supplied as a parameter. Since there are errors in both syntax and logical 2
errors it’s not showing the correct result. Your task is to identify and underline the errors.

def problem(n):
myList = ( )
for i in range(1, n+1):
if n // i =0:
myList.append(i)
return myLis
problem(4):

21 CBG is a dictionary that stores the name of the country and their respective Central Banks
Governor’s name as shown below. 2
CBG={"Germany":"JoachimNagel","France":"FrancoisVilleroy de Galhau",
"India":"ShaktikantaDas", "UnitedKingdom":"AndrewBailey",
"UnitedStates":"Jer ome Powell"}
Write a function getNames(CBG) that will take the dictionary as its parameter and will display
only those Governor’s names which are more than 20 characters long including the spaces in
between.
OR
Consider the string G20 below G20="African Union has been included as a member of the
G20". Write a function lenWords(G20) that takes the string as its parameter and returns the
length of each word of the string as a tuple.

22 Find the output of the following code:


s='UVW' 2
L=[10,20,30]
D={}
N=len(s)
for I in range(N):
D[L[I]]=s[I]
for k,v in D.items():
print(k,v,sep='*',end=',')

23 Write the Python statement for each of the following tasks using built-in functions / methods
only: 2
i) To add another alphabet ‘e’ after the alphabet ‘e’ in the list
L=["C","a","r","e","r","F","a","i","r"]
ii) Check if the string S="eComPhyMat" starts with the alphabet ‘e’.
OR
Determine the most frequent alphabet in the list L=["C","a","r","e","e","r","F","a","i","r"] by
importing appropriate module in Python

24 i) In the existing MySQL table admin with the fields code, gender, designation add the
primary key icode of integer type in the beginning. 2
ii) Ms. Shalini has just created a table named “Employee” containing columns
Ename, Department, Salary. After creating the table, she realized that she had forgotten to add
a primary key column in the table. Help her in writing SQL commands to add a primary key
column empid. Also state the importance of the Primary key in a table.
OR
From the MySQL table admin with the fields icode, code, gender, designation
i) drop the field designation
ii) add a new column department of varchar of any suitable size. Make sure it cannot remain a
blank entry.

25 Find the output of the following: 2


def anher(x,y=10):
x=x/y
y=x%y
return x
m=200
n=20
m=anher(m,n)
print(m,n,sep="#")
n=anher(n)
print(m,n,sep="#",end="$$$")

SECTION C

26 Predict the output of the following code given below:


s="welcome2kv" 3
n = len(s)
m=""
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'#'
print(m)

27 Consider the table itemmast below, write the output of the MySQL Queries.
3

itemno itemname stock itemprice suppdate

100 amul butter 500 gm 40 250 2023-09-17

101 amul butter 100 gm 60 50 2023-09-17

102 amul gold 1 litre 90 75 2023-09-16

103 amul paneer 50 85 2023-09-15


i) select count(distinct suppdate) from itemmast;
ii) select itemname, stock from itemmast where itemprice>100 and itemname like '%gm';
iii) select itemname, stock from itemmast where suppdate<'2023-09-17' and stock between 40
and 100;

28 Write a function to read data from a text file ‘DATA.TXT’, and display words which have a
maximum number of vowel characters. 3
OR
A text file contains alphanumeric text (say num.txt).Write a function read_digit () that reads
this text file and prints only the numbers or digits from the file.

29 Look at the table structure itemmast table and write the MySQL Queries: 3

Field Type Null Key Default Extra

itemno int NO PRI NULL

itemname varchar(30) YES NULL

stock int YES NULL

itemprice int YES NULL

suppdate varchar(20) YES NULL


i) Drop the primary key.
ii) Increase itemprice for each by 10%;
iii) Delete the records where itemprice is more than 200.
30 A list items contain the following record as list elements [itemno, itemname, stock]. Each of 3
these records are nested to form a nested list. Write the following user defined functions to
perform the following on a stack reorder
i) Push(items): It takes the nested list as its argument and pushes a list object containing
itemno and itemname where stock is less than 10.
ii) Popitems(): It pops the objects one by one from the stack reorder and also displays a .
message ‘Stack empty’ at the end.

SECTION D
31 Consider the following tables ITEM and CUSTOMER. Write the SQL command for the 4
following statements:
Table: ITEM
I_ID ItemName Manufacturer Price

PC01 Personal Computer ABC 35000

LC05 Laptop ABC 55000

PC03 Personal Computer XYZ 32000

PC06 Personal Computer COMP 37000

LC03 Laptop PQR 57000

Table: CUSTOMER
C_ID CustomerName City I_ID

01 N Roy Delhi LC03

06 H Singh Mumbai PC03

12 R Pandey Delhi PC06

15 C Sharma Delhi LC03

16 K agarwal Banglore PC01


i) To display the details of those customers whose City is Delhi.
ii) To display the details of an Item whose price is in the range of 35000 to 55000 (both values
to be included).
iii) To display the CustomerName, City from the table Customer & ItemName and Price from
the table Item with their corresponding matching I_ID.
iv) To increase the price of all items by 1000 in the table Item.

32 Radha Shah is a programmer, who has recently been given a task to write a python code to 4
perform the following CSV file operations with the help of two user defined
functions/modules:
a) CSVOpen() : to create a CSV file called “ books.csv” containing information about books
of 5 records – [Title, Author and Price] with the headings.
b) CSVRead() : to display the records from the CSV file called “ books.csv” .where the field
title starts with 'R'.
SECTION E

33 FutureTech Corporation, a Bihar based IT training and development company, is planning to 5


set up training centers in various cities in the coming year. Their first center is coming up in
Surajpur district. At Surajpur center, they are planning to have 3 different blocks - one for
Admin, one for Training and one for Development. Each block has a number of computers,
which are required to be connected in a network for communication, data and resource
sharing. As a network consultant of this company, you have to suggest the best network
related solutions for them for issues/problems raised in question nos. (i) to (v), keeping in
mind the distances between various blocks/locations and other given parameters.
Distance between various blocks / location:
Block Distance

Development to Admin 28 m

Development to Training 105 m

Admin to Training 32 m

Surajpur Campus to Coimbatore Campus 340 KM

Number of Computers:
Block Number of Computers

Development 90

Admin 40

Training 50

i) Suggest the most appropriate block/location to house the SERVER in the Surajpur center
(out of the 3 blocks) to get the best and effective connectivity. Justify your answer.
ii) Suggest why should a firewall be installed at the Surajpur Center?
iii) Suggest the best wired medium and draw the cable layout (Block to Block) to most
efficiently connect various blocks within the Surajpur Center.
iv) Suggest the placement of the following devices with appropriate reasons:
a) Switch/Hub b) Router
v) Identify the type of network used to connect Surajpur Center and Raipur Center.
34 i) Write the importance of flush( ).
ii) Alia has been given a task of writing a code to create a binary file EMPLOYEE.DAT with 5
employeeid, ename and salary. The file contains 10 records. He now has to update a record
based on the employee id entered by the user and update the salary. The updated record is then
to be written in the file updateemp.dat. The records which are not to be updated also have to
be written to the file updateemp.dat. If the employee id is not found, an appropriate message
should be displayed. Write a user defined function update_data( ) to complete the above task.
OR
i) Explain the process of serialization in the Binary file.
ii)A binary file Book.dat has a structure [bookno,book_name,author,price].Write a function in
Python count_book() to count and return the no.of books whose price is between 100 and 500.

35 i) Are count (*) and count()the same functions? Why/why not?


ii) The code given below inserts the following record in the table Emp: 1+4=5
EmpNo – integer
EName – string
Desig – string
Salary – integer
Note the following to establish connectivity between Python and MYSQL:
Username is admin
Password is 22admin66
The table exists in a MYSQL database named company.
The details (EmpNo, EName, Desig and Salary) are to be accepted from the user. Write the
program in Python to meet the above need.
OR

i) Give one point of difference between an equi-join and a natural join.


ii) Write the user defined function display ( ) in python to execute the query that fetches
records of the employees coming from the city ‘Delhi’.
E_code - string
E_name - String
Sal = Integer
City - string
Note the following to establish connectivity between Python and MySQL:
❖ Username is root
❖ Password is root
❖ The table exists in a MySQL database named emp.
❖ The details (E_code, E_name, Sal, City) are the attributes of the table.

You might also like