The Sovereign School (Learning Unlike Any Other) Subject: Computer Science (Python) Class XII Board Questions Chapter: 1,2 and 3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

The Sovereign School

(Learning unlike Any other)


Subject: Computer Science(Python)
Class XII
BOARD QUESTIONS
Chapter : 1,2 and 3
Question Year
No
1 SQP Which of the following is valid arithmetic operator in Python:
2019 (i) // (ii) ? (iii) < (iv) and

2 SQP Write the type of tokens from the following:


2019 (i) if
(ii) roll_no

3 SQP Name the Python Library modules which need to be imported to invoke the following
2019 functions:
(i) sin() –import math
(ii) (ii) randint ()-import random

4 SQP Rewrite the following code in python after removing all syntax error(s). Underline each
2019 correction done in the code.
30=to to=30
for k in range(0,to) for i in range(0,to):
if k%4==0: if k%4==0:
print (k*4) print(k*4)
else: print (k+3) else:
print(k+3)

5 SQP What do you understand by the term Iteration?


2019

6 SQP Which is the correct form of declaration of dictionary?


2019 (i)Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]

7 SQP Identify the valid declaration of L:


2019 L = [1, 23, ‘hi’, 6]
(i) list (ii) dictionary (iii) array (iv) tuple
8 SQP Find and write the output of the following python code:
2019 x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
This program print the value of a infinitely.

9 SQP Find the invalid identifier from the following


2020 a) MyName
b) True #not a valid identifier
c) 2ndName #not a valid identifier
d) My_Name

10 SQP Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[2:5])


2020
[6,82,5]
11 SQP Identify the valid arithmetic operator in Python from the following.
2020 a) ? b) < c) ** d) and

12 SQP Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is incorrect?
2020 a) print(T[1]) b) T[2] = -29 c) print(max(T)) d) print(len(T))

13 SQP Write a statement in Python to declare a dictionary whose keys are 1, 2, 3 and values are
2020 Monday, Tuesday and Wednesday respectively.

D={1:”Monday”,2:”Tuesday”,3:”Wednesday”}

14 SQP A tuple is declared as T = (2,5,6,9,8) What will be the value of sum(T)?


2020
Sum(T)=30
15 SQP If the following code is executed, what will be the output of the following code?
2020 name="Computer Science with Python"
print(name[3:10])
puter s

16 SQP Evaluate the following expressions:


2020 a) 6 * 3 + 4**2 // 5 – 8 =13.2
b) 10 > 5 and 7 > 12 or not 18 > 3=
t and f or f =false
17 SQP Rewrite the following code in Python after removing all syntax error(s). Underline each
2020 correction done in the code.
Value=30 Value=30
for VAL in range(0,Value) for VAL in range(0,Value):
If val%4==0: If VAL%4==0:
print (VAL*4) Print(VAL*4)
Elseif val%5==0: elif VAL%5==0:
print (VAL+3) print(VAL+3)
else print(VAL+10) else:
print(VAL+10)

18 2019 Write the names of any four data types available in Python.

19 2019 Name the Python Library modules which need to be imported to


invoke the following functions : 1
(i) sqrt()
(ii) start()

20 2019 Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. 2
250 = Number
WHILE Number<=1000:
if Number=>750:
print Number
Number=Number+100
else
print Number*2
Number=Number+50

21 2019 Find and write the output of the following python code : 2
Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0,len(Msg2)+1):
if Msg1[I]>="A" and Msg1[I]<="M":
Msg3=Msg3+Msg1[I]
elif Msg1[I]>="N" and Msg1[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3+"*"
print Msg3

22 2020 Which of the following is not a valid variable name in Python ? Justify reason for it not being a
valid name.
(i) 5Radius (ii) Radius_ (iii) _Radius (iv) Radius

23 2020 Which of the following are keywords in Python ?


(i) break (ii) check (iii) range (iv) while

24 2020 Name the Python Library modules which need to be imported to invoke the following
functions :
(i) cos() (ii) randint()

25 2020 Rewrite the following code in Python after removing all syntax error(s). Underline each
correction done in the code.
input('Enter a word',W)
if W = 'Hello'
print('Ok')
else: print('Not Ok')

26 2020 Write the names of the immutable data objects from the following :
(i) List (ii) Tuple (iii) String (iv) Dictionary

27 2020 Write a Python statement to declare a Dictionary named ClassRoll with Keys as 1, 2, 3 and
corresponding values as 'Reena', 'Rakesh', 'Zareen' respectively.

28 2020 Which of the options out of (i) to (iv) is the correct data type for the variable Vowels as defined
in the following Python statement ?
Vowels = ('A', 'E', 'I', 'O', 'U')
(i) List (ii) Dictionary (iii) Tuple (iv) Array

29 2020 Write the output of the following Python code : 1 for i in range(2,7,2): print(i * '$')

30 2020 Write the output of the following Python code :


def Update(X=10):
X += 15
print('X = ', X)
X=20
Update()
print('X = ', X)

You might also like