0% found this document useful (0 votes)
28 views

Class 12 Sample Paper CS

The document provides a sample question paper for Class XII Computer Science exam. It contains instructions, 2 compulsory parts (A and B), and questions testing concepts like SQL, Python, databases, stacks etc. Part A has short questions and case studies. Part B has short, long and very long answer questions to be attempted in 3 hours.

Uploaded by

adityamendi01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Class 12 Sample Paper CS

The document provides a sample question paper for Class XII Computer Science exam. It contains instructions, 2 compulsory parts (A and B), and questions testing concepts like SQL, Python, databases, stacks etc. Part A has short questions and case studies. Part B has short, long and very long answer questions to be attempted in 3 hours.

Uploaded by

adityamendi01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Class: XII Session: 2022-23

Computer Science (083)


Sample Question Paper (Theory)
Maximum Marks: 70 Time Allowed: 3 hours

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.

4. Part - B is Descriptive Paper.


5. Part- B has three sections

a. Section-I is short answer questions of 2 marks each.


b. Section-II is long answer questions of 3 marks each.
c. Section-III is very long answer questions of 5 marks each.
6. All programming questions are to be answered using Python Language only

Part – A

Section – 1

Answer any 15 questions out of the given 21 questions.

Question Question Marks


No. allotted
1. Find the invalid identifier from the following 1
a) MyName b) True c) 2ndName d) My_Name
2. Consider a stack s=['a','b','c','d','e'], what will be the output 1
at the end of the execution of following commands?
Pop(), Push(‘f’), Push(‘g’), Pop(), Pop()
3. Name the Python Library modules which need to be 1
imported to invoke the following functions :
(i) randint() (ii) pow()
4. Given the list L=[1,3,6,82,5,7,11,92] , write the output of 1
print(L[2:5])
5. Write the SQL query string to display a list of tables stored 1
in a database. (Python-MySQL connectivity)
6. If we delete an attribute of a table 1
(a) degree increases
(b) cardinality increases
(c) degree and cardinality increase
(d) degree decreases
7. Identify the valid arithmetic operator in Python from the 1
following. a) ? b) < c) ** d) and
8. Which string method is used to implement the following? 1
i. To count the number of characters in the string.

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.

Question. Assertion (A): A referential integrity is a system


of rules of DBMS.
Reason (R): It ensures that user doesn’t accidently delete or
change related data.
21. What is the situation when one tries to push an item in 1
stack that is full?
a) peek
b) underflow
c) overflow
d) pop

Section – II

Both the Case study based questions are compulsory. Attempt any 4 sub-parts
from each question. Each question carries 1 mark

Question Question Marks


No. allotted
22. A departmental store MyStore is considering to maintain 1x4=4
their inventory using SQL to store the data. As a database
administer, Abhay has decided that :
• Name of the database - mystore
• Name of the table - STORE
• The attributes of STORE are as follows:
 ItemNo - numeric
 ItemName – character of size 20
 Scode - numeric
 Quantity – numeric

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

(a) Identify the attribute best suitable to be declared as a


3|Page
primary key.
(b) Write the degree and cardinality of the table STORE.
(c) Insert the following data into the attributes ItemNo,
ItemName and SCode respectively in the given table
STORE. ItemNo = 2010, ItemName = “Note Book” and
Scode = 25
(d) Abhay wants to remove the table STORE from the
database MyStore. Which command will he use from
the following:
a) DELETE FROM store;
b) DROP TABLE store;
c) DROP DATABASE mystore;
d) DELETE store FROM mystore;
(e) Now Abhay wants to display the structure of the table
STORE, i.e, name of the attributes and their
respective data types that he has used in the table.
Write the query to display the same.
23. Jagriti is working on a student management project where 4
Python is being used as front-end and MySQL as back-end
tool. She needs to
(i) write a program which asks for student’s
admission no (admno) and displays the record.
(ii) insert a new record.

Write a Python program to achieve the above two goals


using the following guidelines :-
(a) Name of user = admin
(b) Password = 93872
(c) Database = SchoolDB
(d) Name of table :- Stud_info
(e) Mandatory fields in Stud_info =
rollno,admno,sname,age,father,mother
(f) Primary key = admno

Part – B

Section – I

Question Question Marks


No. allotted
24. What will be the output of the following code? 2

25. Convert the following infix expression to its equivalent 2


postfix expression, showing the stack contents for each step
of conversion. P/(Q+(R-T)*U
26. What do you understand by Candidate Keys in a table? Give 2
4|Page
a suitable example of Candidate Keys from a table
containing some meaningful data.
27. Find and write the output of the following Python code: 2

28. Rewrite the following code in Python after removing all 2


syntax error(s).
Underline each correction done in the code.

29. Evaluate the following postfix expression: (show status of 2


stack after each operation)
100,40,8,/,20,10,-,+,*
30. Differentiate between fetchone() and fetchall() methods with 2
suitable examples for each.
31. Given below is a table ‘Item’ in database ‘Inventory’. 2

Riya created this table but forgot to add column


ManufacturingDate. Write Python code to add this column
to the table Item. Also write the code where user’s name
and password are ‘system’ and ‘test’ respectively.

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

Question Question Marks


No. allotted
34. What will be the output of the following Python codes? 1+2=3
(a)
def add (num1, num2):
sum = num1 + num2
sum = add(20,30)
print(sum)

(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

Question Question Marks


No. allotted
38. Write a function namely nthRoot() that receives two 5
1
parameters x and n and returns nth root of x i.e., 𝑥 𝑛 .
The default value of n is 2.
39. Write a Python program to create a tuple named AllNum 5
and read from user 5 numbers. Now write a function named
pushUnitEven() to create a stack named UnitEven from this
tuple AllNum which should contain only those numbers
which have the unit’s place number as an even number.
Now write statements to pop each element of this stack
UnitEven one-by-one and display them. If the stack is
empty, then display the message “EmptyStack”.

For example :- if AllNum=(52,14,13,17,123,140,198), then


UnitEven = [52,14,140,198]

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.

Write queries (c) to (e) based on the tables EMPLOYEE and


DEPARTMENT given below:

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

(c) To display the average salary of all employees,


department wise.
(d) To display name and respective department name of
each employee whose salary is more than 50000.
(e) To display the names of employees whose salary is not
known, in alphabetical order.

-----------------xxxxxxxxxxxx-----------------

8|Page

You might also like