Xi Hy 2023 CS 18112023
Xi Hy 2023 CS 18112023
Q. Question Marks
No.
SECTION-A
1 How would you write mathematical term in Python as an expression? 1
i) (x+y)3 ii) a2 + 2ab + b2
3 What will be the output of the following statement:print(not(10/5//5 or 100 and 0)) 1
a. 100 b. True c. 0 d. False
4 Convert (72.5)8 to hexadecimal 1
OR
Convert (FACE.3)16 to octal.
5 Which of the following is/are valid identifier? 1
a) while b) f_name c) #code d) _size e) AD2023
6 Which of the following is a syntax error 1
a) 4+’3’ b)’3’ +’4’ c) 4*3 d)’4’*3
7 _____ translator converts line by line from high level language to machine language 1
[1]
11 State the output of 1
n=input("enter a word")
print(type(n))
12 (i) Which of the following error results on “missing colon (:)” when required? 1
(a) Logical error (b) Syntax error (c) Runtime error (d) None of the above
Q17 and 18 are ASSERTION AND REASONING based questions. Markthe 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
17 Assertion(A): In python identifier a and A are treated differently 1
Reasoning(R): Identifier starts with alphabet or underscore in Python.
if k>50 :
if k<60 :
print('One')
else:
print('Two')
else:
if k>30 :
print('Three')
else:
print('Four')
OR
[3]
24 (i) Which of the following statement(s) would give an error uponexecuting the following 2
code?
S="Welcome to class XI" # Statement 1
print(S) # Statement 2
S='2024' # Statement 3
S[3]='3' # Statement 4
print("Approaching end of year", S) # Statement 5
a) Statement 1
b) Statement 3
c) Statement 4
d) Statement 5
ii)Which of the following abandons (ceases) the current iteration of the loop?
for i in range(1,15,4):
print(i, end=',')
[4]
28 Write a program to obtain the following pattern for “n” (input) rows: 3
A
A B
ABC
A B C D, and so on. (say, n=4)
OR
Write a program to obtain the following pattern for input “n” (say, n is 5):
12345
1234
123
12
1
29 (i) The output of an XNOR gate is 1. Find the correct input combination(s). 3
(a) A=1, B=0 (b) A=0, B=1 (c) A=0, B=0 (d) A=0, B’=1 (1+2)
(ii) While reading digital design and Boolean algebra, Mr. Srijan came across De-Morgan’s
first theorem as “the complement of the sum is equal to the product of its complements”. How
can he prove it using truth table along with mentioning the Boolean expression and the logic
diagram?
30 The code given below accepts a natural number from user and prints the sumof digits. Observe 3
the following code carefully and rewrite it after removing all syntax and logical errors.
Underline all the corrections made.
SECTION-D
31 Write a program that prints out a list of the integers from 1 to 20 and their squares and also 4
count all the squared numbers that are evenly divisible by 5.The output should look like this:
1 -> 1
2 -> 4
3 -> 9, and so on.
Count of squared number divisible by 5 is: 4
OR
Write a program to reverse the given number and state whether it is a palindrome or not.
For example: if the number if 1331
Reverse of 1331 is 1331
It is a palindrome
[5]
32 Write an algorithm or design the flowchart to calculate speed of a vehicle (input time and 4
distance travelled) and display the remark as
Above 80 overspeed
45-79 alright
Below 45 moderate
SECTION-E
33 i) Write a program to obtain the following sum of the series: 5
Sum=1- x + x2 - x3 + x4…xn Given x and n as natural numbers (3+2)
input from user. (Example: Input x=2 n=2, Output: Sum of series: 3)
ii) Rewrite the following for loop with the equivalent while construct:
for i in range(1,11):
print(5,’*’,i,'=',i*5)
34 State difference between the following with suitable examples: 5
i) = += (1*5)
ii) Comment delimiter
iii) List tuple
iv) * **
v) != not
35 (i) Obtain output of the following: 5
a = "Year 2024 @ Best" (2+3)
b = a.partition('2')
a = a.split('2')
c = a[0] + ". " + a[1] + ". " + a[2]
print(b)
print(c)
ii) Explain the following String functions in Python using suitable examples.
a) find()
b) count()
c) index()
[6]