CS sp
CS sp
General Instructions:
This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
SECTION A
1. ___________ occur due to mistaken analysis of the problem. 1
6. Following set of commands are executed in shell, what will be the output? 1
>>>str="hello"
>>>str[:2]
Options:
a. PYTHON-IS-Fun
b. PYTHON-is-Fun
c. Python-is-fun
d. PYTHON-Is –Fun
17. Identify the types cyber-attack in each of the following cases: 1
Case I: A software encrypts files and data within a system, making the content
inaccessible until a handsome amount is paid to some third party.
Case II: Hackers render a fully functional website inaccessible to legitimate
customers by illegally blocking the network traffic.
18. Which of the following statement(s) would give an error after executing the following 1
code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Welcome" # Statement 5
print(s) # Statement 6
What will be the final output?
19.
Write the output of the following code: 1
output = ""
x = -5
while x < 0:
x = x + 1
output = output + str(x) + " "
print(output)
Q20 and 21 are ASSERTION AND REASONING based questions. Mark the
correct choice as
(a)Both A and R are true and R is the correct explanation for A
(b)Both A and R are true and R is not the correct explanation for A
(c)A is True but R is False
(d)A is false but R is True
20. Assertion(A): The for loop is a counting loop that works with sequences of 1
values.
Reason(R): The range() function generates a sequence of list type().
21. Assertion(A): The randint() method returns an integer number selected element 1
from the specified range.
Reason(R): The syntax for randint() is : random.randint(start, stop)
SECTION B
22. Write a program that prints minimum number and maximum number out of the five 2
numbers entered by the user.
23. Prove the following algebraically: 2
X+ Y’Z = (X + Y’ + Z’)(X + Y’ + Z)(X + Y + Z)
OR
30=To
for K in range(0,To)
IF k%4==0:
print (K*4)
Else:
print (K+3)
SECTION-C
29. (a) Write the Corresponding Python expression for the mathematical expression: 1
−b ± √ b2−4 ac
x=
2a
(b) Explain the mathematical function with example given below:
i. floor() 2
ii. fabs()
30. a) Correct the code and then print the output.
1. s1=must 1
2. s2=’try’
3. n1=10
4. n2=3
5. print(s1+s2)
6. print(s2*n2)
1.5
(c) Name the Python Library modules which need to be imported to invoke the
1
following functions:
(1) randrange() (2) mean()
33. (a) Draw the circuit diagram for the Boolean expression 2
F(X,Y,Z)=(X’+Y)(Y’+Z)
b) Write a program which replaces all vowels in the string with '*'. 1.5
c) What is the output of the following? 1
print("xyyzxyzxzxyy".count('yy',6))
35. a) Write the differences between the following — 2
(a) Copyrights and Patents
(b) Phishing and Hacking
2
(c) General Public License and Apache License
(d) Spyware and Adware
SECTION-E
36. (a) Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random 2
a="Wisdom"
b=random.randint(1,6)
for i in range(0,b,2):
print(a[i],end='#')