Cbse 12 CS SP1
Cbse 12 CS SP1
General Instructions:
4. Section B has 07 Very Short Answer type questions carrying 02 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.
Section A
1. State true or false: [1]
A string can be surrounded by three sets of single quotation marks or by three sets of double quotation marks.
2. Which of the following attributes can be considered as a choice for the primary key? [1]
a) Street b) Subject
c) Roll No d) Name
3. The set of records retrieved after executing an SQL query over an established database connection is called [1]
________.
a) table b) resultset
c) sqlresult d) result
4. Which of the following function calls will cause Error while invoking the below function definition? [1]
def test(a, b, c, d)
i. test(1, 2, 3, 4)
ii. test(a = 1, 2, 3, 4)
iii. test(a = 1, b = 2, c = 3, 4)
iv. test(a = 1, b = 2, c = 3, d = 4)
a) Perl b) PHP
1 / 11
Powered by EducoPRO
c) VB Script d) Ruby
6. We need to use some devices to store the data: [1]
a) SQL is portable(work on any machine i.e b) SQL has high speed(can query large
PC, mainframe etc.) volumes of data)
c) SQL can be used with any DBMS d) SQL can not work with relational databases
8. What is the full form of DDL? [1]
a) writecharacters( ) b) writeall( )
c) write( ) d) writeallchars( )
10. Which of the following functions removes all leading and trailing spaces from a string? [1]
a) rstrip() b) lstrip()
a) Tree b) Stack
c) Queue d) Branch
12. Which of the following function headers is correct? [1]
a) Flowchart b) Algorithm
a) none of these b) 0
c) 2 d) 1
16. Network congestion occurs: [1]
2 / 11
Powered by EducoPRO
terminates
17. Assertion (A): The tuple is used in the cases where we need to store the read-only collections. [1]
Reason (R): The literal syntax of the tuple is shown by the [].
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.
3 / 11
Powered by EducoPRO
i. x = 5
print(x)
y = 10
print(y)
a = x + y
print(a)
iii. x = 5
b = x + 5
x = Try
d = x/20
OR
Find the error in the following code fragment. State the reason behind the error.
box = { }
jars = { }
crates = { }
box['biscuit'] =1
box['cake'] = 3
jars['jam'] = 4
crates['box'] = box
crates['jars'] = jars
print (crates[box])
25. Write a function AMCount() in Python, which should read each character of a text file STORY.TXT, should [2]
count and display the occurrence of alphabets A and M (including small cases a and m too).
Example: If the file content is as follows:
Updated information
As simplified by official websites.
The EUCount() function should display the output as:
A or a : 4
M or m : 2
OR
Your recipe uses some ingredients. Write a program to store the list of ingredients in a binary file.
Section C
26. Answer: [3]
(i) Find the error(s).
L1 = [7, 2, 3, 4]
L2 = L1 + 2
L3 = L1 * 2
L = L1. pop(7)
4 / 11
Powered by EducoPRO
(ii) Write the one example of following terms.
i. Identifier
ii. Punctuator
iii. Keyword
iv. Constant
27. Give output for following queries as per given table(s): [3]
Table: DOCTOR
Table: SALARY
5 / 11
Powered by EducoPRO
i. num = 1
def myfunc():
return num
print(num)
print(myfunc())
print(num)
ii. num = 1
def myfunc():
num = 10
return num
print(num)
print(myfunc())
print(num)
iii. num = 1
def myfunc():
global num
num = 10
return num
print(num)
print(myfunc())
print(num)
iv. def display ():
print ("Hello", end = ' ')
display()
print("there!")
OR
Trace the flow of execution for following programs:
i. 1 def power(b., p):
2 r = b ** p
3 return r
4
5 def cpower(a):
6a=a+2
7 a = power(a, 0.5)
8 return a
9
10 n = 5
11 result = cpower(n)
12 print (result)
ii. 1. def increment(x)
2. x = x + 1
3.
6 / 11
Powered by EducoPRO
4. # main program
5. x = 3
6. print(x)
7. increment(x)
8. print(x)
iii. 1. def increment(x):
2. z = 45
3. x = x + 1
4. return x
5.
6. # main
7. y = 3
8. print(y)
9. y = increment(y)
10. print(y)
11. q = 77
12. print(q)
13. increment(q)
14. print(q)
15. print(x)
16. print(z)
Section D
31. Write Push (contents) and Pop (contents) methods in Python to add numbers and remove numbers considering [5]
them to act as Push and Pop operations of stack.
32. Answer (i) & (ii) OR (iii) & (iv) [5]
(i) Write a method in Python to write multiple line of text contents into a text file diary.txt.
(ii) Write code to open file contacts.txt with shown information and print it in the following form:
Name : <name>
Phone : <phone number>
(iii) Define the following terms:
i. dump() method
ii. load() method
(iv) If the file 'poemBTH.txt' contains the following poem (by Paramhans Yoganand):
God made the Earth;
Man-made confining countries
And their fancy-frozen boundaries.
But with unfound boundless Love
I behold the borderland of my India
Expanding into the World.
Hail, mother of religions, Lotus, scenic beauty and sages!
What outputs will be produced by both the code fragments given below:
7 / 11
Powered by EducoPRO
a. my_file =open('poemBTH.txt', 'r')
my_file.read()
b. my_file = open('poemBTH.txt', 'r')
my_file.read(100)
33. Give output for following SQL queries as per given table(s): [5]
Table: WORKERS
Table: DESIG
8 / 11
Powered by EducoPRO
iv. SELECT SUM(BENEFITS)
FROM WORKERS
WHERE DESIGNATION = 'Salesman';
OR
Write SQL queries for (i) to (vii) on the basis of table ITEMS and TRADERS:
Table: ITEMS
Table: TRADERS
i. To display the details of all the items in ascending order of item names (i.e., INAME).
ii. To display item name and price of all those items, whose price is in the range of 10000 and 22000 (both values
inclusive).
iii. To display the number of items, which are traded by each trader. The expected output of this query should be:
T01 2 T02 2 T03 1
iv. To display the price, item name and quantity (i.e., qty) of those items which have quantity more than 150.
v. To display the names of those traders, who are either from DELHI or from MUMBAI.
vi. To display the names of the companies and the names of the items in descending order of company names.
vii. Obtain the outputs of the following SQL queries based on the data given in tables ITEMS and TRADERS above.
a. SELECT MAX (PRICE), MIN (PRICE) FROM ITEMS;
b. SELECT PRICE*QTY FROM ITEMS WHERE CODE=1004;
c. SELECT DISTINCT TCODE FROM ITEMS;
d. SELECT INAME, TNAME FROM ITEMS I, TRADERS T WHERE I.TCODE=T.TCODE AND QTY<100;
Section E
34. Read the text carefully and answer the questions: [4]
Learn Together is an educational NGO. It is setting up its new campus at Jabalpur for its web-based activities.
The campus has 4 compounds as shown in the diagram below:
9 / 11
Powered by EducoPRO
Center to center distances between various Compounds as per architectural drawings (in Metre) is as follows:
Main Compound 5
Resource Compound 15
Accounts Compound 20
(i) Suggest the most suitable place (i.e., compound) to house the server for this NGO. Also, provide a suitable
reason for your suggestion.
(ii) Suggest the placement of Repeater with justification.
(iii) The NGO is planning to connect its International office situated in Mumbai, which out of the following
wired communication link, you will suggest for very high-speed connectivity?
i. Telephone Analog Line
ii. Optical Fiber
iii. Ethernet Cable
OR
Suggest the placement of Hub/Switch with justification.
35. Read the text carefully and answer the questions: [4]
Consider the following tables STORE and SUPPLIERS:
Table: STORE
10 / 11
Powered by EducoPRO
2004 Eraser Big 22 110 8 02-Dec-09
Table: SUPPLIERS
Scode Sname
21 Premium Stationers
23 Soft Plastics
22 Tetra Supply
11 / 11
Powered by EducoPRO