You are on page 1of 3

KAMALA NIKETAN MONTESSORI SCHOOL, CBSE

STD : XI – D, F, G, H, J, K, L ANNUAL EXAM

MAX. MARK: 70 SUBJECT: COMPUTER SCIENCE TIME: 3 hrs

I. ANSWER ALL THE QUESTION: 10 X 1 = 10


1. Python uses a/an _____ to convert source code to object code.
(a) Interpreter (b) Compiler (c) Both a and b (d) special virtual engine
2. Value 17.25 is equivalent to _______.
(a) 0.1725E-2 (b) 0.1725E+2 (c) 1725E2 (d) 1725E-2
3. Python variables support dynamic typing.
(a) True (b) False
4. What will the following code produce?
a = 8.6
b=2
print (a / / b)
(a) 4.3 (b) 4.0 (c) 4 (d) compilation error
5. To use function fabs ( ), _____ module should be imported.
(a) random (b) statistics (c) math (d) string
6. What is the output produced when this code executes?
a=0
for i in range (4, 8):
if i % 2 == o:
a=a+i
print (a)
(a) 4 (b) 8 (c) 10 (d) 18
7. To check if an element is in list, _______ operator is used.
(a) Find (b) search (c) not in (d) in
8. What will be the output of the following python code?
t = (10, 20, 30, 40, 50, 50, 70)
print (t [5 : -1] )
(a) Blank output ( ) (b) (50, 70) (c) (50, 50, 70) (d) (50, )
9. Functions max ( ) and min ( ) work with all types of nested tuples.
(a) True (b) False
10. To get each word’s first letter capitalized, _____ function is used.
(a) title (b) capitalize (c) Both a and b (d) none of these
II. ANSWER ANY SEVEN QUESTIONS: 7 X 2 = 14
11. What does a cross platform language mean?
12. Write a program to input a number and print its cube.
13. Write the following real constants in exponent form:
a) 17.251 b) 151.02 c) 0.00031 d) 0.452
14. What will be the output produced by these code?
a) 12 / 4 b) 14 % 4 c) 14 / / 14 d) 14.0 % 4
15. Write a program to input a string and check if it is a palindrome string using a string slice.
16.List the properties of 2-D list.
17.Consider a list letters = [“a”, “b”, “o”, “c”, “p”]. Evaluate the expression given below.
a) letters[ len (letters) – 2] b) letters[ 2 : -5 : 2]
c) letters + [“x”] d) letters + 2
18.What is meant by nested tuples? Give one example.
19.Find out the errors.
if n == 0
Print (“zero”)
elif : n == 1
print (“one”)
elif
n == 2:
print (“two”)
else n == 3:
Print (“three”)
III. ANSWER ANY SEVEN QUESTIONS: 7 X 3 = 21
20.Write a program to enter two integers and perform all arithmetic operations on them.
21.Explain any 10 list manipulation functions and methods.
22.Write a program that inputs a line of text and prints its each word in a separate line. Also, print the count of
words in line.
23.Consider the following tuples:
tuple1 = (23, 1, 45, 67, 45, 9, 55, 45)
tuple2 = (100, 200)
Find the output of the following statements:
i) Print (tuple1 . count(45)) ii) print (tuple1 + tuple2) iii) print (sum(tuple2))
iv) print (sorted (tuple1)) v) print (min (tuple1)) vi) print (tuple1.index(45) )
print (tuple1)
24.Write a program to read a list of n integers (positive as well as negative). Create two new lists, one having all
positive numbers and other having all negative numbers from the given list. Print all three lists.
25.Write a program to find the sum of digits of an integer number, input by the user.
26.What will be the output produced by three expressions of the following code.
a=5 b = -3 c = 25 d = -10
i) a + b + c > a + c – b * d
ii) str (a + b + c > a + c – b * d) == ‘true’
iii) len (str (a + b + c > a + c – b * d)) == len (str (bool (1)))
27.What will be the output of the following statements:
a) List1 = [1,2,3,4,5,6,7,8,9,10] b) List1 = [12,32,65,26,80,10] c) List1 = [1,2,32,80,10]
List1[: : -2] sorted(List1) List1[ len(List1) – 1]
List1[:3] + List1[3:]
28.Consider the given expressions what will be the final result and final data type?
a) a, b = 3, 6 b) a, b = 3, 6 c) a, b = 3, 6
c=b/a c=b//a c=b%a
IV. ANSWER IN DETAIL: 5 X 5 = 25
29.Write a program to check if a given number is a palindrome or not. (OR)
Find the error:
a = int (input ( “enter a value:”))
While a != 0 :
count = count + 1
a = int (input (“enter a value:”))
Print(“you entered”, count, “values”)
30. Explain about string manipulation functions and methods. (OR)
Write a program to input names of a students and store them in a tuple. Also, input a name from the user and
find if this student is present in the tuple or not.
31.Write a program to print Fibonacci series. (OR)
What will be the output produced by the following code statements:
i) 17 % 5 ii) 17 % 5.0 iii) (17 % 5) == (17 % 5)
iv) (17 % 5) is (17 % 5) v) (17 % 5.0) is (17 % 5.0)
32.Write a python program to create 2-D list with 3 rows and 3 columns.(OR)
List some Mathematical functions in math module with example.
33.Write the output for the following:
i) a, b, c = 1, 1, 2 ii) a = 5 – 4 – 3 iii) a, b, c = 1, 1, 1
d=a+b b = 3 ** 2 ** 3 d = 0.3
e = 1.0 print (a) e=a+b+c-d
f = 1.0 print (b) f = a + b + c == d
g = 2.0 print (e)
h=e+f print (f)
print (c == d)
print (c is d)
print (g == h)
print (g is h)
(OR)
Write a python script to read an integer > 1000 and reverse the number.

You might also like