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

Class 12 Computer Science Sample Paper Set 3

The Class 12 Computer Science Sample Paper is a meticulously crafted resource aimed at helping students prepare for their board examinations. It includes a diverse set of questions, such as programming problems, theoretical concepts, and case studies, aligned with the latest CBSE syllabus and exam pattern. Covering essential topics like Python programming, data structures, database management, and computer networks, this sample paper enhances both conceptual understanding and practical skills.

Uploaded by

Artham Resources
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Class 12 Computer Science Sample Paper Set 3

The Class 12 Computer Science Sample Paper is a meticulously crafted resource aimed at helping students prepare for their board examinations. It includes a diverse set of questions, such as programming problems, theoretical concepts, and case studies, aligned with the latest CBSE syllabus and exam pattern. Covering essential topics like Python programming, data structures, database management, and computer networks, this sample paper enhances both conceptual understanding and practical skills.

Uploaded by

Artham Resources
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Dear Teachers and Students,

Join School of Educators' exclusive WhatsApp, Telegram, and Signal groups for FREE access
to a vast range of educational resources designed to help you achieve 100/100 in exams!
Separate groups for teachers and students are available, packed with valuable content to
boost your performance.

Additionally, benefit from expert tips, practical advice, and study hacks designed to enhance
performance in both CBSE exams and competitive entrance tests.

Don’t miss out—join today and take the first step toward academic excellence!

Join the Teachers and Students


Group by Clicking the Link Below
Series ARSP/03 Set ~ 3
Roll No. Q.P Code 15/3/3
Candidates must write the Q.P Code
on the title page of the answer-book.

 Please check that this question paper contains 10 printed pages.


 Q.P. Code given on the right hand side of the question paper should be written
on the title page of the answer-book by the candidate.
 Please check that this question paper contains 37 questions.
 Please write down the serial number of the question in the answer-book
before attempting it.
 15 Minute times has been allotted to read this question paper. The question
paper will be distributed at 10:15 a.m. From 10.15 a.m to 10.30 a.m, the students
will read the question paper only and will not write any answer on the answer –
book during this period.

COMPUTER SCIENCE

Time allowed: 3 hours Maximum Marks: 70


General Instructions:

​This question paper contains 37 questions.

All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one
of the choices in such questions.

The paper is divided into 5 Sections- A, B, C, D and E.

Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.

Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.

Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.

Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.

Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.

All programming questions are to be answered using Python Language only.

In case of MCQ, text of the correct answer should also be written.

Section A
1. State true or false: [1]
The expression int(x) implies that the variable x is converted to integer.
2. Which of the following queries contains an error? [1]

a) Select empid from emp where empid = b) Select * from emp where empid = 10003;
10006;

c) Select empid from emp; d) Select empid where empid = 1009 and
lastname = 'GUPTA';
3. fetchall() method fetches all rows in a result set and returns a: [1]

a) Tuple of strings b) Tuple of lists

c) List of tuples d) List of strings


4. Given a function that does not return any value, what value is thrown by default when executed in shell? [1]

a) void b) None

c) bool d) int
5. What will be the output of the following code snippet? [1]
my_dict = {}
my_dict[(1,2,4)] = 8
my_dict[(4,2,1)] =10
my_dict[(1,2)]=12
sum = 0
for k in my_dict:
sum += my_dict[k]
print (sum)
print(my_dict)
6. Which of the following is the fastest media of data transfer? [1]

a) Fibre Optic b) Untwisted Wire

c) Co-axial Cable d) Telephone Lines


7. Raghav is trying to write an object obj1 = (1,2,3,4,5) on a binary file “test.bin”. Consider the following code [1]
written by him.
import pickle
obj1 = (1,2,3,4,5) myfile = open(“test.bin”.‘wb’)
pickle.________ #Statement 1
myfile.close()
Identify the missing code in Statement 1.

a) dump(myfile.obj1) b) write(obj1.myfile)

c) dump(obj1.myfile) d) load(myfile.obj1)
8. What does the special file called data dictionary contains? [1]

a) The data types of all data in all files. b) The names of all fields in all files.

c) All of these d) The widths of all fields in all files.


9. Which of the following clauses in SQL is most appropriate to use to select matching tuples in a specific range of [1]
values?

a) IS b) BETWEEN

c) IN d) LIKE
10. What is the use of pickle module? [1]
11. State true or false: [1]
The clear() removes all the elements of a dictionary but does not delete the empty dictionary.
12. What is the conventional name of pointer associated with the stack? [1]

a) FIRST b) TOP

c) REAR d) FRONT
13. What is the following command doing? [1]
ALTER TABLE Persons
ADD CONSTRAINT chk_Person CHECK (P_ID>0 AND City = 'Shimla');
14. A ________ is a network spread across a small area connecting various related devices such as laptop, mobile [1]
phone, wifi, printers etc.

a) WAN b) MAN
c) PAN d) LAN
15. Which of the following will delete key:value pair for key="tiger" in dictionary? [1]

di = {"lion":"wild","tiger":"wild", "cat": "domestic","dog":"domestic"}

a) del di["tiger"] b) del(di.["tiger"])

c) delete(di.["tiger"]) d) di["tiger"].delete()
16. Which of the following sublanguages of SQL is used to query information from the database and to insert tuples [1]
into, delete tuples from, and modify tuples in the database?

a) DDL (Data Definition Language) b) Query

c) Relational Schema d) DML (Data Manipulation Language)


17. Find ODD parity bit for 10010001 [1]

a) 2 b) 0

c) 3 d) 1
18. In which type of cloud an organization rents cloud services from cloud providers on-demand basis? [1]

a) Protected b) Hybrid

c) Public d) Private
19. Assertion (A): In python break is used to bring the program control out of the loop. [1]
Reason (R): The break is commonly used in the cases where we need to break the loop for a given condition.

a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.

c) A is true but R is false. d) A is false but R is true.


20. Assertion (A): To read from an excel file, First you need to write a command to install the xlsx module. [1]
Reason (R): To open an excel file you use the open_workbook() method.

a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.

c) A is true but R is false. d) A is false but R is true.


21. Assertion (A): The arguments are types of information that can be passed into the function. [1]
Reason (R): We can pass any number of arguments, but they must be separate with a semicolon.

a) Both A and R are true and R is the correct b) Both A and R are true but R is not the
explanation of A. correct explanation of A.

c) A is true but R is false. d) A is false but R is true.


Section B
22. What measures do wireless networks employ to avoid collisions? [2]
23. What is the use of DB-API? [2]
24. Find the errors in following code and write the correct code. [2]
x = True
y = False
z = false
if x, y, z :
print " yes "
else :
print " no "
i. Underline the corrections
ii. Write the reason!error next to it in comment form.
OR
Predict the output of following code fragment:
fruit = { }
f1 = ['Apple', 'Banana', 'apple', 'Banana']
for index in f1:
if index in fruit:
fruit [index] += 1
else:
fruit[index] =1
print(fruit)
print (len(fruit))
25. Write the code to create a table Product in database Inventory with following fields: [2]

Fields Datatype

PID varchar(5)

PName char(30)

Price float

Rank varchar(2)

26. Write an algorithm to find out whether the given number is divisible by 3 or not. [2]
OR
Predict the output of the following code fragment.

b = 20
a = 90/b
print("value of a is :", a)

27. When a file is opened for output, what happens when [2]
i. the mentioned file does not exist
ii. the mentioned file does exist?
OR
Write method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an
alphabet 'P'.
28. Predict the output of the following code: [2]
def execute(x, y = 200, z = [23,]):
temp = x + y + z[0]
print(temp, x, y)
a, b = 50, 20
c = [10,]
execute(b)
execute(y = a, x = b)
execute (x = b, z = [a,], y = a)
Section C
29. Answer the questions (i) to (iv) based on the following: [3]

class Book
{
char Bno[20];
protected:
float Price;
public:
void GetB();
void ShowB();
};
class Member
{
char Mno[20];
protected:
char Name[20];
public:
void GetM();
void ShowM();
};
class Library : public Member, private Book
{
char Lname[20];
public:
void GetL();
void ShowL();
};
void main()
{
Library L;
}

i. Which type of Inheritance out of the following is illustrated in the above example?
- Single Level Inheritance, Multilevel Inheritance, Multiple Inheritance
ii. Write the names of all the data members, which are directly accessible by the member function GetL() of
class Library.
iii. Write the names of all the member functions, which are directly accessible by the member function
ShowL() of class Library.
iv. Write the names of all the members, which are directly accessible by the object L of class Library declared
in the main() function.
OR
How are following two statements different?
import math
from math import *
30. Consider the following SQL table MEMBER in a SQL Database CLUB: [3]
Table: MEMBER

M_ID NAME ACTIVITY

M1001 Amina GYM

M1002 Pratik GYM

M1003 Simon SWIMMING

M1004 Rakesh GYM

M1005 Avneet SWIMMING

Assume that the required library for establishing the connection between Python and MYSQL is already
imported in the given Python code. Also assume that DB is the name of the database connection for table
MEMBER stored in the database CLUB.
Predict the output of the following code:

MYCUR = DB.cursor()
MYCUR.execute("USE CLUB")
MYCUR.execute("SELECT * EROM MEMBER WHERE ACTIVITY= 'GYM' ")
R=MYCUR.fetchone()
for i in range (2):
R=MYCUR, fetchone()
print (R [0], R [1], sep = " # ")

OR
What are Tuples in a SQL Table? Write a suitable example with a SQL Table to illustrate your answer.
31. Write a function called removeFirst that accepts a list as a parameter. It should remove the value at index 0 from [3]
the list.
Note that it should not return anything (returns None). Note that this function must actually modify the list
passed in, and not just create a second list when the first item is removed. You may assume the list you are given
will have at least one element.
OR
What is the difference between a local variable and a global variable? Also, give a suitable Python code to illustrate
both.
Section D
32. Write a program to implement a stack for these book details (bookno, bookname). That is, now each item node [4]
of the stack contains two types of information -a bookno and its name. Just implement push and display
operations.
OR
A linear stack called status contains the following information:
Phone number of Employee
Name of Employee
Write the following methods to perform given operations on the stack status:
i. Push_element () To Push an object containing Phone number of Employee and Name of Employee into the stack.
ii. Pop_element () To Pop an object from the stack and to release the memory.
33. Write a point of difference between append (a) and write (w) modes in a text file. [4]
Write a program in Python that defines and calls the following user defined functions:
i. Add_Teacher() : It accepts the values from the user and inserts the record of a teacher to a csv file
'Teacher.csv'. Each record consists of a list with field elements as T_id, Tname and desig to store teacher ID,
teacher name and designation respectively.
ii. Search_Teacher() : To display the records of all the PGT (designation) teachers.
34. Write SQL commands for the queries (i) to (iv) and output for (v) to (viii) based on a table COMPANY and [4]
CUSTOMER.
COMPANY

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

CUSTOMER

CUSTID NAME PRICE QTY CID

101 ROHAN SHARMA 70,000 20 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 SONAL AGGARWAL 20,000 5 333

107 ARUN SINGH 50,000 15 666

i. To display those company name which are having price less than 30000.
ii. To display the name of the companies in reverse alphabetical order.
iii. To increase the price by 1000 for those customer whose name starts with S?
iv. To add one more column t_price with decimal(10, 2) to the table customer
v. SELECT COUNT(*), CITY FROM COMPANY GROUP BY CITY
vi. SELECT MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE QTY>10
vii. SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE "%r%"
viii. SELECT PRODUCTNAME, CITY, PRICE FROM COMPANY, CUSTOMER WHERE COMPANY. CID =
CUSTOMER.CID AND PRODUCTNAME= "MOBILE"
OR
i. What possible output(s) are expected to be displayed on screen at the time of execution of the following code?

import random
S=["Pen","Pencil","Eraser","Bag","Book"]
for i in range (1,2):
f=random.randint(i,3)
s=random.randint(i+1,4)
print(S[f],S[s],sep=":")

Options :
I. Pencil:Book
II. Pencil:Book
Eraser:Bag
III. Pen:Book
Bag:Book
IV. Bag:Eraser
ii. The table Bookshop in MySQL contains the following attributes:
B_code - Integer
B_name - String
Qty - Integer
Price - Integer
Note the following to establish connectivity between Python and MySQL on a 'localhost' :
Username is 'shop'
Password is 'Book'
The table exists in a MySQL database named Bstore.
The code given below updates the records from the table Bookshop in MySQL.
Statement 1 - to form the cursor object.
Statement 2 - to execute the query that updates the Qty to 20 of the records whose B_code is 105 in the table.
Statement 3 - to make the changes permanent in the database.

import mysql.connector as mysql


def update_book():

mydb=mysql.connect(host="localhost",
user="shop",passwd="Book",database="Bstore")
mycursor=__________ # Statement 1
qry= "update Bookshop set Qty=20 where
B_code=105"
___________________ # Statement 2
___________________ # Statement 3

35. Consider the table MobileMaster [4]

M_Id M_Company M_Name M_Price M_Mf_Date

MB001 Samsung Galaxy 4500 2014-02-12

MB002 Nokia N1100 2250 2011-04-15

MB003 Sony Experia M 9500 2017-11-20

MB004 Oppo SelfieEx 8500 2010-08-21

Write the Python code for the following


i. To display details of those mobiles whose price is greater than 8000.
ii. To increase the price of mobile Samsung by 2000.
Section E
36. What is mobile computing? Explain any two mobile computing technologies. [5]
37. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables [5]
TRANSPORT and TRIP.
TABLE: TRANSPORT

TCODE TTYPE PERKM

103 ORDINARY BUS 90

105 SUV 40

104 CAR 20

103 ORDINARY BUS 90

101 VOLVO BUS 160

102 AC DELUXE BUS 140

Note:
PERKM is Freight Charges per kilometre
TTYPE is Transport Vehicle Type
TABLE: TRIP

NO NAME TDATE KM TCODE NOP

11 Tanish Khan 2015-12-13 200 101 32

13 Danish Sahai 2016-06-21 100 103 45

15 Ram Kumar 2016-02-23 350 102 42

12 Fen Shen 2016-01-13 90 102 40

17 Aan Kumar 2015-02-10 75 104 2


14 Veena 2016-06-28 80 105 4

16 Raj pal Kirti 2016-06-06 200 101 25

Note:
• NO is Driver Number
• KM is Kilometre travelled
• NOP is number of travellers travelled in a vehicle
• TDATE is Trip Date
i. To display NO, NAME, TDATE from the table TRIP in descending order of NO.
ii. To display the NAME of the drivers from the table TRIP, who are travelling by transport vehicle with code
101 or 103.
iii. To display the NO and NAME of those drivers from the table TRIP who travelled between 2015-02-10 and
2015-04-01.
iv. To display all the details from table TRIP in which the distance travelled is more than 100 KM in ascending
order of NOP
v. SELECT COUNT (*), TCODE From TRIP
GROUP BY TCODE HAVING COUNT (*) > 1;
vi. SELECT DISTINCT TCODE from TRIP;
vii. SELECT A.TCODE, NAME, TTYPE
FROM TRIP A, TRANSPORT B
WHERE A.TCODE = B. TCODE AND KM < 90;
viii. SELECT NAME, KM * PERKM
FROM TRIP A, TRANSPORT B
WHERE A. TCODE = B. TCODE AND A. TCODE = '105';
OR
Explain the Cartesian product of two relations.

You might also like