0% found this document useful (0 votes)
17 views24 pages

Sample Paper CS 083 Preboard 1

This document is a sample question paper for Class XII Computer Science (083) for the session 2022-23, consisting of five sections with a total of 70 marks and a time allowance of 3 hours. It includes various types of questions such as True/False, multiple-choice, programming tasks, and SQL queries, primarily focused on Python programming and database management concepts. The paper is structured to assess students' understanding of computer science principles, programming skills, and database operations.

Uploaded by

Deepti Korde
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)
17 views24 pages

Sample Paper CS 083 Preboard 1

This document is a sample question paper for Class XII Computer Science (083) for the session 2022-23, consisting of five sections with a total of 70 marks and a time allowance of 3 hours. It includes various types of questions such as True/False, multiple-choice, programming tasks, and SQL queries, primarily focused on Python programming and database management concepts. The paper is structured to assess students' understanding of computer science principles, programming skills, and database operations.

Uploaded by

Deepti Korde
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/ 24

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 five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 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


Variables are automatically declared and defined when they are
assigned a value in Python.

Ans = True
2. Which of the following identifier names are valid: 1
a. 100_Percent. =90
b. True = 1
c. Total Marks=500
d. SerialNo=10

Ans: d
3. Consider the given statement and state whether it’s True or False: 1

Operators are constructs that manipulate the value of operands.


Operators may be unary or binary.

Ans: True
4. Write logical expressions corresponding to the following statements in 1
Python and evaluate the expressions:
The sum of 20 and –10 is less than 12.
a. (20 + (-10)) < 12
b. if 20-10 < 12
c. If sum(20-10)< 12
d. None
Ans: a
5. Select the correct output of the given code: 1
var2 = -3+7.2j
print(var2, type(var2))
a. (-3+7.2j)
b. (-3+7.2j) <class 'complex'>
c. (-3+7.2j) <class 'float'>
d. None
Ans: b
6. Select the correct output of the given code: 1
s= 'Congratulations'
print(.replace('a','@'))
print(s.split('ra',4))

a. Congr@tul@tions
['Cong', 'tulations']
b. Congr@tul@tions
['ra', 'tulations']
c. Congr@tul@tions
['Cong', 'ra']
d. None

Ans: a
7. Fill in the blanks: 1
___ will open the text file for reading only and ___will do the same for
binary format file. This is also the default mode. The file pointer is
placed at the beginning for reading purpose, when the file is open in this
mode.

a. r,rb
b. +r, rb
c. r+,+rb
d. None
Ans: a
8. The DISTINCT keyword is used to ____________in a particular column. 1
a. remove duplicate values
b. delete values
c. drop values
d. None

Ans: a
9. Ms. Ravina is using a table 'customer' with custno, name, address and 1
phonenumber. She needs to display name of the customers, whose
name start with letter 'S'.
She wrote the following command, which did not give the result.
Select * from customer where name="S";
Help Ms. Ravina to run the query by removing the errors and write the
correct query.
a. Select * from customer where name like "S%";
b. Select * from customer where name = "S";
c. Select * from customer where name = "S%";
d. None
Ans: a
10. Pooja has created a table Hospital having columns: 1
Patient_No
Patient_Name
Age
Symptom

Now she wants to add a new column ‘Address’ in the above given table.
Suggest to her suitable MySQL command for the same.
a. Alter table Hospital add Address varchar(20);
b. Add address varchar(20);
c. Alter table Hospital Address varchar(20);
d. None
Ans: a
11. Fill in the blank 1
________can be used to store any kind of object in file as it allows us to
store python objects with their structure for storing data in binary
format.
a. Pickle module
b. Seek()
c. Tell()
d. None
Ans: a.
12. _____________provides an error free connection which is always faster 1
than the latest conventional modems.
a. Telnet
b. VoIP
c. IRS
d. MSN relay chat

Ans: a
13. What will the following expression be evaluated to in Python? 1
print(23/3 -5 * 7+(14 -2))
a. -15.33
b. 'int' object is not callable
c. Will give a type error
d. -40.00
Ans: a.
Apply PEMDAS
14. The ______________is used to retrieve data that meet some specified 1
conditions.
a. WHERE clause
b. Orderby
c. Distinct
d. Groupby
Ans: a
15. To create a connection between the MySQL database and Python, 1
the _____ method of mysql.connector module is used.
a. connector()
b. connect()
c. pip install()
d. mysql.connector()
Ans: b
16. This method is used to position the file object at a particular position in
a text file.
a. seek()
b. tell()
c. offset()
d. fileobject()
Ans: a
Q17 and 18 are ASSERTION AND REASONING based questions. 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 the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
17. Assertion (A): Explicit conversion, or type casting happens when data 1
type conversion takes place.
Reasoning(R): With explicit type conversion, there is a risk of loss of
information since we are forcing an expression to be of a specific type.

Ans: (a) Both A and R are true and R is the correct explanation for A

18. Assertion (A): The pickle module deals with binary files. Here, data are 1
not written but dumped and similarly, data are not read but loaded.
Reason(R): Hence, the Pickle Module must be imported to load and
dump data.

Ans: (a) Both A and R are true and R is the correct explanation for A

SECTION B

19. Rao has written a code to showcase division operation. His code is 2
having no validation for zero division, validate and rewrite the correct
code
print ("Handling Devision")
try:
numerator=50
denom=int(input("Enter the denominator: "))
print (numerator/denom)
print ("Division performed successfully")
except ValueError:
print ("Only INTEGERS should be entered")

Ans:
print ("Handling Devision")
try:
numerator=50
denom=int(input("Enter the denominator: "))
print (numerator/denom)
print ("Division performed successfully")
except ZeroDivisionError:
print ("Denominator as ZERO is not allowed")
except ValueError:
print ("Only INTEGERS should be entered")
except:
print(" OOPS.....SOME EXCEPTION RAISED")
20. Write two points of difference between SMTP and POP3 2

Ans:

OR
Name The transmission media best suitable for connecting to hilly
areas. Write the expanded form of wifi

Ans: Microwave / Radio wave


Wireless Fidelity
21. a. Given is a python string declaration: 2
ss="CBSE CS EXAMINATION for @023"
write the output of:
print(ss[0:-1:2])
print(ss[-1:0:-2])

Ans:
CS SEAIAINfr@2
30 o OTNMX CEB

b. Write the output of the code given below:


original_string = '{"John" : 01, "Rick" : 02, "Sam" : 03}'
print(original_string)
original_string_dctry = {"John" : 1, "Sam" : 3}
original_string_dctry ['liking']='programing'
print(original_string_dctry )

Ans:
{"John" : 01, "Rick" : 02, "Sam" : 03}
{'John': 1, 'Sam': 3, 'liking': 'programing'}
22. What is the use of Candidate key in RDBMS. Can candidate key be used 2
as primary key, justify.

Ans:
A relation can have one or more attributes that takes distinct values.
Any of these attributes can be used to uniquely identify the tuples in the
relation. Such attributes are called candidate keys as each of them are
candidates for the primary key.

23. a. Write the full form of 2


(i) TELNET
(ii) SMTP

Ans:
Telnet stands for Teletype Network
Simple Mail Transfer Protocol

b. What is the use of VoIP


Ans:
VoIP can allow you to make a call directly from a computer, a special
VoIP phone, or a traditional phone connected to a special adapter.
24. Predict the output of the python code given below: 2
tuple1 = (('a', 23),('b', 37),('c', 10), ('d',29))
list1 =list(tuple1)
print(list1)
new_list = []
for i in list1:
if i[1]%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

Ans:
[('a', 23), ('b', 37), ('c', 10), ('d', 29)]
(('c', 10),)

OR
Predict the output of the python code given below:
def change(tuple1):
list1 =list(tuple1)
print(tuple1)
del(list1[1])
return list1

tuple1 = (11, [222, 33], 44, 55)


list2 = change(tuple1)
print(list2)

Ans:
(11, [222, 33], 44, 55)
[11, 44, 55]
25. What is the purpose of the following clauses in a select statement? 2
i) ORDER BY
ii) GROUP BY
OR

Ans: ORDER BY clause is used to display the result of a SQL query in


ascending or descending order with respect to specified attribute
values. By default, the order is ascending.
GROUP BY function is used to group rows of a table that contain the
same values in a specified column.

What do you understand by Cartesian Product?

Ans:
Cartesian product operation combines tuples from two relations. It
results in all pairs of rows from the two input relations, regardless of
whether or not they have the same values on common attributes. It is
denoted as ‘X’.
Students to support the answer by providing an example

SECTION C

26. a. Consider the following tables: 1+2


Table: Uniform
+-------+-------+--------+ --------+
| Ucode | Uname | Ucolor |
+-------+-------+--------+ --------+
| 1 | Shirt | White |
| 2 | Pant | Grey |
| 3 | Tie | Blue |
+-------+-------+--------+ --------+
Table: Cost
+-------+------+-------+
| Ucode | Size | Price |
+-------+------+-------+
|1 | L | 580 |
|1 | M | 500 |
|2 | L | 890 |
|2 | M | 810 |
+-------+------+-------+

What will be the output of the following statement?


SELECT * FROM UNIFORM NATURAL JOIN COST;
Ans:
b. Write the output of the queries (i) to (iv) based on the table sale given
below:

Table: Sale
(i) SELECT CustID, COUNT(*) "Number of Cars" FROM SALE
GROUP BY CustID;
(ii) SELECT CustID, COUNT(*) FROM SALE GROUP BY CustID
HAVING Count(*)>1;
(iii) SELECT PaymentMode, COUNT(PaymentMode) FROM SALE
GROUP BY Paymentmode ORDER BY Paymentmode
(iv) SELECT PaymentMode, Count(PaymentMode) FROM SALE
GROUP BY Paymentmode HAVING COUNT(*)>1 ORDER BY
Paymentmode;
Ans:

(i)

(ii)

(iii)

(iv)

27. Write a method display() to read lines from a text file MYNOTES.TXT, 3
and display those line that begins with the letter ‘M’.
Ans:
OR
Write a function overlap in python to read two .txt files, prime
numbers.txt and happynumbers.txt, that have lists of numbers in
them, find the numbers that are overlapping.

Ans:

28. a. Write the output of the SQL queries (i) to (iv) based on the relations 3
tables INSTITUTE and ADMIN given below:
Table: INSTITUTE

Table: ADMIN
(i) Select Designation Count (*) From Admin Group By Designation
Having Count (*) <2;
(ii) SELECT max (EXPERIENCE) FROM INSTITUTE;
(iii) SELECT TEACHER FROM INSTITUTE WHERE EXPERIENCE >12
ORDER BY TEACHER;
(iv) SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER;

Ans:

b. Write a command to view the structure of an already created table.


Ans:
Syntax:
DESCRIBE tablename;
29. Write a program to print the Armstrong numbers within a specific given 3
interval.

Ans:
30. Write a program to accept a string from the user and reverse the string 3
using following user define functions:
POP()- to check underflow and pop an element from the stack.
PUSH()- to add an element in the stack
ReverseString()-to reverse a string using, push the string elements in to
the string, pop the elements and display the reverse string.

OR
Rishi has created a dictionary containing names and total marks of the
students. Write a program having following user defined functions to
perform the following operations.
func_push()- push the keys ie the names of the students with their
corresponding marks where the marks > 75
func_pop() – pop and displays the content of the dictionary.
Sample input:

OUTPUT:
TOM
ANU
BOB
OM

Ans:

SECTION D

31. ASIAN INTERNATIONAL INSTITUTE in Shimla is setting up the network


between its different wings. There are 4 wings named as
SENIOR(S),
JUNIOR (J),
ADMIN (A) and
HOSTEL (H).
Distance between various wings:
Wing A to Wing S 100 m

Wing A to Wing J 200 m


Wing A to Wing H 400 m
Wing S to Wing J 300 m
Wing S to Wing H 100 m
Wing J to Wing H 450 m

Number of Computers:
Wing A 11
Wing S 210
Wing J 105
Wing H 55

(i) Suggest a suitable Topology for networking the computer of all


wings.
(ii) Name the wing where the server is to be installed. Justify your
answer
(iii) Suggest the placement of Hub/Switch in the network.
(iv) Mention the economic technology to provide internet
accessibility to all wings.
(v) Suggest a protocol that shall be needed to provide video
conferencing solution between Wing S and Wing H
Ans
(i) Star or Bus or any other valid topology or diagram.
(ii) Wing S, because maximum number of computer are located at Wing S.
(iii) Hub/Switch in all the wings.
(iv) Coaxial cable/Modem/LAN/TCP-IP/Dialup/DSL/Leased Lines or any
other valid technology.
(v) VoIP

32. a. Write the output of the given code:


x = 40

print('x is:::', x)
print('This is Global x:::', x)

def outer():
x = 10
print('x is:::', x)
print('This is enclosed x:::', x)

def inner():
x = 30
print('Now x is :::',x)
print('This is local x:::', x)
print("Builtin", len("abc"))

inner()

outer()

Ans:
x is::: 40
This is Global x::: 40
x is::: 10
This is enclosed x::: 10
Now x is ::: 30
This is local x::: 30
Builtin 3

b. The code given below is to create a table faculty having following


fields:
id- integer
LastName-varchar with 15 values
FirstName-varchar with 15 values
LocationId- integer
rank- varchar 4(it should be one of the following – ASSO, FULL, ASST,
INST)
startdate- date type
Note the following to establish connectivity between python and
MYSQL:
Username is localhost
User is root
Password is root
Database is college
Write the following missing statement to complete the code:
Statement 1: to form a cursor object
Statement 2: to execute the command that inserts the record in the
table student.
Statement 3: to add the record permanently in the data base

Ans:
OR
a. Convert the following program using while loop and predict the
output
for i in range(4):
for j in range(i):
print('$', end='')
print('\n ')

Ans:
i=0
while i < 4:
j=0
i=i+1
while j < i:
print('$', end='')
j=j+1
print('\n')
Ans:
$

$$

$$$

$$$$
b. The code given below is to create a table school having following
fields:
stud_id varchar 200, stud_name varchar 215, address v
archar 215, city char 200

Note the following to establish connectivity between python and


MYSQL:
host = 'localhost',
database = 'college',
user = 'root',
password = 'root@123'

Write the following missing statement to complete the code:


Statement 1: to form a cursor object
Statement 2: to execute the command that inserts the record in the
table student.
Statement 3: to add the record permanently in the data base

my_database = mysql.connector.connect ( host = 'localhost', database = 'col


lege', user = 'root', password = 'root@123' )
cursor = ____________ # statement 1 to form a cursor object
cursor. execute( " CREATE TABLE school ( stud_id varchar(200) PRIMARY KEY,
stud_name VARCHAR(215), address VARCHAR(215), city char(100)) " )
cursor = ____________ # statement 2 to form the cursor object

cursor.execute("desc student") #code to describe the students table


cursor.execute(" select * from student")

for x in _______: # statement 3 to display the inserted data from the Table
print(x)

Ans:
my_database = mysql.connector.connect ( host = 'localhost', database = 'col
lege', user = 'root', password = 'root@123' )
cursor = my_database.cursor() #to form a cursor object
cursor. execute( " CREATE TABLE school ( stud_id varchar(200) PRIMARY KEY,
stud_name VARCHAR(215), address VARCHAR(215), city char(100)) " )
cursor = my_database.cursor() # to form the cursor object

cursor.execute("desc student") #code to describe the students table


cursor.execute(" select * from student")
for x in cursor:

print(x) # display the inserted data from the Table, cursor.fetchall()

33. Amritya Seth is a programmer, who has recently been given a task to 5
write a python code to perform the following binary file operations with
the help of two user defined functions/modules:
a. AddStudents() to create a binary file called STUDENT.DAT containing
student information – roll number, name and marks (out of 100) of each
student.
b. GetStudents() to display the name and percentage of those students
who have a percentage greater than 75. In case there is no student
having percentage > 75 the function displays an appropriate message.
The function should also display the average percent.
Ans:
OR
Define pickling. What is the difference between dump() and load()
methods.

Ans:
Pickling is the process by which a Python object is converted to a byte
stream.
dump() method is used to write the objects in a binary file.
load() method is used to read data from a binary file
students are suppose of support their answer with a sample code/
solution.

SECTION E

34. A shop called Wonderful Garments who sells school uniforms maintains 4
a database SCHOOLUNIFORM as shown below. It consisted of two
relations - UNIFORM and COST. They made UniformCode as the primary
key for UNIFORM relations. Further, they used UniformCode and Size to
be composite keys for COSTrelation. By analysing the database schema
and database state, specify SQL queries to rectify the following
anomalies.

a. Write sql query to change the name of relation from price to cost.
b. M/S Wonderful Garments also keeps handkerchiefs of red colour,
medium size of Rs. 100 each. Insert this record in cost table.
c. Add the constraint so that the price of an item is always greater
than zero.
Ans:

a. Alter table price rename to cost.


b. Insert into uniform values (7, ‘Handkerchief’, ‘Red’)
Insert into cost values (7, ‘M’, 100)
c. Alter table cost add check (price > 100)

35. Rohit, a student of class 12th, is learning CSV File Module in Python. 4
During examination, he has been assigned an incomplete python code
(shown below) to create a CSV File 'Student.csv' (content shown below).
Help him in completing the code which creates the desired CSV File.
1, ASHIS, XII, A
2, AMRIT, XII, A
3, ABHAY, XII, A
Write the suitable code for statement 1 to statement 5

Ans:
1. csv
2. "Student.csv","w"
3. writer(fh)
4. roll_no,name,Class,section
5. writerows()
Reference:
NCERT BOOKS
https://ncert.nic.in/textbook.php?kecs1=0-11
https://cbseportal.com/ncert-books/class-12-computer-science

https://www.teachoo.com/16336/3712/Question-8-Choice-1/category/CBSE-Class-12-
Sample-Paper-for-2022-Boards--Term-2----Computer-Science/
https://brainly.in/textbook-solutions/q-pooja-created-table-bank-sql-later-column
https://www.zigya.com/study/book?class=12&board=CBSE&subject=Computer+and+Comm
unication+Technology&book=Computer+Science+With+Python&chapter=Inheritance&q_ty
pe=SAT&q_topic=&question_id=COEN12163471
https://byjus.com/question-answer/write-logical-expressions-corresponding-to-the-
following-statements-in-python-and-evaluate-the-expressions-assuming/
https://csiplearninghub.com/computer-network-class-12-questions-answers/
https://www.sarthaks.com/443792/indian-public-school-darjeeling-setting-network-
between-different-wings-senior-junior
https://cbseacademic.nic.in/web_material/QuestionBank/ClassXII/ComputerScienceXII.pdf
https://techtipnow.in/a-shop-called-wonderful-garments-that-sells-school-uniforms-
maintain-a-database-school_uniform-as-shown-below-it-consisted-of-two-relations-
uniform-and-price/

You might also like