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

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

The document discusses a computer science exam with questions on topics like Python programming, data structures, file handling, networking, cloud computing and network design. It contains questions ranging from basic to advanced level testing understanding of concepts and writing code snippets.

Uploaded by

SUPSNDI SINGH
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)
121 views

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

The document discusses a computer science exam with questions on topics like Python programming, data structures, file handling, networking, cloud computing and network design. It contains questions ranging from basic to advanced level testing understanding of concepts and writing code snippets.

Uploaded by

SUPSNDI SINGH
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/ 7

COMPUTER SCIENCE

Time allowed : 3 hours Maximum Marks : 70


1 (a) Which of the following can be used as valid variable identifier(s) in Python? 2
(i) 4thSum
(ii) Total
(iii) Number#
(iv) _Data

Ans ii) Total iv) _Data

(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

Ans STRING="WELCOME NOTE"


for S in range(0,7):
print (STRING[S])
print (S,STRING)
(d) Find and write the output of the following python code: 2
TXT = ["20","50","30","40"]
CNT =3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
print (TOTAL)
CNT-=1
Ans: 47.0
35.0
54.0
26.0
(e) Write the output of the following python code: 3
def ChangeList():
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)
ChangeList()
Ans:[11, 10, 9, 8, 7, 4]
(f) What are the possible outcome(s) executed from the following code? Also specify the maximum and minimum values that 2
can be assigned to variable N. import random
import random
NAV = ["LEFT","FRONT","RIGHT","BACK"]
NUM = random.randint(1,3)
NAVG = ""
for C in range(NUM,1,-1):
NAVG = NAVG+NAV[C]
print (NAVG)
(i) BACKRIGHT (ii) BACKRIGHTFRONT

(iii) BACK (iv) LEFTFRONTRIGHT

Ans (i) BACKRIGHT


Max value 3 and minimum value 1 for variable NUM
2) (a) What will be the status of the following list after the First, Second and Third pass of the insertion sort method used for 2
arranging the following elements in descending order?
22, 24, 64,34, 80, 43
Note: Show the status of all the elements after each pass very clearly underlining the changes.

(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()

(b) Write a python program to copy file1.txt into file2.txt 2


Ans: fin=open("file1.txt")
fout=open("file2.txt","w")
data=fin.read()
fout.write(data)
fin.close()
fout.close()
(c) Read the code given below and answer the question: 1
F1 =open(“first.txt”,”w”)
F1.write(“Welcome”)
F1.close()
If the file contains “kvs” before execution, what will be the contents of file after execution of the above code
Ans: The file now contains only “Welcome” because when the file is opened in writing mode, it truncates the existing data
in the file
4 (a) Expand the following 2
(i)ICMP (ii) TDMA
(iii)TCP/IP (iv) VOIP
Ans:(i)Internet Control Message Protocol
(ii)Time Division Multiple Access
(iii)Transfer Control Protocol/Internet Protocol
(iv)Voice Over Internet Protocol
(b) Name the network tools used in the given situation 2
(i) to troubleshoot internet connection problem
(ii) to see the IP address associated with a domain name
(iii) to look up registration record associated with a domain name
(iv) to test the speed of internet connection
(i) ping
(ii) nslookup
(iii) whois
(iv) speedtest.net
(c) Differentiate between communication using Optical Fiber and Ethernet Cable in context of wired medium of 2
communication technologies.

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

(f) What is cloud computing? What are the benefits? 2

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

(g) Identify the following 140.178.112.120. What is its use? 1


Ans: It is an IP Address. It is used to identify computers in the network

(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

Number of computers installed at various blocks are as follows:


Training Block 150
Accounts Block 30
Admin Block 40
(i) Suggest the most appropriate block/location to house the SERVER in the CHENNAI Office (out of the 3 blocks) to get the 1
best and effective connectivity. Justify your answer.
Ans Training Block - Because it has maximum number of computers.

(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;

(v)SELECT COUNT(*),VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT(*)>1;

(vi) SELECT DISTINCT VCODE FROM TRAVEL;

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.

You might also like