SRI VIJAY VIDYASHRAM SENIOR SECONDARY SCHOOL BAGLUR
CS Board Scheme (Level 2)
COMPUTER SCIENCE
CLASS: XII
Time Allowed: 3 hr Maximum Score:70
General Instructions:
This question paper contains five sections, Section A to E.
All questions are compulsory.
Section A has 21 questions carrying 01 mark each.
Section B has 07 Very Short Answer type questions carrying 02
marks each
Section C has 03 Short Answer type questions carrying 03
marks each.
Section D has 04 Long Answer type questions carrying 04 marks
each.
Section E has 02 questions carrying 05 marks each.
All programming questions are to be answered using Python
Language only.
Section A
1. What are tokens?
2. State True or False :Python is an interpreted language
3. Predict the output of the following code?
x=”welcome to svv 25”
print(x[::-2]
4. Write the output of the code given below:
my_dict={"name":"Aman","age":26}
my_dict['age']=27
my_dict['address']="Delhi"
print(my_dict items())
5. Given the following dictionaries
dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}
Which statement will merge the contents of both dictionaries?
a dict_exam update(dict_result) b dict_exam +
dict_result
c dict_exam add(dict_result) d dict_exam
merge(dict_result)
6. Consider the given expression:
not True and False or True
Which of the following will be correct output if the given expression is
evaluated?
a. True b False c NONE d NULL
7. Select the correct output of the code:
a = "Year 2022 at All the best"
a = a split('2')
b = a[0] + " " + a[1] + " " + a[3]
print (b)
a. Year 0 at All the best c Year 0 at All the best
b. Year 022 at All the best d Year 0 at all the best
8. Which of the following statement(s) would give an error after executing the
following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
a. Statement 3 b Statement 4 c Statement 5 d Statement 4 &5
9. What will the following expression be evaluated to in Python?
print(15.0 / 4 + (8 + 3.0))
a) 14.75 b 14.0 c 15.75 d 15.5
10. Predict the output of the following code:
def CALLME(n1=1,n2=2):
n1=n1*n2
n2+=2
print(n1,n2)
CALLME()
CALLME(3)
a 24 b 42 c 44 d 24
62 26 64 64
11. _____ Command is used to update records in the MySQL table
a) ALTER b UPDATE c MODIFY d SELECT
12. _______ is the table constraint used to stop null values to be entered in the field
a. Unique b Not NULL c Not Empty d
None
13. In SQL, we use _____ command to display the list of databases in the server
a) SELECT DATABASES; c SHOW DATABASES;
b) SELECT DATABASE; (c) d DESC
14. ________ Protocol is used to send mail
a) SMTP b FTP c POP d HTTPS
15. Which of the following command is DDL command ?
a) Truncate b insert c delete d update
16. Each IP packet must contain:
a. Only Source address c Only Destination address
b. Source and Destination address d Source or Destination
address
17. Which transmission media is capable of having a much higher bandwidth (data
capacity)?
a. Coaxial c Untwisted cable
b. Twisted pair cable d Fiber optic
18. The process of creating exception object and handling it over to runtime system
is called?
a) Catching exception c Throwing exception
b) Raising exception d Asserting exception
19. Write the missing statement to complete the following code:
file = open("example.txt", "r")
data = file.read(100)
____________________ #Move the file pointer to the beginning of the
file
next_data = file.read(50)
file.close()
Q20 and Q21 are Assertion(A) and Reason(R) based questions.
(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
20. Assertion(A): Non-default arguments can be placed before or after a default
argument in a function definition.
Reason®: In a function header, any parameter cannot have a default value
unless all parameters appearing on its right have their default values.
21. Assertion(A): Select command is a DDL command
Reason®: DDL commands are used to create, define, change and delete
objects like tables, indexes, views, and constraints.
Section B
22. Differentiate explicit and implicit conversions?
23. Give two examples for membership and identity operators ?
24. If T= (1,3,4,5,6,3) the answer the below questions using built in functions
a) Write a statement to convert the tuple T into list named as L
OR
b) Write a statement to find the sum of all the elements in the tuple T
a. Write a statement to check whether an element 7 is present or not in the
tuple T
OR
b. Write a statement to sorte the tuple T1 in descending order and store
into another tuple T2
25. What are the possible outcome(s) from the following code?
import random
PICK=random randint (1,3)
CITY= ["DELHI", "MUMBAI", "CHENNAI", "KOLKATA"]
for I in CITY:
for J in range (0, PICK):
print (I, end = "")
print ()
a DELHIDELHI b DELHI
MUMBAIMUMBAI DELHIMUMBAI
CHENNAICHENNAI DELHIMUMBAICHENNAI
KOLKATAKOLKATA
C DELHI D DELHI
MUMBAI MUMBAIMUMBAI
CHENNAI KOLKATA KOLKATA KOLKATA
KOLKATA
Write the modules that will
be required to be importe
d to execute the following
codeinPython
defmain():
foriinrange(len(string))):
ifstring[i]==‘’“
print
else:
c=string[i] upper()
print(“stringis:”,c)
print(“Stringlength=”,len(math
floor()))
Write the modules that will
be required to be importe
d to execute the following
codeinPython
defmain():
foriinrange(len(string))):
ifstring[i]==‘’“
print
else:
c=string[i] upper()
print(“stringis:”,c)
print(“Stringlength=”,len(math
floor()))
Write the modules that will
be required to be importe
d to execute the following
codeinPython
defmain():
foriinrange(len(string))):
ifstring[i]==‘’“
print
else:
c=string[i] upper()
print(“stringis:”,c)
print(“Stringlength=”,len(math
floor()))
Write the modules that will
be required to be importe
d to execute the following
codeinPython
defmain():
foriinrange(len(string))):
ifstring[i]==‘’“
print
else:
c=string[i] upper()
print(“stringis:”,c)
print(“Stringlength=”,len(math
floor()))
26. Rajat has written the following Python code. There are some errors in it. Rewrite
the correct code and underline the corrections made.
DEF execmain():
x = input("Enter a number:")
if (abs(x)=x):
print ("You entered a positive number")
else
x=*-1
print "Number made positive:"x execmain()
27. (I)
A. Which constraints that specifies all the possible values that the
attribute can hold?
OR
B. Which constraints ensure that all the values in an attribute should
not distinct.
(II)
A. Write an sql command to modify data type of an existing column
Occupation of employee table by varchar(25)
OR
B. Write an sql command to remove the details of employee whose salary
within the range 45000 to 60000
28. What is PPP protocol?
Section C
29. Write a python function that display those words which contains at least 5
characters from the file data.txt
30. A dictinary contains Rno,name,dob and class of a student.Write the following
user defined functions to perform given operations on the stack named
‘status’: i) Push_element() - To Push record- [Rno,name,dob] of
student who studing in class 12 to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them.
Also, display “Stack Empty” when there are no elements in the stack.
For example the
D={{‘Rno’:1,’name’:’Arjun’,’dob’:’1995/12/30’,’Class’:12},
{‘ Rno’:2,’name’:’Anju’,’dob’:’1998/11/10’,’Class’:11},
{ Rno’:3,’name’:’Vijay’,’dob’:’1996/10/13’,’Class’:12}}
After Push operation Status is[1,‘Arjun’, ’1995/12/30’]
[3,’Vijay’,’1996/10/13’]
After Pop operation, the output is
[3,’Vijay’,’1996/10/13’]
[1,‘Arjun’, ’1995/12/30’]
Stack empty
31. Consider the following code and then answer the questions that follow :
myDict = {'a' : 27, 'b' : 43, 'c' : 25, 'd' : 30}
valA =''
for i in myDict :
if i > valA :
valA = i
valB = myDict[i]
print(valA) #Line1
print(valB) #Line2
print(30 in myDict) #Line3
myLst = list(myDict.items())
myLst.sort() #Line4
print(myLst[-1]) #Line5
a. What output does Line 1 produce ?
b. What output does Line 2 produce ?
c. What output does Line 3 produce ?
d. What output does Line 5 produce ?
e. What is the return value from the list sort( ) function (Line 4) ?
Section D
32. Write the output of the queries (i) to (iv) based on the table VISITOR
33.
34. Consider the csv file batsman.csv has the following structure
[name,match_no,total_runs,nation,avg,best]
For example, a sample record of the file may be:
[‘Sachin Tendlkar’, 463, 18426, ‘India’, 44.6, 200]
Write the following Python functions to perform the specified operations on
this file:
(I) Read all the data from the file in the form of a list and display all those
records for which the batsman nation is ‘India’.
(II) Display the details of the batsman who scored maximum runs.
35. A table named batsman, in Cricket database has the following structure.
Name : varchar(20)
match_no :int
total_runs :int
nation :varchar(20)
avg :float
best :int
Write the following Python function to perform the specified operation:
I. Create_batsman(): Create the batsman table based on the above
structure in the database cricket
II. AddAndDisplay(): To input details of a batsman and store it in the
table batsman. The function should then retrieve and display all
records from the batsman table where the avg is greater than 43.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: root
Section E
36. SVV is planning to conduct a sports meet for four campus cbse children.
They need to store the winner’s details into the binary file and want to
display the winner’s details into the screen. For this they want to store the
following information of each winner.
Item_name : varchar(20)
Category :varchar(20)
Candidate_no :int
Cadidate_name :varchar(20)
Prize :varchar(5)
Campus : varchar(5)
For example, a sample record of the file may be:
[‘100m’,’kidzee boys’,101,’Dora’,’Second’,’Baglur’]
You, as a programmer of the company, have been assigned to do this job for
Surya.
(I) Write a function to input the data of a winner and append it in a binary
file.
(II) Write a function to update the data of winner whose candidate number
is 407 and changing his category from junior to sub junior.
(III) Write a function to read the data from the binary file and display the
data of all those candidates who got price in 100 meter junior race.
37. Garuda Consultants are setting up a secured network for their office
campus at Faridabad for their day office and web-based activities. They are
planning to have connectivity between 3 buildings and the head office
situated in Kolkata. Answer the questions (i) to (iv) after going through the
building positions in the campus and other details, which are given below:
Number of computers
Distance between various buildings
install at various location
Green Building to Red Building 120 m Head Office 10
Green Building to Blue Building 50 m Building Green 150
Blue Building to Red Building 65 m Building Blue 51
Faridabad to Head Office 1460 kms Building Red 25
a. Suggest the cable layout of connections between the buildings.
b. Suggest the most suitable place to house the server of this organization
with a suitable reason.
c. i. Suggest the placement of the following devices with justification:
i) Switch ii)Repeater
ii. Suggest the role of firewall in a network.
d. The organization is planning to provide a high speed link with its head
office situated in the KOLKATA using a wired connection. Which of the
following cables will be most suitable for this job?
i) Optical Fiber ii) Co-axial Cable iii) Ethernet Cable
e. Company is planning to get its website designed which will allow
employees to see their all details after registering themselves on its
server. Out of the static or dynamic, which type of website will you
suggest?