SAMPLE PAPER-IV Class XII (Computer Science) QP With MS & BP
SAMPLE PAPER-IV Class XII (Computer Science) QP With MS & BP
(b) Name the Python Library modules which need to be imported to invoke the following functions 1
(i) floor() (ii)randint()
Ans (i)math (ii) random
(c) Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code. 2
STRING=""WELCOME NOTE""
for S in range[0,7]:
print STRING(S)
print S+STRING
(b) Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are odd. 2
Ans def EvenSum(NUMBERS):
n=len(NUMBERS)
s=0
for i in range(n): if (i%2!=0):
s=s+NUMBERS[i]
print(s)
(c) Write a method in python to write multiple lines of text contents into a text file myfile.txt 2
def write1():
f = open("myfile.txt","w")
while True:
line = input("Enter line")
f.write(line)
choice = input("Are there more lines")
if choice == "N":
break
f.close()
(d) Write PUSH() and POP() methods in Python to add Names and delete names considering them to act as PUSH and POP 4
operations in Stack
stack=list()
def display():
l=len(stack)
if l:
print(stack[l-1],"-->TOP")
for i in range(l-2,-1,-1):
print(stack[i])
else:
print("Empty Stack")
def POP():
if len(stack)==0:
print("Empty stack")
else:
ele=stack.pop()
print("Deleted element is",ele)
print("After deletion :\n")
display()
def PUSH(Names):
stack.append(Names)
print(Names, " added")
display()
while True:
print("1-add")
print("2-Delete")
print("3-Display")
print("4-Exit")
ch=int(input("choice"))
if ch==1:
Names=input("Enter Names")
PUSH(Names)
elif ch==2:
POP()
elif ch==3:
display()
elif ch==4:
break
else:
print("Invalid")
(e) Differentiate between file modes r+ and rb+ with respect to Python 2
r+ Opens a file for both reading and writing. The file pointer placed at the beginning of the file.
rb+ Opens a file for both reading and writing in binary format. The file pointer placed at the beginning of the file.
3 (a) Consider a binary file “Emp.dat” containing details such as empno:ename:salary(separator ‘:’). Write a python function to 3
display details of those employees who are earning between 20000 and 40000
Ans: fin=open("emp.dat")
x=fin.readline()
while x:
data=x.split(":")
if(float(data[2])>20000<30000):
print(data)
x=fin.readline()
fin.close()
A Optical Fibre
ns ● Very Fast
: ● Expensive
● Immune to electromagnetic interference
Ethernet Cable -
● Slower as compared to Optical Fiber
● Less Expensive as compared to Optical Fiber
● prone to electromagnetic interference
(d) Name the protocol used to transfer files to and from a remote computer 1
Ans: Telnet
(e) Daniel has to shate dadta amon various computers of his two office brances situated in the same city. Name the network 1
(out of LAN,MAN,PAN and WAN) which should be formed in this process
Ans: MAN
Ans: Cloud computing is an internet based new age computer technology. It is the next stage technology that uses the cloud
to provide the services whenever and wherever the user needs it. It provides a method to access several servers
worldwide
The main benefits of cloud computing are
(i) Data backup and storage of data
(ii) Powerful server capabilities
(iii) Incremented productivity
(iv) Very cost effective and time saving
(v) Software as a service known as Saas
(e) Hi Standard Tech Training Ltd is a Mumbai based organization which is expanding its office set-up to Chennai. At Chennai
office compound, they are planning to have 3 different blocks for Admin, Training and Accounts related activities. Each
block has a number of computers, which are required to be connected in a network for communication, data and
resource sharing.
As a network consultant, you have to suggest the best network related solutions for them for issues/problems raised by
them in (i) to (iv), as per the distances between various blocks/locations and other given parameters.
Shortest distances between various blocks/locations:
Admin Block to Account Block 300 Metres
Accounts Block to Training Block 150 Metres
Admin Block to Training Block 200 Metres
MUMBAI Head Office to CHENNAI Office 1300 KM
(ii) Suggest the best wired medium and draw the cable layout (Block to Block) to efficiently connect various blocks within the 1
CHENNAI office compound.
Ans Best wired medium: Optical Fibre OR CAT5 OR CAT6 OR CAT7 OR CAT8 OR Ethernet Cable
(iii) Suggest a device/software and its placement that would provide data security for the entire network of the CHENNAI 1
office.
Ans Firewall - Placed with the server at the Training Block OR
Any other valid device/software name
(iv) Suggest a device and the protocol that shall be needed to provide wireless Internet access to all smartphone/laptop users 1
in the CHENNAI office
Ans Device Name: WiFi Router OR WiMax OR RF Router OR Wireless Modem OR RF Transmitter
Protocol : WAP OR 802.16 OR TCP/IP OR VOIP OR MACP OR 802.11
5 Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) 6
to (viii), which are based on the tables.
Table: VEHICLE Table: TRAVEL
(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.
Ans SELECT CNO, CNAME, TRAVELDATE FROM TRAVEL ORDER BY CNO
DESC;
(ii) To display the CNAME of all the customers from the table TRAVEL who are traveling by vehicle with code V01 or V02.
Ans SELECT CNAME FROM TRAVEL WHERE VCODE=‘V01’ OR VCODE=’V02’;
OR
SELECT CNAME FROM TRAVEL WHERE VCODE IN (‘V01’, ‘V02’);
(iii) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ‘2015‐12‐31’ and
‘2015‐05‐01’.
Ans SELECT CNO, CNAME from TRAVEL WHERE TRAVELDATE >= ‘20150501’ AND TRAVELDATE <= ‘20151231’ ;
OR
SELECT CNO, CNAME from TRAVEL WHERE TRAVELDATE BETWEEN ‘20150501’
AND ‘20151231’ ;
OR
SELECT CNO, CNAME from TRAVEL WHERE TRAVELDATE <= ‘20151231’
AND TRAVELDATE >= ‘20150501’ ;
OR
SELECT CNO, CNAME from TRAVEL WHERE TRAVELDATE BETWEEN ‘20151231’
AND ‘20150501’ ;
(iv) To display all the details from table TRAVEL for the customers, who have travel
distance more than 120 KM in ascending order of NOP.
Ans SELECT * FROM TRAVEL WHERE KM > 120 ORDER BY NOP;
6 a 4
Write python-mysql connectivity to retrieve all the data of table student
import mysql.connector
mydb=mysql.connector.connect(user="root",host="localhost",passwd="123",database="inservice")
mycursor=mydb.cursor()
mycursor.execute("select * from student")
for x in mycursor:
print(x)
b What is the role of Django in website design 2
Django is a high level python web framework, designed to help build complex web applications simply and quickly. Django
makes it easier to build better web apps quickly and with less code
c Which method is used to retrieve all rows and single row 1
Fetchall() , fetchone()
d Write the difference between GET and POST method 2
A web browser may be the client and the application on a computer that hosts the website may be the server:
(i)GET: To request data from the server
(ii)POST: To submit data to be processed to the server
7 a Explain the term ‘Web beacons’ 2
Pictures in email messages also called Web beacons•can be adapted to secretly send a message back to the se - Spammers rely
on information returned by these images to locate active email addresses.mages can also contain harmful code and be used to
deliver a spammers message in spite of filters.
b How does phishing happen? : 2
Phishing is a fraudulent attempt to obtain sensitive information such as usernames, passwords, and credit card details (and
money), often for malicious reasons, by disguising as a trustworthy entity in an electronic communicati on. Phishing is typically
carried out by email spoofing or instant messaging,and it often directs users to enter personal information at a fake website , the
look and feel of which is identical to the legitimate one and the only difference is the URL of the website in question
c Write any two categories of cybercrime. 2
Cybercrime encompasses a wide range of activities, but these can generally be broken into two categories:
* Crimes that target computer networks or devices: Such types of crimes include viruses and denial-of-service (DoS) attacks.
* Crimes that use computer networks to advance other criminal activities: These types of crimes include cyberstalking, phishi ng
and fraud or identity theft.
d When did IT Act came into force 1
17th October 2000
e What is meant by the term Cyber Forensics? 2
Cyber forensics is an electronic discovery technique used to determine and reveal technical criminal evidence. It often invol ves
electronic data storage extraction for legal purposes. Although still in its infancy, cyber forensics is gaining traction as a viable
way of interpreting evidence.
Cyber forensics is also known as computer forensics.
f What are Intellectual Property Rights (IPR)? 1
IPR is a general term covering patents, copyright, trademark, industrial designs, geographical indications, layout design of
integrated circuits, undisclosed information (trade secrets) and new plant varieties.