Cbse 12
Cbse 12
SAMPLE PAPER – 3
SUBJECT: COMPUTER SCIENCE
SuperNova-LearnPython, a YouTube channel dedicated to helping students to learn Python
and computer science concepts.
The channel covers various topics related to computer science, including Python
programming, data file handling, computer networking, SQL and many more.
If you’re looking for video descriptions, notes, assignments, and previous years’ question
papers related to Python and computer science for class 11 and 12, I recommend checking
out the SuperNova-LearnPython channel on YouTube.
SAMPLE PAPER – 3
Code: Learnpython4cbse-3/5(25CBSE02)
General Instructions:
19 Which wireless communication standard operates in the 2.4 GHz band and is commonly used for 1
local area networks?
Directions (Q. 20 and 21) are Assertion (A) and Reason (R) based questions. Mark the
correct choice as
(a) Both A and R are true and R is a correct explanation of A.
(b) Both A and R are true but R is not a correct explanation of A.
(c) A is true and R is false.
(d) A is false and R is true.
20 Assertion (A) A user-defined function that accepts 3 parameters where no parameter carries a 1
default value, must be called with 3 parameters.
Reason (R) Since, there are no default parameters, 3 parameters must be passed to the
function.
21 Assertion (A) The GROUP BY clause is mandatory when using aggregate functions like COUNT 1
or SUM.
Reason (R) Aggregate functions can only be applied to grouped data.
SECTION B [7x2= 14 Marks]
22 Write a method in Python to display the elements of list thrice if it is a number and display the 2
element terminated with '#' if it is not a number.
For example, if the content of list is as follows:
mylist = ['41','DROND','GIRIRAJ', T3‟,‟ZARA‟]
SAMPLE OUTPUT
414141
DROND#
GIRIRAJ#
131313
ZARA#
23 Find the result of following code: 2
Str="Myfriends"
(i) Str.capitalise() (ii) Str.upper()
24 If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30,40,50,20,50. . .], then 2
(Answer using builtin functions only)
(I) (A) Write a statement to delete the first occurrence of an element 20 from the list L2.
OR
(B) Write a statement to sort the elements of list L1 in descending order.
(II) (A) Write a statement to find the first lowest index of an element 50 from the list L2.
OR
(B) Write a statement to find the sum of all the elements from the list L1.
25 Identify the correct output(s) of the following code. Also, write the minimum and the maximum 2
possible values of the variable b.
import random
a = "Programming"
b = random.randint(3 , 8)
for i in range(0, b, 3):
print(a[i], end='*')
(a) P* (b) P*g* (c) P*g (d) P*g*m*
26 Rewrite the following code in Python after removing all syntax error(s). Underline each correction 2
done in the code.
def change():
"HELLO"=String
for I in range(0,len(String)–1)
if String[I]=>"M":
print (String[I],end="*")
else:
print String[I-1]
27 (I) 2
(A) What constraint should be applied on a table column to ensure that every value in that
column is unique and not NULL?
OR
(B) What constraint should be applied on a table column to ensure that every value in that
column is unique, but NULL values are allowed?
(II)
(A) Write an SQL command to drop a Foreign Key constraint from a table named ORDERS. The
constraint is named FK_CUSTOMER_ID.
OR
Write an SQL command to add a Foreign Key constraint to the ORDER table, linking the
CUSTOMER_ID column to the CUSTOMERS table‟s ID column. Assume the constraints name
should be FK_CUSTOMER_ID.
28 Name one commonly used open source internet browser and one commonly used open source 2
operating system.
OR
How many pair of wires is there in twisted pair cable (Ethernet)? What is the name of port, which
is used to connect Ethernet cable to a computer or a laptop?
SECTION C [3x3= 9 Marks]
29 (A) Write a function to count the number of lines starting with uppercase characters in a text file 3
“Help.doc”.
OR
(B) Write a function to count the number of lines starting with a digit in a text file “Diary.txt”.
30 (A) Julie has created a dictionary containing names and marks as key value pairs of 6 students. 3
Write a program, with separate user defined function to perform the following operations
Push the keys (name of the student) of the dictionary into a stack, where the
corresponding values (marks) are greater than 75.
Pop and display the content of the stack.
For Example If the sample content of the dictionary is as follows
R={“OM”:76, “JAI”:45,”BOB”:89,”ALI”:65,”ANU”:90,”TOM”:82}
The output from the program should be:
TOM ANU BOB OM
OR
(B) Alam has a list containing 10 integers. You need to help him create a program with separate
user defined functions to perform the following operations based on this list.
Traverse the content of the list and push the even numbers into a stack.
Pop and display the content of the stack.
For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12
31 Find and write the output of the following python code: 3
def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i] //= 5
if M[i]%3 == 0:
M[i] //= 3
L=[25,8,75,12]
ChangeVal(L,4)
for i in L :
print(i, end='#')
OR
Find and write the output of the following python code:
def Call(P=40,Q=20):
P=P+Q
Q=P-Q
print(P,'@',Q)
return P
R=200
S=100
R=Call(R,S)
print (R,'@',S)
S=Call(S)
print(R,'@',S)
SECTION D [4x4= 16 Marks]
OR
B) Write the output
(I) Select Name, Deptid, Basic from employee where doj > '23-Sep-2000';
(II) Select * from Employee where name not in ('Jyoti','Harry');
(III) SELECT Eid, MIN(HRA) FROM Employee GROUP BY Deptid;
(IV) SELECT Name, Qualification FROM Employee WHERE Qualification LIKE “_ _T%‟;
33 Radha Shah is a Programmer, who has recently been given a task to write a python code to 4
perfrom the following CSV file operations with the help of two user defined functions/modules.
For example, a sample record of the file may be:
[„Python Programming‟, „Deitel‟, 500, 20]
[„Java Programming‟, „John‟, 550, 10]
(I) CSVOpen(): to create a CSV file called BOOKS.CSV in append mode containing information of
book – title, Author, Price and Qty .
(II) CSVRead(): to display the records from the CSV file called BOOKS.CSV WHERE THE FIELD
TITLE STARTS WITH ‟R‟.
34 Write SQL commands for (i) to (iv) based on a table COMPANY and CUSTOMER 4
CID NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI LAPTOP
TABLE : CUSTOMER
CUSTID NAME PRICE QT CID
101 ROHAN SHARMA 70,000 20
Y 222
102 DEEPAK KUMAR 50,000 10 666
103 MOHAN KUMAR 30,000 5 111
104 SAHIL BANSAL 35,000 3 333
105 NEHA SONI 25,000 7 444
106 SON AL 20,000 5 333
107 AGGARWAL
ARUN SINGH 50,000 15 666
(I) To display those company name which are having prize less than 30000.
(II) To display the name of the companies in reverse alphabetical order.
(III) To increase the prize by 1000 for those customer whose name starts with „S‟?
(IV) (A) To add one more column totalprice with decimal (10,2) to the table customer.
OR
(B) To display maximum and minimum price of the customers whose Qty is greater than 10
35 A Consider the table Defence storing details of Defence personnel as per following structure- 4
Did Wing Rank Grade
Arm01 Army Major 3 (Sample record)
36 Ravi is a librarian working in a city library. He needs to manage the records of various books. For 5
this, he wants the following information of each book to be stored:
Book_ID - integer
Book_Title - string
Author_Name - string
Price - float
You, as a programmer hired by the library, have been assigned to do this job for Ravi. Suggest:
(I) Write a function to input the details of a book and append it to the BINARY file „BOOK.DAT‟.
(II Write a function to update the data of books whose Price is more than 550 and change their Book_Title to
Research Building 20
Academic Building 150
Admin Building 35
Delhi Admission Office 5
(I) Suggest the authorities, the cable layout amongst various buildings inside the
university campus for connecting the buildings.
(II) Suggest the most suitable place (i.e. building) to house the server of this organisations
with a suitable reason.
(III) Suggest an efficient device for the following to be installed in each of the building to
connect all the computers