0% found this document useful (0 votes)
361 views9 pages

SAMPLE PAPER-II - Class XII (Computer Science) QP With MS BP

This document contains a sample paper for a Computer Science exam with 12 multiple choice questions (Q1) and 5 subquestions (Q2) that involve writing Python code. It also includes questions about databases (Q3), networking concepts (Q4), operating systems commands (Q5), and web development using Django (Q6). The paper tests knowledge of Python programming, SQL, HTTP requests, networking devices, and the Django framework.

Uploaded by

Harsh
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)
361 views9 pages

SAMPLE PAPER-II - Class XII (Computer Science) QP With MS BP

This document contains a sample paper for a Computer Science exam with 12 multiple choice questions (Q1) and 5 subquestions (Q2) that involve writing Python code. It also includes questions about databases (Q3), networking concepts (Q4), operating systems commands (Q5), and web development using Django (Q6). The paper tests knowledge of Python programming, SQL, HTTP requests, networking devices, and the Django framework.

Uploaded by

Harsh
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/ 9

SAMPLE PAPER – COMPUTER SCIENCE (083) – CLASS XII – 2019-20

TIME – 3:00HRS MM:70


Instructions to candidates –
1. Attempt all questions
2. Programming Language – Python
Q1 i. What is the output of the following code : print 9//2 12
a. 4 b. 4.5 c. 4.0 d. Error X1
=
ii. What is the output of the following program : 12
i = 0
while i < 3:
print i
i++
print i+1
(a) 0 2 1 3 2 4 (b) 0 1 2 3 4 5 (c) 1 0 2 4 3 5 (d) Error

iii. What is the output of the following code :


L = ['a','b','c','d']
print "".join(L)
(a) None (b) abcd (c) [‘a’,’b’,’c’,’d’] (d) Error

iv. Which of the following is the use of id() function in python?


(a) id returns the identity of the object
(b) Every object doesn’t have a unique id
(c) Both (a) and (b)
(d) None of the above

v. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
(a) [3, 4, 5, 20, 5, 25, 1, 3]
(b) [1,3,3, 4, 5, 20, 5, 25]
(c) [3, 5, 20, 5, 25, 1, 3]
(d) [1, 3, 4, 5, 20, 5, 25,]

vi. What is the output of the following program : print "Hello World"[::-1]
(a) dlroW olleH (b) Hello Worl (c) d (d) Error

vii. Given a string s = “Welcome”, which of the following code is incorrect?


(a) print s[0] (b) print s.lower() (c) s[1]=’r’ (d) print s.strip()

viii. What is the output of the following program :


def myfunc(a):
a = a + 2
a = a * 2
return a

print myfunc(2)
(a) 8 (b) 16 (c) Indentation Error (d) Runtime Error
ix. What is the output of the following program?
numberGames = {}
numberGames[(1,2,4)] = 8
numberGames[(4,2,1)] = 10
numberGames[(1,2)] = 12

sum = 0
for k in numberGames:
sum += numberGames[k]

print len(numberGames) + sum


(a) 30 (b) 33 (c) 31 (d) None of these

x. What is the output of given program code:


list1 = range(100, 110)
print "index of element 105 is : ", list1.index(105)
(a) 4 (b) 5 (c) 6 (d) Error

xi. What is the output of the following program: print 'abef'.partition('cd')


(a) (‘abef’) (b) (‘abef’, ‘cd’, ”) (c) (‘abef’, ‘’, ”) (d) Error

xii. What is the output of the following program?


my_tuple = (6, 9, 0, 0)
my_tuple1 = (5, 2, 3, 4)
print my_tuple > my_tuple1
(a) False (b) True (c) Cannot Compare (d) Error

xiii. What will be the output of the code snippet if input is ‘1bzz’
Inp = raw_input('Enter a string') 2
while len(Inp)<=4:
if Inp[-1]=='z':
Inp=Inp[0:3]+'c'
elif 'a' in Inp:
Inp = Inp[0]+ 'bb'
elif not int(Inp[0]):
Inp='1'+Inp[1:]+ 'z'
else:
Inp=Inp+ '*'
print(Inp)
Q2 (a) Write the definition of a function reverse(X) in Python to display the elements in reverse 2
order such that each displayed element is twice of the original element of the list X.
For example:
if the input List X is [4,8,7,5,6,11,10] then the function produces output as –
20, 22, 12, 10, 14, 16, 8

(b) Write a user defined function GenNum(a, b) to generate odd numbers between a and b 2
(including b)

(c) Give output of the following: 2


def ChangeLst():
L=[]
L1=[]
L2=[]
for i in range(1,10):
L.append(i)
for i in range(10,1,-2):
L1.append(i)
for i in range(len(L1)):
L2.append(L1[i]+L[i])
L2.append(len(L)-len(L1))
print(L2)

(d) Write functions to perform insert (Enqueue) and delete (Dequeue) operations in a Queue 4
containing Member details as given in the following definition of item node: -
Node
Member No Integer, Member Name String, Age Integer

def isEmpty(Qu)
if Qu==[]:
return True
else:
return False
def Enqueue(Qu, item)
# write code to insert an item in the Queue
def Dequeue(Qu)
# write code to delete an item from the Queue

(e) Evaluate the following Postfix notation: - 2


50,60,+,20,10,-,*
Q3 (a) Observe the following code and answer the questions that follow – 1
File = open(“Mydata”,”a”)
_________________________ # statement 1
File.close()
(i) What type of file is Mydata
(ii) Fill in the blank with statement to write “ABC” in the file

(b) Write a user defined function in Python that displays number of lines starting with ‘H’ present 3
in the text file Poem.txt.
Q4 (a) What do the underlined areas represent in the MAC address - 1
10:B5:03:63:2E:FC
(b) What is the difference in working of switches and routers? 2
(c) Define the term Cloud in context of Internet. Give some examples. 2
(d) What is a URL? Identify the various parts of a URL in the example given below: 2
http://encycle.msn.com/getinfo.styles.asp
(e) Look at the image given below and answer questions that follow : -
2

(i) Name the command which gives such type of result.


(ii) Why is this command used?
2

(f)
(1) What is the above image representing?
(2) Which device in the Internet terminology does modulation demodulation?
(g) Expand the terms: TCP, VoIP, SSL, NFC, IMAP, FTP, WiFi, HTTPS 2
(h) What measures wireless networks employ to avoid collisions? 2

Q5 (a) Write a MYSQL-Python connectivity code to retrieve one record at a time from table 3
EMPLOYEES who live in ‘Delhi’
(b) Consider the tables given below: - 6
STAFF
StaffID Name Department Gender Experience
1125 Nihara Sales F 12
1263 Kartik Finance M 6
1452 Payal Research F 3
236 Aryan Sales M 8
366 Laxman Finance M 10
321 Krishna Sales M 7
SALARY
StaffID Basic Allowance Comm
1452 12000 1000 200
321 23000 2300 900
1125 32000 4000 100
236 12000 52000 800
336 42000 1700 700
1263 18900 1690 150
With reference to the above table, write commands in SQL for (i) to (iv) and output for (v) to
(viii)
(i) To display names of all staff that are in Sales department having experience less than 9
years and commission more than 700
(ii) Display average salary of staff working in Finance department. Salary= Basic+Allowance
(iii) Display number of female members in each department.
(iv) Display name of employee earning maximum salary.
Give Output
(v) SELECT NAME FROM STAFF ST, SALARY SA WHERE COMM <=700 AND ST.STAFFID =
SA.STAFFID
(vi) SELECT NAME, BASIC FROM STAFF, SALARY WHERE DEPT=”SALES” AND STAFF.STAFFID=
SALARY.STAFFID
(vii) SELECT COUNT(DEPARTMENT),DEPARTMENT FROM STAFF GROUP BY DEPARTMENT
(viii) SELECT COUNT(*),GENDER FROM STAFF GROPU BY GENDER

(c) What are two types of HTTP requests? Write a view function that an process a GET request 2
and display “main.html” as template. Assume that required files and methods are already
imported.
(d) You have created a Django project folder. It contains 3 apps as: Register, Sell and Work. 2
What will be the contents of Django project folder? List the folders (not files inside the
folders)
(e) What is a Django template? 2

Q6 (a) “Privacy stands for protection of personal information given online. Especially in e-commerce, 2
it is related to a company’s policies on the use of user’s data”.
(i) Why is the above given statement important?
(iii) What is the need to safeguard user privacy?
(b) Expand the terms: FLOSS, SDLC, OSS, GNU 2
(c) Sumit downloaded XYZ software from the internet. After 2 weeks the software is asking Sumit 2
to purchase a license for it to work at its best. In this context answer the questions –
(i) XYZ comes under what category of software.
(ii) Can Sumit see the source code and also freely edit the software code of XYZ software?
(d) ABC has by online medium duped a person of 50 thousand rupees? What kind of crime is this 2
and how will it be resolved?
(e) A producer has made a movie whose story line is completely based on a previous Hollywood 2
movie. This producer did not take permission to make the movie based on this story. The
writer of the story has now filed a case against this producer in court?
(a) Which kind of offence is this?
(b) What are the consequences?
Solutions
Q1  Ans A
 Ans D
 Ans C
 Ans A
 Ans C
 Ans A
 Ans C
 Ans C
 Ans B
 Ans B
 Ans C
 Ans B
 Ans - 1bzc*

Q2 (a) def reverse(X):


for i in range(len(X)):
X[i]=X[i]*2
X.reverse()
print(X)

(b) def getNum(a,b):


for i in range(a,b+1):
if i%2==1:
print(i)
(c) [11, 10, 9, 8, 7, 4]
(d) def isEmpty(Qu)
if Qu==[]:
return True
else:
return False
def Enqueue(Qu, item)
Qu.append(item)
if len(Qu)==1:
front=rear=0
else:
rear=len(Qu)-1
def Dequeue(Qu)
if isEmpty(Qu):
return “Underflow”
else:
item=Qu.pop(0)
if len(Qu)==0:
front=rear=None
return item
(e) 1100

Q3 (a) (i) Text file


(iii) File.write(“ABC”)

(b) def count_lines():


fi=open(“Poem.txt”,”r”)
str=””
while string:
string=fi.readline()
if string[0]==’H’:
print(string)

Q4 (a) 10:B5:03 represents Manufacturer ID


63:2E:FC represents Card Number
(b) Difference between router and switch is given below -
Switches Routers
Are found in LAN where there is a single path They connect LANs and there can be multiple
from source to destination paths from source to destination
(c) Cloud is an Internet based computing where shared resources, software and information is
provided to computers and users on demand. Some examples are Gmail, Online data storage
accounts
(d) URL stands for uniform resource locator. It is address of a file on the Internet.
The parts are:
(1) http:// is type of server
(2) encycle.msn.com is address of server
(3) getinfo.styles.asp path of file from where it is to be retrieved.
(e) (i) The command is Ping.
(ii) Ping is used to test connectivity between two hosts. It checks if there is a connection to the
remote machine.
(f) (1) It represents Amplitude Modulation
(3) The device is Modem.
(g) TCP – Transmission Control Protocol,
VoIP – Voice over Internet Protocol
SSL – Secure Sockets Layer
NFC – Near Field Communication
IMAP – Internet Message Access Protocol
FTP – File Transmission Protocol
WiFi – Wireless Fidelity
HTTPS – Secure Hypertext Transfer Protocol
(h) Wireless networks employ a protocol called as CSMA/CA (Carrier Sense Multiple Access with
Collision Avoidance) to avoid collision in the network

Q5 (a) import MySQLdb as my


try:
db=my.connect(host=”localhost”, user=”root”,
password=””, database=”india”)
cursor=db.cursor
sql=”select * from city where city=’delhi’”
no_rows=cursor.execute(sql)
print(cursor.fetchone())
db.close()
except my.DataError as e:
print(“Data Error”)
print(e)

(b) (1) select name from staff st, salary sl


where st.staffid = sl.staffid and
dept=’sales’ and experience<9 and comm>700;
(2) select avg(basic+allowance) as ‘average salary’
from staff st, salary sl
where st.staffid=sl.staffid and dept=’finance’;
(3) select gender, count(gender)
from staff group by gender;
(4) select name from staff st, salary sl
where (sl.basic+sl.allowance) = (select
max(sl.basic+sl.allowance) from salary);
(c) There are two types of HTTP requests: GET and POST
GET Request: This HTTP request is made to request data from server. This request sends the URL
to the webserver which in turn sends the requested web page HTML to the web client.
POST Request: This HTTP request is made to submit dta to be processed at the server. This request
is issued when the client has data to be sent to the server for processing.

(d) The folders are: EasySell – Base directory of Project. This folder contains in it EasySell – Project
Web application folder, in addition to Register, Sell and Work folders.

(e) Django templates make up the presentation tier of Django. A template can use any presentation
format such as XML,HTML etc. Templates can also include logic to fill in data or values coming
from Django’s files and databases.
Q6 (a) (i) It is important for the safeguard of user privacy online.
(ii) Online world is an open world and so the personal information of a user must not be available
openly as it may be misused. Hence the privacy is important.
(b) FLOSS: Free Libre and Open Source Software
SDLC – System Development Life Cycle
OSS – Open Source Software
GNU – GNU is not UNIX
(c) (i) XYZ is a shareware.
(ii) No, it is not possible for Sumit to see the source code and edit the software.
(d) ABC has committed Identity Theft (a part of Cyber Crime). The affected person needs to report this
theft to the cyber cell of the police department.
(e) (i) This is a case of Plagiarism (Stealing)
(ii) The producer may have to face huge fine and penalties in this case.

You might also like