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

B

PRE – BOARD EXAMINATION (DEC–2022)


GRADE: 12 MARKS: 70
DATE : COMPUTER SCIENCE TIME : 3 HRS

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against Part-C only
8. All programming questions are to be answered using Python Language only.

S.NO SECTION-A MARKS


1 The continue statement is used:
(a) to pass the control to the next iterative statement 1
(b) to come out from the iteration
(c) to break the execution and passes the control to else statement
(d) to terminate the loop
2 Common types of exception in python are:
(a) Syntax Error (b) Zero division error (c) (a) and (b) (d) None of these 1
3 Which of the following is an incorrect logical operator in python? 1
(a)not (b) in (c) or (d) and
4 Which of the following is not a function/method of the random module in
python? 1
(a) randfloat( ) (b) randint( ) (c) random( ) (d) randrange( )
5 Which of the following is not a tuple in Python? 1
(a) (1,2,3) (b) (“One”,”Two”,”Three”) (c) (10,) (d) (“One”)
6 Built-in functions are also known as ________ 1
7 For a function header as follows:
def calc(x,y=20): 1
Which of the following function calls will give an error?
(a) calc(15,25) (b) calc(x=15,y=25) (c) calc(y=25) (d) calc(x=25)
8 If the following statement is used to read the contents of a text file object F:
x=F.readlines( )
Which of the following is the correct data type of x?
(a) string (b) list (c) tuple (d) dictionary 1
9 Which of the following command is used to open a file “c:\pat.dat” for writing 1
as well as reading in binary format only?
(a) fout=open(“c:\pat.dat”,”w”) (b) fout=open(“c:\\pat.dat”,”wb”)
(c) fout=open(“c:\pat.dat”,”w+”) (d) fout=open(“c:\pat.dat”,”wb+”)
10 Which one is the correct output for the following code?
a=[1,2,3,4]
b=[sum(a[0:x+1]) for x in range(0,len(a))] 1
print (b)
(a) 10 (b) [1,3,5,7] (c) 4 (d) [1,3,6,10]
11 Which SQL function is used to count all records of a table? 1
12 _____ key is used to uniquely identify row in a table and also does not accept 1
NULL values.
13 State True or False: Delete command is used to remove table. 1
14 What does the following query do? 1
UPDATE employee
SET salary=salary * 1.10;
(a) It increases the salary of all the employees by 10%
(b) It decreases the salary of all the employees by 10%
(c) It increases the salary of all the employees by 110%
(d) It is syntactically correct
15 The SQL _____ clause contains the condition that specifies which rows are to 1
be selected.
16 Which of the following is /are email protocols? 1
(a) TCP (b) IP (c) SMTP (d) POP
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): Stack is a linear data structure that works on the principle of 1
FIFO(First In First OUT)
Reason(R): The stack is created with the help of a list with some restrictions.
It manages a pointer called stack pointer(SP) that will increase or decrease by
1, if an element is entered or removed from the stack respectively.
18 Assertion(A): The file access mode ‘a’ is used to append the data in the file. 1
Reason(R): In the access mode ‘a’ the text will be appended at the end of the
existing file. If the file does not exist, Python will create a new file and write
data into it.
S.NO SECTION-B MARKS
19 Find the output for the following code: 1
(a) def display (num) :
num.append ([27])
return (num[1], num[2], num[3])
list1= [6, 12, 27]
n1, n2, n3 = display (list1)
print (list1)
(b) x = ['ab', 'cd'] 1
for i in x:
i.upper()
print(x)
20 Write two advantages of using an optical fibre cable over an Ethernet cable to
connect two service stations, which are 190m away from each other. 2
(OR)
What is the purpose of using router?
21 Reena has written a code to check the maximum of given numbers. Her code
is having errors. Rewrite the correct code with output and underline the
correction made.
def printMax(a, b)
if a> b:
print(a, 'is maximum')
elif a = b: 2
print(a, 'is equal to', b)
else;
print(b, 'is maximum')
printMax(33,94):
22 What will be the output of the following queries on the basis of 2
EMPLOYEE table?
Table: Employee
Emp_Id Name Salary
E01 Siya 54000
E02 Joy NULL
E03 Allen 32000
E04 Neev 42000
(i) SELECT Salary + 100 FROM Employee WHERE Emp_Id= ‘E02’;
(ii) SELECT Name FROM Employee WHERE Emp_Id= ‘E04’;
23 (a) What is VoIP? 2
(b) Briefly explain the following terms: (i) HTML (ii) XML
24 Predict the output of the Python code given below:
z= 100
def f( ):
global z
print('z is:', z)
z=50 2
print('New value of global z is:', z)
f( )
print('Value of z is:', z)
(OR)
Predict the output of the Python code given below:
def COUNT ( ):
s=open ("Quotes.txt", "r")
f=s.read( )
z=f.split( )
count=0
for i in z:
count=count+1
print (count)
COUNT( )
25 Differentiate between ALTER and UPDATE commands in SQL. 2
(OR)
In the following query how many rows will be deleted?
DELETE Student
WHERE StudentID=105;
(Assuming a Student table with primary key StudentID)
S.NO SECTION-C MARKS
26 Give output for following SQL queries as per given tables: 3
TABLE: CLUB
COACH_I COACHNAM AGE SPORTS DOJ PAY SEX
D E
1 ARUN 35 KARATE 27/03/1996 1000 M
2 RAVINA 34 KARATE 20/01/1998 1200 F
3 KARAN 34 SQUASH 19/02/1998 2000 M
4 TARUN 33 BASKETBALL 01/01/1998 1500 M
5 ANKITA 36 SWIMMING 12/01/1998 750 F
TABLE: COACHES
SPORTSPERSON SEX COACH_NO
AJAY M 1
SHAILYA F 2
VINOD M 1
TANEJA F 3
(i) SELECT AVG(PAY) FROM CLUB WHERE SPORTS=”KARATE”;
(ii) (a) SELECT MIN(AGE) FROM CLUB WHERE SEX=”F”;
(b) SELECT COUNT(DISTINCT SPORTS) FROM CLUB;
(iii) SELECT SPORTSPERSON, COACHNAME
FROM CLUB, COACHES
WHERE CLUB. COACH_ID=COACHES.COACH_NO;
27 Write a function/method DISPLAYWORDS( ) in python to read lines from a 3
text file STORY.TXT and display those words, which are less than 4
characters.
(OR)
Write a function to count the words He/She in a file.
28 (a) Consider the following tables DOCTOR and SALARY. Write SQL commands for the 2+1
following statements.
Table: DOCTOR
ID NAME DEPT SEX EXPERIENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15
Table: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
117 11000 1000 300
111 41000 1600 200
130 21700 2600 300
(i) Display NAME of all doctors who are in “ORTHOPEDIC” having more
than 10 years experience from the table DOCTOR.
(ii) Display the average salary of all doctors working in “ENT” department
using the DOCTOR and SALARY. (Salary= Basic + Allowance)
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee amount for all male doctors.
(b) Write the command to view all tables in a database.
29 Write a function in python POP(Arr), where Arr is a stack implemented by a 3
list of numbers. The function returns the value deleted from the stack.
30 Write a function called rem_keys( D,keylist) that accepts two parameters: a 3
dictionary called D and a list called keylist. Function rem_keys(D,keylist)
should remove all the keys contained in the passed keylist from the dictionary
D and return the dictionary.
(OR)
Write a function addrecord( ) to add new record to the binary file “student”
using list. The list should consist of student number, student name and marks
of the student.
S.NO SECTION-D MARKS
31 Bias Methodologies is planning to expand their network in India, starting with 5
three cities in India to build infrastructure for research and development of
their chemical products. The company has planned to set up their main office
in Pondicherry at three different locations and have named their offices as
Back Office, Research Lab and Development Unit. The company has one
more research office namely Corporate Unit in Mumbai. A rough layout of
the same is as follows:

Approximate distance between these offices are as follows:


FROM TO DISTANCE
Research Lab Back Office 110 m
Research Lab Development Unit 16 km
Research Lab Corporate Unit 1800 km
Back Office Development Unit 13 km
In continuation of the above, the company experts have planned to install the
following number of computers in each of their offices.
Research Lab 158
Back office 79
Development Unit 90
Corporate Unit 51
(i) Suggest the type of network required (out of LAN, MAN, WAN) for
connecting each of the following office units.
 Research Lab and Back Office
 Research Lab and Development Unit.
(ii) Which one of the following device, will you suggest for connecting all the
computers with in each of their office units?
 Switch/Hub
 Modem
 Telephone
(iii) (a) Which of the following communication medium will you suggest to be
procured by the company for connecting their local office units in
Pondicherry for very effective (high speed) communication?
 Telephone cable
 Ethernet cable
 Optical fibre
(iv) Which building is suitable to install the server with suitable reason?
(v) Suggest a cable/wiring layout for connecting the company’s local office
units located in Pondicherry. Also, suggest an effective method/technology for
connecting the company’s office unit located in Mumbai.
32 (a) Predict the output for the following code: 2+3
num=123
f=0
s=0
while(num > 3):
rem = num % 100
if(rem % 2 != 0):
f += rem
else:
s+=rem
num /=100
print(f-s)
(b) A library uses a database management system (DBMS) to store the details
of the books that it stocks, its registered members and the book-loans that the
library has made. These details are stored in a database using the following
three relations. Name of the Database: KVS Library. (NOTE: The library
does not stock more than one copy of the same book)
 Book(BookID: Char(5), Title: Varchar(25), Author: Varchar(25),
Publisher: Varchar(100))
 Member(MemberID: Char(5), FirstName: Varchar(25), LastName:
Varchar(25), Correspondance-Address: Varchar(100), Pincode:
Char(6), DateofBirth: Date, EmailID:Varchar(50))
 Loan(MemberId: Char(5), BookID: Char(5), LoanDate: Date,
DueBackDate: Date, Returned: Boolean)
(i) Identify following types of keys from all the relations of the given
database: Foreign keys along with parent relations
(ii) Can a relation have multiple foreign keys? Give example.
(iii) Write a SQL query to retrieve the names and email addresses of the
members belonging to KVS (they have email ids as [email protected]) and who
have not returned their books.
(OR)
(a) Predict the output for the following code:
def test(i, a =[]):
a.append(i)
return a
test(25)
test(32)
s = test(17)
print(s)
(b) The given program is used to connect with MYSQL and show the name of
all tables available in MySQL server ”TEST” database. You are required to
complete the statements so that the code can be executed properly.
import _______ (i)
# complete the statement with appropriate library name
db=mysql.connector. __________(ii)
(host=”localhost”, user=”root”, password=”smsmb”)
# fill the statement with appropriate method
cur=db._________( ) (iii)
# method to open the cursor object
data= ”______” (iv)
#complete the statement with the appropriate database name
cur.execute(“________”+data) (v)
# command to open the database
cur.execute(“______________________”) (vi)
#command to display name of all the tables
33 What is stack type of data structure? List out its applications. 5
Write a function called authenticate(users,loginid,password) which takes
following three parameters:
users: a dictionary storing login ids and corresponding password values
loginid: a string for a login name
password: a string for a password
The function should do the following:
(i) if the user exists and the password is correct for the given loginid, it should
print “Access granted”
(ii) if the user exists and the password is incorrect for the given loginid, it
should print “Incorrect password”
(iii) if the user does not exist for the given loginid, it should print “Wrong
credentials”
(OR)
What is a file? How a text file is different from binary file?
A binary file “BOOK.dat” has structure [BookNo, Book_Name, Author,
Price]
(i) Write a user defined function Createfile( ) to input data for a record and
add to Book.dat
(ii) Write a function Countrec(Author) in python which accepts the Author
name as parameter and count and return number of books by the given Author
are stored in the binary file “Book.dat”
S.NO SECTION-E MARKS
34 Database name: Shop 1+1+2
Table name: Infant
Itemcode Item Datepurchase Unitprice Discount
101 Frock 2016-01-23 700 10
102 Cot 2015-09-23 5000 25
103 Soft Toy 2016-06-17 800 10
104 Baby Socks 2014-10-16 100 7
105 Baby Suit 2015-09-20 500 5
(i) Write a query to make Item code as primary key in the above existing table.
(ii) Write the command to remove the column Discount.
(iii) (a) Write the command to display the structure of the table infants which
is Shop database.
(b) Write the degree and cardinality of the table.
(OR) (Option given for part (iii) only)
(iii) (a) Add a new row with the following values in respective attributes.
Itemcode=106, Item=Bath Tub, Datepurchase=2015-10-22, Unitprice=1500
(b) Write the command to display Item, Unitprice in descending order.
35 Ariba Malik has been following incomplete code, which takes a student’s 4
details (rollnumber, name and marks) and writes into a binary file stu.dat
using pickling.
import pickle
sturno=int(input(“Enter roll number:”))
stuname=input(“Enter name:”)
stumarks=float(input(“Enter marks:”))
stu1={“RollNo.”:sturno,”Name”:stuname,”Marks”:stumarks}
with __________ as fh: # Fill_Line1
________________ # Fill_Line2
______________ as fin: # Fill_Line3
________________ # Fill_Line4
print(Rstu)
if Rstu[“Marks”]>=85:
print(“Eligible for merit certificate”)
else:
print(“Not eligible for merit certificate”)
(a) Complete Fill_Line1 so that the mentioned binary file is opened for
writing in fh object using a with statement.
(b) Complete Fill_Line2 so that the dictionary stu1’s contents are written on
the file opened in step(a)
(c) Complete Fill_line3 so that the earlier created binary file is opened for
reading in a file object namely fin, using a with statement.
(d) Complete Fill_line4 so that the contents of open file in fin are read into a
dictionary namely Rstu.

You might also like