Cblecspu 03
Cblecspu 03
Sample Paper 3
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.
Section A
4. Which of the following is the correct output for the execution of the following Python statement?
print(5+3**2/2)
(a) 32 (b) 8.0
(c) 9.5 (d) 32.0
6. _____command adds a primary key to a table after it has been already created.
(a) MODIFY (b) ADD PRIMARY
(c) ALTER (d) ADD KEY
9. ______is an attribute that makes a link between two tables to fetch corresponding data.
(a) Primary key (b) Secondary key
(c) Foreign key (d) Composite key
10. Assume that the position of the file pointer is at the beginning of 3rd line in a text file. Which of the following option
can be used to read all the remaining lines?
(a) myfile.read(n-3) (b) myfile.read(n)
(c) myfile.readline( ) (d) myfile.readlines( )
11. ______is a protocol used for uploading and downloading of files in a network.
(a) SMTP (b) FTP
(c) PPP (d) VoIP
14. Given an object obj1= (10, 20, 30, 40, 50, 60, 70, 80, 90). What will be the output of print(obj1[3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70)
(c) (40,50,60) (d) (40,60)
15. Which of the following function returns the total number of values?
(a) MAX (b) MIN
(c) COUNT (d) SUM
16. Which of the following is the correct output for the following execution ?
print(print(“Biscope”))
(a) Biscope (b) None
(c) Biscope (d) Error
None
Directions : (Q. Nos. 17 and 18) are Assertion and Reason based questions.
17. Assertion (A) A Python function that accepts parameters can be called without any parameters. Reason (R) Functions
can carry default values that are used, whenever values are not received from calling function.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
18. Assertion (A) A CSV file is by default delimited by comma(,), but the delimiter character can be changed.
Reason (R) The writerow() function for CSV files has a “delimiter” parameter that can be used to specify the
delimiter to be used for a CSV file.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
Section - B
19. What will be the output for the following Python statement?
L = [10, 20, 30, 40, 50]
L = L + 5
print(L)
21. (a) What will be the output of the following Python code?
L =[10, 20]
L1=[30, 40]
L2=[50, 60]
L. append (L1)
L.extend(L2)
print(L)
(b) Find the output
>>> l1 = [1,2,3,4]
>>> l2 = [1,2,3,4]
>>> l1 > l2
25. If R1 is a relation with 8 rows and 5 columns, then what will be the cardinality of R1?
If 5 rows are added more, what will be the Degree of the table now ?
o
Identify commands/functions for the following actions
(i) To display only records of Trains from the Train table whose starting station is “NDLS”. (Column for starting
station is “Start”, table name is “Train”)
(ii) To get the average of percentage of students (Table name : “Student” , Percentage column : “Perc”).
Section - C
26. (a) Consider the tables CITY and LOCATION given below.
Table : CITY
Field Name Data Type Remarks
CITYNAME CHAR(30)
SIZE INTEGER
AVGTEMP INTEGER
POPULATIONRATE INTEGER
POPULATION INTEGER
Table: Location
Citycode Lname
C1 East
C2 West
C3 South
C4 North
Write a command to display the Cityname and corresponding Location name (Lname), where the average temperature
is greater than 35 from the tables.
(b) Write outputs for the SQL commands (i) to (iv) based on the table CUSTOMER given below:
TABLE: CUSTOMER
CID CNAME GENDER SID AREA
27. Write a Python program that read the data from file ‘original.dat’ and delete the line(s) having word (passed as an
argument). Then write these data after removing lines into file ‘duplicate.dat’.
o
Write a program in Python to open a text file “lines.txt” and display all those words whose length is greater than 5.
28. (a) Answer the questions (i) to (iv) on the basis of the following tables SHOPPE and ACCESSORIES.
TABLE: SHOPPE
Id SName Area
S001 ABC Computeronics CP
TABLE: ACCESSORIES
No Name Price Id
(i) To display Name and Price of all the ACCESSORIES in ascending order of their Price.
(ii) To display Id and SName of all SHOPPE located in Nehru Place.
(iii) To display Minimum and Maximum Price of each Name of ACCESSORIES.
(iv) To display Name, Price of all ACCESSORIES and their respective SName, where they are available.
(b) Write a command to add a new column Remarks varchar(30) to the ACCESSORIES table storing remarks about
the product.
29. Write a userdefined function parser(L) that accepts a list as parameter and creates another two lists storing the
numbers from the original list , that are even and numbers that are odd.
30. Consider the following stack of characters, where STACK is allocated N = 8 memory cells.
STACK : A, C, D, F, K,...,...,...
Describe the STACK at the end of the following operations. Here, Pop and Push are algorithms for deleting and
adding an element to the stack.
(i) Pop (STACK, ITEM)
(ii) Pop (STACK, ITEM)
(iii) Push (STACK, L)
(iv) Push (STACK, P)
Section D
31. Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to set up their
new offices in India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and
suggest them the best available solutions. Their queries are mentioned as (i) to (v) below.
33. What do you mean by file? What do you mean by file handling?
Write a program code in python to perform the following using two functions as follows :
(a) addBook( ) : to write to a csv file “book.csv” file book no, book name and no of pages with separator as tab.
(b) countRecords( ) : To count and display the total number of records in the “book.csv” file
o
Explain open( ) function with its syntax.
Write python code to perform the following using two user defined functions.
(a) showData() : To display only roll no and student name of the file “student.csv”
Section-E
34. Consider the following table STORE and answer the questions:
TABLE: STORE
ItemNo Item Scode Qty Rate LastBuy
2005 Sharpener Classic 23 60 8 31-JUN-09
2003 Balls 22 50 25 01-FEB-10
2002 Gel Pen Premium 21 150 12 24-FEB-10
2006 Gel Pen Classic 21 250 20 11-MAR-09
2001 Eraser Small 22 220 6 19-JAN-09
2004 Eraser Big 22 110 8 02-DEC-09
2009 Ball Pen 0.5 21 180 18 03-NOV-09
35. Given below is a code to open a text file “para.txt” and display the lines that begin with “A”.Some of the codes are
missing . Write codes to fill up the blanks :
myf=open(... ,...) Blank 1 , Blank 2
lines=myf....... . Blank 3
for ln in .... . . : Blank 4
if ln[0]= = “A”:
print(ln)
(i) Write the missing code for Blank 1.
(ii) Write the missing code for Blank 2.
(iii) Write the missing code for Blank 3 and Blank 4.