Class 12 Sample Paper CS
Class 12 Sample Paper CS
General Instructions:
1. This question paper contains two parts A and B. Each part is compulsory.
2. Both Part A and Part B have choices.
3. Part-A has 2 sections: a. Section – I is short answer questions, to be answered in one word or one
line.
b. Section – II has two case studies questions. Each case study has 4 case-based sub-parts. An
examinee is to attempt any 4 out of the 5 subparts.
Part – A
Section – 1
1|Page
ii. To change the first character of the string in capital
letter.
9. Which method returns the next row from the result set as 1
tuple?
(a) fetchone ( )
(b) fetchmany ( )
(c) fetchall ( )
(d) rowcount
10. The insertion of element in a stack is technically called. 1
a) pull operation
b) insert operation
c) pop operation
d) push operation
11. Define Primary key. 1
12. Which method is used to get the row-id of the last modified 1
row?
(A) cursor.getrowid()
(B) cursor.endrowid()
(C) cursor.lastrowid()
(D) cursor.exitrowid()
13. Which of the following function headers is correct? 1
a) def fun(a = 2, b = 3, c): b) def fun(a = 2, b, c = 3):
c) def fun(a, b = 2, c = 3): d) def fun(a, b, c = 3, d):
14. Mandatory arguments required to connect any database 1
from Python
(A) Username, Password, Hostname, Database Name, Port.
(B) Username, Password, Hostname.
(C) Username, Password, Hostname, Database Name.
(D) Username, Password, Hostname, Port.
15. Suppose a tuple T is declared as T = (10, 12, 43, 39), which 1
of the following is incorrect?
a) print(T[1]) b) T[2] = -29 c) print(max(T)) d) print(len(T))
16. Which of the following statement is outside the function 1
“sum”?
def sum():
a = int(input(“Enter number”))#Statement 1
b = int(input(“Enter number”)) #Statement 2
s = a + b #Statement 3
print(s) #Statement 4
a. Statement 1
b. Statement 2
c. Statement 3
d. Both Statement 3 and Statement 4
17. Raj wants to make EmpNo and PFNo columns of his table 1
as the primary key. Is it possible?
(a) Yes
(b) No
(c) Yes , possible as a combination of columns
(d) None of the above
18. Which technique is followed by stacks? 1
19. Write a statement in Python to declare a dictionary whose 1
keys are 1, 2, 3 and values are Monday, Tuesday and
2|Page
Wednesday respectively.
20. In the following question, A statement of Assertion (A) is 1
followed by a statement of Reason (R). Mark the correct
choice as.
(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 correct explanation
for A.
(C) A is true but R is false.
(D) A is false but R is true.
Section – II
Both the Case study based questions are compulsory. Attempt any 4 sub-parts
from each question. Each question carries 1 mark
Table : STORE
ItemNo ItemName Scode Quantity
2005 Sharpener Classic 23 60
2003 Ball Pen 22 50
2002 Gel Pen Premium 21 150
2006 Gel Pen Classic 21 250
2001 Eraser Small 22 220
2004 Eraser Big 22 110
2009 Ball Pen 21 180
Part – B
Section – I
5|Page
32. What will be the output of the following statements?
(a) 2
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2]
print(y)
(b)
x=2
while x < 9:
print(x, end='')
x=x+1
33. Differentiate between char(n) and varchar(n) data types with 2
respect to databases.
Section – II
(b)
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
35. Write a program in Python to create a dictionary whose keys are 3
month names and whose values are the number of days in the
corresponding months.
(a) Ask the user to enter a month name and use the dictionary to
tell them how many days are in the month.
(b) Print out all of the keys in alphabetical order.
(c) Print out all the months with 31 days.
36. Write the outputs of the SQL queries (i) to (iii) based on the 3
6|Page
relations Teacher and Posting given below:
Table : Teacher
T_ID Name Age Department Date_of_join Salary Gender
Computer
1 Jugal 34 10/01/2017 12000 M
Sc
2 Sharmila 31 History 24/03/2008 20000 F
3 Sandeep 32 Mathematics 12/12/2016 30000 M
4 Sangeeta 35 History 01/07/2015 40000 F
5 Rakesh 42 Mathematics 05/09/2007 25000 M
6 Shyam 50 History 27/06/2008 30000 M
Computer
7 Shiv Om 44 25/02/2017 21000 M
Sc
8 Shalakha 33 Mathematics 31/07/2018 20000 F
Table : Posting
P_ID Department Place
1 History Agra
2 Mathematics Raipur
Computer
3 Delhi
Science
i. SELECT Department, count(*) FROM Teacher GROUP BY
Department;
ii. SELECT Max(Date_of_Join),Min(Date_of_Join) FROM Teacher;
iii. SELECT Teacher.name,Teacher.Department, Posting.Place
FROM Teachr, Posting WHERE Teacher.Department =
Posting.Department AND Posting.Place= “Delhi”;
37. Write a function in Python PUSH(Arr), where Arr is a list of 3
numbers. From this list push all numbers divisible by 5 into a
stack implemented by using a list. Display the stack if it has at
least one element, otherwise display appropriate error message.
Section – III
7|Page
On being popped, the output should be
198 140 14 52 EmptyStack
40. Consider the table, MOVIEDETAILS given below: 2+3=5
Table: MOVIEDETAILS
MOVIEID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
Harry
Potter
and the Prime
M011 English 4
Chamber Video
of
Secrets
M015 Uri Hindi 5 Zee5
Avengers:
M020 English 4 Hotstar
Endgame
(a) Identify the degree and cardinality of the table.
(b) Which field should be made the primary key? Justify
your answer.
Table: EMPLOYEE
EMPID NAME DOB DEPTID DESIG SALARY
23-Jan-
120 Alisha D001 Manager 75000
1978
10-Oct-
123 Nitin D002 AO
1977
12-Jul-
129 Navjot D003 Supervisor 40000
1971
30-Dec-
130 Jimmy D004 Sales Rep
1980
06-Apr- Dep
131 Faiz D001 65000
1984 Manager
Table: DEPARTMENT
DEPTID DEPTNAME FLOORNO
D001 Personal 4
D002 Admin 10
D003 Production 1
D004 Sales 3
-----------------xxxxxxxxxxxx-----------------
8|Page