COMPUTER SCIENCE CLASS XI QUESTION PAPER HY EXAM 2024-25
COMPUTER SCIENCE CLASS XI QUESTION PAPER HY EXAM 2024-25
n=input(‘Enter a number’)
For k in range ( 2,20)
print( n/2)
25 Write a program to check the input number is even or odd. 2
26 Write a program to check the input number is positive or negative. 2
27 What will be the output of following code? 2
x, y = 2, 6
x, y = y, x + 2
print(x, y)
28 Differentiate between break and continue statements. 2
Section-C ( 3 x 3 = 9 Marks)
29 What are immutable and mutable data types? List immutable and 3
mutable data types of Python.
30 Input a string having some digits. Write a program to calculate the 3
sum of digits present in this string.
31 Write a program to find the sum of digits of an integer number, input 3
4
by the user.
Section-D ( 4 x 4 = 16 Marks)
32 (i)Rewrite the following code fragment that saves on the number of 4
comparisons.
if a==0:
print(“Zero”)
if a==1:
print(“One”)
if a==2:
print(“Two”)
if a==3:
print(“Three”)
(ii)Under what conditions will this code fragment print “water”?
if temp < 32:
print(“ice”)
elif temp < 212:
print(“water”)
else:
print(“steam”)
33 Rewrite the following code fragments using while loop: 4
(i)
min = 0
max = min
if num<0:
min=num
max=0
for i in range(min, max + 1):
sum += i
(ii)
for i in range(1,16):
if i%3 == 0:
print(i)
34 What is the output of the following code? 3+1=4
(i)
for i in range(4):
for j in range(5):
if i+1 ==j or j+i==4:
print(‘+’, end= ‘ ‘)
else:
print(‘*’, end= ‘ ‘)
5
print()
(ii)
for y in range(500,100, 100):
Print(“*”, y)
35 (i)Write a program to print Fibonacci series: 3+1=4
0 , 1 ,1, 2, 3, 5, 8, 13,21,………..upto n terms (n is input number)
(ii)Which method should we use to convert string “python
programming is fun” to “Python Programming Is Fun”?
(a)capitalize() (b)title() (c)istitle() (d)upper()
SECTION E (2 X 5 = 10 Marks)
36 Find the output of following: 5
(i)s1=”I enjoy working in Python”
x=s1.partition(“working”)
print(x)
(ii)s2=”I love Python”
a=s2.split()
print(a)
(iii)print(“*”.join(“HELLO”))
(iv) What will be the output of the following code snippet?
message= "World Peace"
print(message[-2::-2])
(v)What is the output of the following code?
str1=”Mission 999”
str2=”999”
print(str1.isdigit(), str2.isdigit())
37 (i)Consider the following string myAddress: 5
myAddress = “WAZ-1, New Ganga Nagar’, New Delhi”
What will be the output of following string operations:
(a)print(myAddress.lower()) (b)print(myAddress.count(‘New’))
(c)print(myAddress.index(‘Agra’))
(ii)Consider the following string mySubject:
mySubject = “Computer Science”
What will be output of the following string operations:
(a)print(mySubject[::-1])
(b)print(mySubject[:3] + mySubject[3:])