You are on page 1of 5

KENDRIYA VIDYALAYA SANGATHAN, SILCHAR REGION

Class: XII Pre-Board Exam-1 Session: 2022-23


Computer Science (Code 083)

Maximum Marks: 70 Time Allowed: 3 Hours


General Instructions:
• The question paper is divided into 5 Sections - A, B, C, D and E.
• Section A consists of 18 MCQ (Multiple Choice Questions) of 1 mark each.
• Section B consists of 7 VSA (Very Short Answer) Questions (19-25) of 2 marks each.
• Section C consists of 5 SAT (Short Answer Type) Questions (26-30) of 3 marks each.
• Section D consists of 3 LAT (Long Answer Type) Questions (31-33) of 5 marks each.
• Section E consists of 2 Questions (34-35) of 4 marks each. One internal choice is given in Q35 against part (b)
only.
 All programming questions are to be answered using Python Language only.

Q.N. Section-A: This section consists of 18 MCQ (Multiple Choice Questions) of 1 mark each.

Find the invalid identifier from the following


1
a. abc b. 1abc c. abc_1 d. _abc1

Given an object L= [[1,2,3],4,5, [6,7,8]] What will be the output of print (L [3][1]])?
2
a. [6,7,8] b. 6 c. 5 d. 7
Which of the following statement(s) would give an error after executing the following code?
S1="Hello All" # Statement 1
print(S) # Statement 2
S2=S1+3 # Statement 3
3 print(S2) # Statement 4
S3=S1+"Welcome to my class" # Statement 5

a. Statement 3 b. Statement 4 c. Statement 5 d. Statement 4 and 5


Address of an Object or variable can be identified by using
4
a. type () b. id() c. addr() d. all of the above
Given an object rec = [101, ‘Raisha’,’Delhi’, 5]. Identify the statement that will result in an error.
a. print(rec[2])
5 b. rec[2] = ‘Silchar’
c. print(min(obj1))
d. print(len(obj1))

Consider the following function call


sum (a=45, b=67)
6
In the above line a=45 and b=67 represents ________
a. default values b. keyword arguments c. Value assignment d. Error

The _____ method of a file object flushes any unwritten information and closes the file object.
7
a. flush() b. close() c. clear() d. flushall()

______ command is used to delete a column from the table in SQL.


8
a. update b. remove c. alter d. drop

Syntax of seek function in Python is fileObj.seek(offset, position) where fileObj is the file
9 object. What is the default value of position?
a. 0 b. 1 c. 2 d. 3
Pickling in python means _______________________
a. Python object is converted into a byte stream,
10 b. Python byte stream is converted into python object
c. both statements are true
d. None of the above are true
Which of the following commands will delete the table from MYSQL database?
11
a. DELETE TABLE b. DROP TABLE c. REMOVE TABLE d. ALTER TABLE
_________ is an attribute, which serves the purpose of uniqueness of records in a relation in SQL.
12
a. Primary Key b. Foreign Key c. Candidate Key d. Alternate Key
The SELECT statement when combined with __________ clause, returns records in ascending order of
13 column name.
a. group by b. where c. order by d. like
Which function is used to display the total of values of column from table in a database?
14
a. sum(*) b. total(*) c. count(*) d. return(*)
What will the output if following expression be evaluated to in Python?
15 42+4-3**2//19-3
a. 43.25 b. 43.0 c. 43 d. 43.5
An IPv4 address consists of …………………… bits.
16
a. 4 b. 16 c. 32 d. 128

17 (b) Both A and R are true and R is not the correct explanation for A

18 (a) Both A and R are true and R is the correct explanation for A

Q.N. Section B consists of 7 VSA (Very Short Answer) Questions (19-25) of 2 marks each.

19 Any two advantages and two drawbacks of Star Topology

20 22.8

Candidate Keys – Acc_No, Cust_Name, Cust_Phone


21
Primary Key – Acc_No
Circuit Switching Packet Switching

Requires point to point connections Sends data in small blocks, called packets.
during calls. Packets reassembled in proper sequence at
the receiver end.
Required dedicated connection Not required dedicated connection
Circuit-switched networks were used Packet-switched networks are used for data
for phone calls transfers

22
HyperText Markup Language. eXtensible Markup Language.
HTML is case insensitive. XML is case sensitive.
HTML is used for designing a web-page XML is used basically to transport data between
to berendered on the client side. the application and the database.

HTML has its own predefined tags. Uses custom tags defined by the user.
XML is about carrying information hence
HTML is about displaying data, hence
static. dynamic.
Inside the function
X : 25
23 Name Asha
Outside the function
X : 25
24 b. ii , iv

Create table Department (DEPTNO int PRIMARY KEY, DNAME varchar(14) NOT NULL, LOC varchar(13),
25 Salary decimal);

Q.N. Section C consists of 5 SAT (Short Answer Type) Questions (26-30) of 3 marks each.

26 11

27 iIlOVEepYTHON

Write a function in Python POP_OUT(Stk), where Stk is a stack implemented by a list of numbers. The
function returns the value which is deleted/popped from the stack.

def isEmpty(stk): # checks whether the stack is empty or not


if stk==[]:
return True
else:
return False
def POP_OUT(stk):
if isEmpty(stk): # verifies whether the stack is empty or not
print("Stack Underflow")
28 else: # Allow deletions from the stack
item=stk.pop()
if len(stk)==0:
top=-1
else:
top=len(stk)
return item

( ½ marks for correct POP_OUT() function header)


( ½ mark for checking empty stack status)
( ½ mark for removing item for stack )
( 1 mark for assignment in variable top)
( ½ mark for returning the deleted item)
 Create the above table, set Bid as Primary key.
Create table Library (Bid varchar(4) PRIMARY KEY, Name varchar(20), Author varchar(20), Price int,
Mem_name varchar(20), Issue_Date date, Status varchar(10));
29
 Modify the range of Author, increase it by 5 characters.
Alter table Library modify Author varchar(25);
(i) SELECT SUM (PERIODS), SUBJECT FROM SCHOOL GROUP BY SUBJECT;
ENGLISH 51
PHYSICS 76
MATHS 24
CHEMISTRY 27
(ii) SELECT TEACHERNAME, GENDER FROM SCHOOL, ADMIN WHERE DESIGNATION = ‘COORDINATOR’
AND SCHOOL.CODE=ADMIN.CODE;
PRIYA RAI FEMALE
LISA ANAND FEMALE
(iii) SELECT COUNT (DISTINCT SUBJECT) FROM SCHOOL;
4
(iv) SELECT TEACHERNAME, SUBJECT FROM SCHOOL ORDER BY EXPERIENCE DESC;

TEACHERNAME SUBJECT
UMESH PHYSICS
YASHRAJ MATHS
PRIYA RAI PHYSICS
30 RAVI SHANKAR ENGLISH
LISA ANAND ENGLISH
HARISH B CHEMISTRY
(v) SELECT TEACHERNAME, DESIGNATION FROM SCHOOL, ADMIN WHERE SCHOOL.CODE = ADMIN.CODE;
TEACHERNAME DESIGNATION
RAVI SHANKAR VICE PRINCIPAL
PRIYA RAI COORDINATOR
LISA ANAND COORDINATOR
YASHRAJ HOD
HARISH B SENIOR TEACHER
UMESH HOD
(vi) SELECT * FROM SCHOOL WHERE DOJ BETWEEN ‘01/01/1999’ and ‘31/12/2000’;
CODE TEACHERNAME SUBJECT DOJ PERIOD EXPERIENCE
1001 RAVI SHANKAR ENGLISH 12/03/2000 24 10
1203 LISA ANAND ENGLISH 09/04/2000 27 5
1045 YASHRAJ MATHS 24/08/2000 24 15
1167 HARISH B CHEMISTRY 19/10/1999 27 5
Q.No. Section-D: This section 3 LAT (Long Answer Type) Questions (31-33) of 5 marks each.
a.
import mysql.connector as pymysql
dbcon=pymysql.connect (host=”localhost”, user=”root”, passwd=”sia@1928”)
if dbcon.isconnected()==False:
print(“Error in establishing connection:”)
cur=dbcon.cursor()
query=” select * from stmaster”
cur.execute(query)
resultset=cur.fetchmany(3)
for row in resultset:
31
print(row)
dbcon . close ()

(b)
import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root", password="root@123",
database="management")
mycursor=con1.cursor() #Statement 1
print("Employees with salary greater than 53500 are : ")
Q = “Select * from employee where salary > 53500” #Statement2
data=cur.execute(Q) #Statement 3
for i in data:
print(i)
print()
(i) Identify the suitable code for blank space in the line marked as Statement-1.
csv
(ii) Identify the missing code for blank space in the line marked as Statement-2.
w
32 (iii) Choose the object name to be passed i n the line marked asStatement-3.
fw=csv.writer(f)
(iv) Identify the suitable code for the blank space in Statement-4.
fw.writerow(data[i])
(v) Write the suitable code for blank space in Statement-5.
c=c+1
(i) Suggest a cable layout of connections between the buildings.
Drawing of layout based on star or bus topology.
(ii) What is the most suitable block to install server?
Human Resource Block.
(iii) What will be the best possible connectivity out of the following to connect its new office in
33 Bengaluru with its London-based office?
a) Infrared b) Satellite c) Ethernet Cable
(iv) Which of the devices will you suggest to connect each computer in each of the above blocks?
a) Gateway b) Switch c) Modem
(v) Differentiate between LAN and WAN.
Any two differences

Q.No. Section-E: This section contains 2 Questions (34-35) of 4 marks each.

(i) Display details of those students whose NAME starts with ‘R’ or ‘P’.
Select * from Graduate where Name like ‘R%’ or Name like ‘P%’
(ii) To display NAME and STIPEND of students who are either PHYSICS or COMPUTER SC graduates.
Select Name, Stipend from Graduate where Subject in (‘Physics’, ‘Comp. Sc.’)
34
(iii) Increase the value of stipend of students of computer science by 500.
Update Graduate set stipend = stipend+500 where Subject = ‘Comp.Sc.’
(iv) Display NAME and SUBJECT of those students who have AVERAGE in the range of 65 and 75.
Select Name, Subject from Graduate where Average between 65 and 75
a.
f=open("test.txt","w") #Statement 1…round brackets to be used
L = ["My name\n", "is\n", "Amit"] #Statement 2
f.writeline (L) #Statement 3…No writeline attribute is there.
f.close() #Statement 4

b. This code will print contents of file1.txt in reverse order. That is: TAERG SI AIDNI

OR
35
# Function to print words which contains letter ‘S’ or ‘s’ anywhere in the word in “STORY.txt”
def DisplayWords():
f=open("D://STORY.txt","r")
s=f.read()
for w in s.split():
if "s" in w or "S" in w:
print(w)
f.close()

You might also like