XII CS PractisePaper 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SAMPLE PAPER-I Class XII (Computer Science) HALF YEARLY

COMPUTER SCIENCE WITH PYTHON (083)


BLUE PRINT
Type of Questions Marks Per Question Total Number of Questions Total Marks
VSA 1 15 15
SA I 2 17 34
SA II 3 03 09
LA 4 03 12
Total 38 70
• VSA: Very Short Answer Type
• SA : Short Answer Type
• LA : Long Answer Type

BLUE PRINT
Topic / Unit VSA (1 mark) SAI (2 marks) SA II (3 marks) LA (4 marks) Total
Programming and 2(2) 9(18) 2(6) 1(4) 14(30)
Computational Thinking
Computer Networks 4(4) 2(4) 1(3) 1(4) 8(15)
Data Management 7(7) 2(4) - 1(4) 10(15)
Society, Law and Ethics 2(2) 4(8) - - 6(10)
Total 38(70)
Difficulty Level :
Easy : 15%
Average : 70%
Difficult : 15%
HOTS-based Questions : 20%
Half Yearly Examination
Marking Scheme
CLASS XII COMPUTER SCIENCE (083)
TIME: 3 hrs M.M: 70
1. (a) Differentiate between mutable and immutable objects in Python language with example. (2)
Ans. Every variable in Python holds an instance of an object. There are two types of objects in Python,
i.e., Mutable and Immutable objects. Whenever an object is instantiated, it is assigned a unique
object id. The type of the object is defined at the runtime and it can’t be changed afterwards.
However, its state can be changed if it is a mutable object.
For example, int, float, bool, string, unicode, tuple are immutable objects in Python. In simple words, an
immutable object can’t be changed after it is created. Lists, dictionaries and sets are mutable types.
(b) Identify and write the name of the module to which the following functions belong: (1)
(i) ceil() (ii) findall()
Ans. (i) ceil() – math module (ii) findall() – re module
(c) Observe the following Python code very carefully and rewrite it after removing all syntactical errors
with each correction underlined. (2)
DEF execmain():
x = input("Enter a number:")
if (abs(x)= x):
print"You entered a positive number"
else:
x=*-1
print"Number made positive:"x
execmain()
Ans. Corrected code:
def execmain():
x= input("Enter a number:")
if(abs(x)== x):
print("You entered a positive number")
else:
x *= -1
print("Number made positive:",x)
execmain()
(d) Find the output of the following: (2)
L1 = [100,900,300,400,500]
START = 1
SUM = 0
for C in range(START,4):
SUM = SUM + L1[C]
print(C, ":", SUM)
SUM = SUM + L1[0]*10
print(SUM)
Ans. Output is:
1 : 900
1900
2 : 2200
3200
3 : 3600
4600
(e) Write the output of the following Python program 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. Output is:
[11,10,9,8,7,4]
(f) Study the following program and select the possible output(s) from the options (i) to (iv) following it.
Also, write the maximum and the minimum values that can be assigned to the variable Y. (2)
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
(i) 0 : 0 (ii) 1 : 6
(iii) 2 : 4 (iv) 0 : 3
Ans. (i) and (iv) are the possible outputs. Minimum value that can be assigned is – Y = 0. Maximum value
that can be assigned is – Y = 3
2. (a) Explain operator overloading with the help of an example. (2)
Ans. Operator overloading is a feature in Python that allows the same operator to have a different meaning
according to the context. It signifies giving extended meaning beyond the predefined operational
meaning. For example, operator + is used to add two integers as well as join two strings and merge
two lists.
For example,
>>print(44 + 2)
46
# concatenate two strings
print("Python"+"Programming")
PythonProgramming
# Product of two numbers
print(5 * 5)
25
# Repeat the String
print("Hello"*3)
HelloHelloHello
(b) Find the output of following: (2)
colors = ["violet", "indigo", "blue", "green", "yellow", "orange", "red"]
del color[4]
colors.remove("blue")
colors.pop(3)
print(colors)
Ans. Output is:
['violet', 'indigo', 'green', 'red']
(c) Find the output of the following: (2)
str = "Pythonforbeginners is easytolearn"
str2 = "easy"
print("The first occurrence of str2 is at : ", end="")
print(str.find( str2, 4))
print("The last occurrence of str2 is at : ", end="")
print(str.rfind( str2, 4))
Ans. Output is:
The first occurrence of str2 is at : 22
The last occurrence of str2 is at : 22
3. (a) Write the definition of a function Reverse(X) in Python to display the elements in reverse order such
that each displayed element is twice of the original element (element *2) of the List X in the following
manner: (2)
Example:
If List X contains 7 integers as follows:
X[0] X[1] X[2] X[3] X[4] X[5] X[6]
4 8 7 5 6 2 10
After executing the function, the array content should be displayed as follows:
If List
Ans.
20 4 12 10 14 16 8
def Reverse(X):
for i in range(len(X)-1,-1,-1):
print(X[i]*2)
(b) Consider the following unsorted list: 95 79 19 43 52 3. Write the passes of bubble sort for sorting
the list in ascending order till the 3rd iteration. (3)
Ans. [79, 19, 43, 52, 3, 95]
[19, 43, 52, 3, 79, 95]
[19, 43, 3, 52, 79, 95]
(c) Write a user-defined function to generate odd numbers between a and b (including b). (3)
Note: a and b are received as an argument by the function.
Ans. def generateodd(a,b):
for i in range(a, b+1):
if(i%2 != 0):
print(i)
(d) Observe the following code and answer the questions that follow: (1)
File = open("Mydata","a") _____________________ #Blank1
File.close()
(i) What type (Text/Binary) of file is Mydata?
(ii) Fill in Blank 1 with a statement to write “ABC” in the file “Mydata”.
Ans. (i) Text File
(ii) File.write("ABC")
4. (a) Write any one advantage and one disadvantage of Coaxial cable. (1)
Ans. Advantages:
• It is less susceptible to noise or interference (EMI or RFI) as compared to twisted pair cable.
• It supports high bandwidth signal transmission as compared to twisted pair.
• It is easy to wire and easy to expand due to its flexibility.
Disadvantages:
• It is bulky.
• It is expensive to install for longer distances due to its thickness and stiffness.
(b) Riana Medicos Centre has set up its new centre in Dubai. It has four buildings as shown in the diagram
given below: (4)

Accounts
Lab

Unit

Distances between various buildings are as follows:


Accounts to Research Lab 55 m
Accounts to Store 150 m
Store to Packaging Unit 160 m
Packaging Unit to Research Lab 60 m
Accounts to Packaging Unit 125 m
Store to Research Lab 180 m
Number of computers:
Accounts 25
Research Lab 100
Store 15
Packaging Unit 60
As a network expert, provide the best possible answer for the following queries:
(i) Suggest the type of network established between the buildings.
Ans. LAN (Local Area Network)
(ii) Suggest the most suitable place (i.e., building) to house the server of this organization.
Ans. Research Lab as it has the maximum number of computers.
(iii) Suggest the placement of the following devices with justification: (a) Repeater (b) Hub/Switch
Ans. (a) Repeater: It should be placed between Accounts and Packaging Unit, Accounts to Research
Lab, Store to Research Lab and Accounts to Packaging Unit.
(b) Switch should be placed in each of the buildings for better traffic management.
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
Ans. Firewall.
(c) Expand the following: (2)
(i) VoIP
Ans. Voice over Internet Protocol
(ii) SMTP
Ans. Simple Mail Transfer Protocol
(iii) TDMA
Ans. Time Division Multiple Access
(iv) TCP/IP
Ans. Transmission Control Protocol/Internet Protocol
(d) The following is a 32-bit binary number usually represented as 4 decimal values, each representing
8 bits, in the range 0 to 255 (known as octets) separated by decimal points. (1)
140.179.220.200
What is it? What is its importance?
Ans. It is an IP Address. It is used to identify the computers on a network.
(e) Name the network tools used in the given situations: (4)
(i) To troubleshoot internet connection problems
Ans. ping
(ii) To see the IP address associated with a domain name
Ans. nslookup
(iii) To look up registration record associated with a domain name.
Ans. whois
(iv) To test the speed of internet connection
Ans. speedtest.net
(f) What is a cloud? (1)
Ans. A cloud is a combination of networks, hardware, services, storage and interfaces that helps in
delivering computing as a service. It has three users:
(i) End users
(ii) Business management users
(iii) Cloud service provider
(g) What are the effects of Network Congestion? (1)
Ans. Network congestion in data networking and queuing theory is the reduced quality of service that
occurs when a network node or link is carrying more data than it can handle. Typical effects include
queuing delay, packet loss or the blocking of new connections.
5. (a) Write the difference between GET and POST method. (1)
Ans. A web browser may be the client and an application on a computer that hosts a website may be
the server.
So, to request a response from the server, there are mainly two methods:
(i) GET : to request data from the server
(ii) POST : to submit data to be processed to the server
(b) Write a MySQL-Python connectivity to retrieve data, one record at a time, from city table for
employees with id less than 10. (2)
Ans. import MySQLdb as my
try:
db = my.connect(host="localhost",
user="root",
passwd="",
database="India")
cursor = db.cursor()
sql = "select * from city where id < 10"
number_of_rows = cursor.execute(sql)
print(cursor.fetchone()) # fetch the first row only
db.close()
except my.DataError as e:
print("DataError")
print(e)
(c) What are the basic steps to connect Python with MYSQL using table Members present in the
database ‘Society’? (3)
Ans. import MySQLdb
conn = MySQLdb.connect(host=”localhost”, user=‘root’, password =‘ ’,
database=”Society”)
cursor = conn.cursor()
cursor.execute('SELECT COUNT(MemberID) as count FROM Members WHERE id = 1')
row = cursor.fetchone()
conn.close()
print(row)
(d) What is the role of Django in website design? (1)
Ans. 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.
6. (a) Write the steps to connect with database “testdb” with Python programming. (2)
Ans. Steps to be followed are:
• Import mysqldb as db
• Connect
• Cursor
• Execute
• Close
(b) Which method is used to retrieve all rows and single row? (1)
Ans. fetchall(),fetchone()
(c) Consider the table ‘empsalary’. (1)
eid esalary
101 40000
102 NULL
104 51000
107 NULL

To select tuples with some esalary, Arun has written the following erroneous SQL statement:
SELECT eid, esalary FROM empsalary WHERE esalary = something;
Write the correct SQL statement.
Ans. The correct SQL statement is:
SELECT eid, esalary FROM empsalary WHERE esalary is NOT NULL;.
(d) Table COACHING is shown below. Write commands in SQL for (i) to (iii) and output for (iv) and (v)
(4)
ID NAME AGE CITY FEE PHONE
P1 SAMEER 34 DELHI 45000 9811076656
P2 ARYAN 35 MUMBAI 54000 9911343989
P4 RAM 34 CHENNAI 45000 9810593578
P6 PREMLATA 36 BHOPAL 60000 9910139987
P7 SHIKHA 36 INDORE 34000 9912139456
P8 RADHA 33 DELHI 23000 8110668888
(i) Write a query to display name in descending order whose age is more than 23.
Ans. select name from coaching where age>23 order by name desc;
(ii) Write a query to find the average fee grouped by age from customer table.
Ans. select avg(fee) from coaching group by age;
(iii) Write query details from coaching table where fee is between 30000 and 40000.
Ans. Select * from coaching table where fee is between 30000 and 40000;
(iv) Select sum(Fee) from coaching where city like “%O% ;
Ans. 94000
(v) Select name, city from coaching group by age having count(age)>2;
Ans. Empty set
7. (a) What are the proper methods and steps for the disposal of used electronic items? (1)
Ans. Explanation about any methods like:
• Landfilling • Acid Bath
• Incineration • Recycling of e-waste
• Reuse of electronic devices
(b) When did IT Act come into force? (1)
Ans. 17th October, 2000.
(c) Explain the gender and disability issues while using computers in the classroom. (1)
Ans. It has been seen in many studies that in many countries computer use in schools is dominated by men.
Female teachers have less regard for their skills and knowledge than their male colleagues.
Females know less about information technology, enjoy using the computer less than male students,
and perceive more problems with software.
(d) How can we recycle e-waste safely? (2)
Ans. (i) Use a certified e-waste recycler.
(ii) Visit civic institutions. Check with your local government, schools and universities for additional
responsible recycling options.
(iii) Explore retail options.
(iv) Donate your electronics.
(e) Name some threats to computer security. (1)
Ans. • Snooping • Identity theft • Phishing
• Virus and Trojans • Child pornography, etc.
(f) What is meant by the term Cyber Forensics? (2)
Ans. Cyber forensics is an electronic discovery technique used to determine and reveal technical criminal
evidence. It often involves 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.
(g) Write any two categories of cyber crime. (1)
Ans. Cyber crime 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, phishing and fraud or identity theft.
(h) How does phishing happen? (1)
Ans. 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 communication. 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.
(i) Define and name some open source software. (1)
Ans. GPl, Apache, Creative Commons, Mozilla Firefox, Open Office.org, etc.
(j) What are Intellectual Property Rights (IPR)? (1)
Ans. 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