(a) What happens when Python encounters ‘pass’ statement? 1
(b) What is the purpose of range() function? 1
(c) Show the list created by following range() function: 1
range(8, -7, -3)
(d) Rewrite the following program code using a while loop: 2
sum=0
for n in range(1,8) : sum+=n
print(“Sum of natural numbers
(a) Whenever python finds a pass statement, it ignores and move to next statement in program.
(b) The range() function of Python generates a list which is a special sequence type.
(c) The following list will be created:
[8 5 2 -1 -4]
(d) The code using while loop is:
sum=0
n=1
while n < 8
print(“Sum of natural numbers <=”,n,‘is’ sum)
n+=1
(e) Actual parameters - 6,17,25
Formal parameters - a,b,c
(f) The module's name should not be mentioned in function call statement as it has been already imported in first statement.
The correct statement should be: print(factorial(7))
(g) The possible outputs could be (ii), (iii), (iv) and (vi)
The reason being that randint() would generate an integer between range 2…4, which is then raised to power 2, so possible outcomes can be any of these three: 4,9 or 16.
(a) Using del statement write the code to delete all the elements between 5 to 9:
a=[1,2,3,4,5,6,7,8,9,10]. 1
(b) What is the output produced by the following code snippet? 1
res=[1,2,3,4,5,6,7,8,9]
print(res[::3])
(c) Name the method that returns True if the string contains only letters. 1
(d) Consider the following Python program:
N=int(input(“Enter N:”))
i=1
sum=0
while i < N
if i%2 == 0 :
sum=sum+i
i=i+1
print(sum)
(i) What is the output when the input value is 5? 1
(ii) What is the output when the input value is 0? 1
(e) Identify the reason of the following code printing 2 endlessly, if the function is called with statement-result(4). Correct it. 2
(f) Explain the following modes:- 2
i) ‘rb’
ii) ‘ab’
(g) Write code to create a pie for sequence res=for locations=[‘East’, ‘West’, ‘North’, ‘South’,‘Central’]. 3
(h) Write a program that copies a text file “content1.txt” onto content2.txt barring the lines starting with “*”. 3
(i) Write a Python program to find the greatest common divisor (gcd) of two integers. 3
(a) del a[5:9]
(b) [1,4,7]
(c) isalpha()
(d)
(i) 6
(ii) 0
(e) The code is printing 2 endlessly because the base case j > n is never reachable. The reason is that value of i becomes 1 for each call to function result().
def result(n):
The correct code will be:
if n==0 :
return
else:
result(n-1)
print(n)
(f)
(i) ‘rb’- In read only mode file must exist already, otherwise Python raises I/O error.
(ii) ‘ab’ – In append mode file is in write only mode. If the file exists, the data in the file is retained and new data.
(g) import matplotlib.pyplot as plt
res=[42.1,19.4,23,44,52]
locations=[‘East’, ‘West’, ‘North’, ‘South’, ‘Central’]
plt.axis(“equal”)
plt.pie(res,labels= locations, explode=[0,0,0.2,0,0], autopct= “%1.2f%%”)
plt.show()
(h) def copy(a1, a2):
fin=open(a1,"r")
fout=open(a2,"w")
while True :
text= fin.readline()
if len(text)==0:
break
if text[0]=="*":
continue
fout.write(text)
fin.close()
fout.close()
copy("content1.txt","content2.txt")
(i) def Recurgcd(a, b):
low = min(a, b)
high = max(a, b)
if low == 0:
return high
elif low == 1:
return 1
else:
return Recurgcd(low, high%low)
(a) What is the purpose of NIC? 1
(b) Define the following: 2
1. Public Cloud
2. Community Cloud
(c) Differentiate between switches and routers. 2
(d) Mention any two enabling technologies for IoT systems. 2
(e) Expand the following: 2
1. IMAP
2. SSH
(f) What are the steps followed in checksum generator ? 3
(g) Explain in brief the three types of errors that may occur in the data transmitted over networks. 3
(a) NIC ontrols the wired and wireless connections of a computer to exchange information with other computers and the Internet.
(b) (i) Public clouds are the clouds used by multiple organization on a shared basis and managed by a third party service provider.
(ii) Community clouds are the clouds used by a group of related organisations who wish to make use of a common cloud computing environment.
(c) A switch is able to handle the data and knows the specific addresses to send the message. Router is actually a small computer that can be programmed to handle and route the network traffic.
(d)
i. Sensors
ii. RFID(Radio Frequencies Identification)
(e) i. Internet Message Access Protocol
ii. Secure Shell
(f) The sender, which is the checksum generator, follow these steps :
(g) The following types of errors may occur:
(a) Which clause is used to specify filtering condition for groups? 1
(b) What do you understand by ‘table’ alias? 1
(c) Differentiate between CHAR and VARCHAR data types. 2
(d) What are the different types of SQL functions? 2
(e) Explain equi-join and non-equi-join. 2
(f) Consider the Table “Infant’ shown below: 7
ItemCode | Item | DataPurchase | UnitPrice | Discount |
101 | Frock | 2016-01-23 | 700 | 10 |
102 | Cot | 2015-09-23 | 5000 | 25 |
103 | Soft Toy | 2016-06-07 | 800 | 10 |
104 | Baby Socks | 2014-10-16 | 100 | 7 |
105 | Baby Suit | 2015-09-20 | 500 | 5 |
Note: Discount column stores discount %.
Write the commands in SQL for (i) to (v) and output for (vi) and (vii)
(i) To display the number of items that have more than 10% as discount.
(ii) To display item code and unit price in decreasing order of unit price.
(iii) To increase the unit price of each item by 10% of their unit price.
(iv) To display the highest unit price of items.
(v) To display the names of items that have ‘Baby’ anywhere in their item names.
(vi) SELECT MID (Item,1,2) FROM Infant;
(vii) SELECT AVG(UnitPrice) FROM Infant WHERE DATEPURCHASE >’2015-01-01’;
(a) Having clause is used to specify filtering conditions for groups.
(b) A table alias is a temporary label given along with the table name in FROM clause.
(c) The CHAR datatype specifies a fixed length character string. When a column is given data type as CHAR(n), then MYSQL ensures that all values stored in that column have this length of bytes.
VARCHAR specifies a variable length string. When a column is given datatype as VARCHAR(n), then the maximum size a value in this column can have is n bytes.
(d) The types of SQL functions are:
i. Single Row(Scalar) functions
ii. Multiple Row(Group/Aggregate) functions
(e) In an equi-join, the values in the columns being joined are compared for equality. All columns in the tables being joined are included in the results. Here, all columns from joining table appear in the output even if they are identical.
Non-equi-join is a query that specifies some relationship other than equality between the columns.
(f)
(i) SELECT COUNT(Item) FROM Infant WHERE Discount> 10 ;
(ii) SELECT Itemcode,UnitPrice FROM Infant ORDER BY Unitprice DESC ;
(iii) UPDATE Infant SET UnitPrice = UnitPrice + 0.1* UnitPrice ;
(iv) SELECT MAX(UnitPrice) FROM Infant ;
(v) SELECT Items FROM Infant WHERE Item LIKE %Baby% ;
(vi)
Fr |
Co |
So |
Ba |
Ba |
(vii) 1750
(a) What do you understand by ‘E-waste’. 1
(b) What term is used for interpretation of computer media for digital evidence? 1
(c) Mention two examples of software, hardware that may be used for special needs students. 2
(d) State any two protection measures against identity theft. 2
(e) Differentiate between GPL and LGPL software license. 2
(f) Discuss Gender issues that we see in the field of computer science studies. 2
(a) E-waste or Electronic waste may be defined as discarded electrical or electronic device and electronics which are used for for refurbishment, reuse, resale, recycle or disposal.
(b) Digital/computer forensics
(c) (i) Sophisticated Virtual keyboard software
(ii) A joystick
(d) Identity threat can be protected by:
i. Using Unique Ids to protect our accounts and devices
ii. Using Bio-metric protection
(e) GPL-General Public license is commonly used for open source projects. It guarantees a good range of rights to developers who work on open source project.
LGPL- Lesser General Public license is used to license free software so that it can be incorporated into both free software and proprietary software.
(f) The gender issues in the field of computer science are:
i. Lack of interest among girls
ii. Lack of motivation for girls
Take your CBSE board preparation to another level with AI based and rich media animation on Extramarks - The Learning App.
Features of Learning App