You are on page 1of 4

HALF YEARLY SAMPLE PAPER 2022

COMPUTER SCIENCE 083, Class XI


Maximum Marks: 70 Time Allowed: 3 Hours

General Instructions:
The question paper is divided into 3 Sections - A, B and C.
● Section A, consists of 4 Questions (Q. No 1-4) of 14 Marks
● Section B, consists of 3 Competency based Question (Q. No 5 - 7) of 21 Marks
● Section C, consists of 10 Subjective Questions (Q. No 8 - 17 ) of 35 Marks.

SECTION A

1 Choose the correct answer 2

(a) Find the output of the following code?


print("*"*2**3)
A. ******
B. ********
C. Error
D. 8*

(b) Evaluate the following expression and identify the correct answer.
40//2%3**2+10
A. 10
B. 12
C. 46
D. Error

2 Identify the invalid Python identifiers and give reasons: 2


(a)break (b)Number (c)My Name (d)Section
(e)5thSubject (f)While (g)class (g)VarX

3 Find the syntax errors in the following Python codes, and rewrite the 2
corrected code, with each of the corrections underlined. The correction
should not make any change in the logic of the code.

A=100, B=120
while True
print(x ; y)

4 Write the expected output on execution of the following codes:

(a) X = 10 2
Y = 20
if X%Y == 0:
print("YES")
elif Y%X == 0:
print("NO")
print("OVER")

(b) R=0 2
for C in range(10,4, -2):
print (R,C+R,sep=" # ", end=" & ")
else:
print("OVER")
(c) S=0 2
for i in range(1,10):
if i<9:
print(i,end="+")
else:
print(i,end="=")
S+=i
i += 2
print(S)

(d) X=10; Y=20; Z = 30 2


print(X+Y,Y+Z,Z+X,sep='#', end='*')
X,Y,Z=Y,Z,X
print(X,Y,Z,sep='#', end='*')

SECTION B (Competency Based Questions)

5 Study the following Python code. The code accepts an integer from the user and is
expected to display its reverse.
N=int(input("Enter an integer:") #Line1
while N>0 #Line2
print(N%10 ; end='") #Line3
N=N//10 #Line4

(a) Rewrite the statements with syntax errors after correction 2

(b) How many times will the while loop iterate(execute) if N=2457 1

(c) Name the arithmetic operator used in Line3 1

(d) Rewrite the code and add statements to find and display the sum of all the digits of 3
the variable N entered by the user

6 Consider the following code and answer the questions given below:
A=int(input('Enter an integer:')) #Line1
for i in range(A) : #Line2
if i%2=0
print("EVEN", end='#') #Line3
else
print("ODD" end='#')

(a) Rewrite the statements with syntax errors after correction 2

(b) Explain in brief the use of “for” as mentioned in Statement 2 2

(c) Explain in brief the use of “end” as mentioned in Statement 3 2

(d) Name the type of the operator used in Statement 1. 1

7 Consider the following code to display the result of N! i.e. Factorial of N


N=int(input('Enter integer'))
P=1
I = 1
while I<=N :
P *= I #Line 1
I += 1 #Line 2
print(P) #Line 3
a What is the type of operator used in Lines 1 and 2 ? 1

b How many times will Line 1 and Line 2 get repeated, if the value of N is entered as 4 1
?

c If the print() written in Line 3 was indented in alignment with Line 1 and Line 2 (as 2
given below):

N=int(input('Enter integer'))
P=1
I = 1
while I<=N :
P *= I #Line 1
I += 1 #Line 2
print(P) #Line 3

and the value of N is entered as 4, what shall be the output of the given code ?

d Rewrite the above code using a for loop to display the result of N! 3

SECTION C

8 Differentiate between the following: 6


(a) = and == operators in Python
(b) if…else and for..else
(c) Script mode and Interactive mode of Python IDLE

9 Convert the following code to a while loop: 3

S=0
for i in range(1,10,2):
if i%3==0:
print(i*3)
S+=i*3
else:
print(i*2)
S+=i*2
else:
print(S)

10 Draw flowchart to accept two numbers from the user, find and display their common 3
factors.

11 Write a python program to accept Price of 10 items as inputs from the user. Calculate 3
the average and display the lowest price.

12 Write a python program to accept an integer from the user and display if it is an 3
Armstrong’s number. The Armstrong number is a number that is equal to the sum of
cubes of its digits. For example 0, 1, 153, 370, 371 and 407 are the Armstrong
numbers.

13 To find and print the sum of the following series for N number of terms: 3+3

(a) 1!+3!+5!+...upto N terms (b) 2+(2+4)+(2+4+6).. N Terms


14 Write a python program to accept a sentence as input from the user. Count and 3
display the number of alphabets and digits present in the sentence.

15 Write a Python code to accept an integer and display the sum of all even digits 3
present in the number. Example if the number entered by the user is 21478 then the
program should display the output as the sum of 2, 4, 8 i.e 14.

16 Write a Python program which takes a user's choice of input to find either HCF or 5
LCM of two integers.
Depending upon the choice entered by the user, the program should display the
highest common factor of two integers input by the user or otherwise display the
lowest common multiple of the two integers entered by the user.

You might also like