[go: up one dir, main page]

0% found this document useful (0 votes)
127 views5 pages

Python Revision Questions 1mark Kvpanchgram

Uploaded by

ram Dindu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views5 pages

Python Revision Questions 1mark Kvpanchgram

Uploaded by

ram Dindu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

KENDRIYA VIDYALAYA PANCHGRAM

XII (CS) - PRACTICE TEST (PYTHON REVISION)

Each Question carry 1 mark.


1 Which of the following is not a valid identifier name in Python? Justify reason for it not being a valid
name.
a) 5Total b) _Radius c) pie d)While
2 Find the invalid identifier from the following
a) def b) For c)_bonus d)First_Name
3 Find the output -
>>>A = [17, 24, 15, 30]
>>>A.insert( 2, 33)
>>>print ( A [-4])
4 Name the Python Library modules which need to be imported to invoke the
following functions:
(i) ceil() (ii) randrange()
5 Which of the following are valid operator in Python:
(i) */ (ii) is (iii) ^ (iv) like
6 Which of the following statements will create a tuple ?
(a) Tp1 = (“a”, “b”)
(b) Tp1= (3) * 3
(c) Tp1[2] = (“a”, “b”)
(d) None of these
7 What will be the result of the following code?
>>>d1 = {“abc” : 5, “def” : 6, “ghi” : 7}
>>>print (d1[0])
(a) abc (b) 5 (c) {“abc”:5} (d) Error
8 Find the output of the following:
>>>S = 1, (2,3,4), 5, (6,7)
>>> len(S)
9 Which of the following are Keywords in Python ?
(i) break (ii) check (iii) range (iv) while
10 Which of the following statement create a dictionary?
a) d = { }
b) d = {“john”:40, “peter”:45}
c) d = (40 : “john”, 45 : “peter”}
d) d = All of the mentioned above
11 Find the output of the following:
>>>Name = “Python Examination”
>>>print (Name [ : 8 : -1])
12 Given the lists Lst=[„C‟,‟O‟,‟M‟,‟P‟,‟U‟,‟T‟,‟E‟,‟R‟] , write the output of:
print(Lst[3:6])
13 What will be the output of following program:
a='hello'
b='virat'
for i in range(len(a)):
print(a[i],b[i])
14 Give Output:
colors=["violet", "indigo", "blue", "green", "yellow", "orange", "red"]
del colors[4]
colors.remove("blue")
colors.pop(3)
print(colors)
15 Which statement is correct for dictionary?
(i) A dictionary is a ordered set of key:value pair
(ii) each of the keys within a dictionary must be unique
(iii) each of the values in the dictionary must be unique
(iv) values in the dictionary are immutable
16 Identify the valid declaration of Rec:
Rec=(1,‟Vikrant,50000)
(i)List (ii)Tuple (iii)String (iv)Dictionary
17 Identify the valid statement for list L=[1,2,”a”]:
(i) L.remove("2")
(ii) L.del(2)
(iii) del L[2]
(iv) del L[“a”]
18 Find and write the output of the following python code:
x = "Python"
print(x[ : :-1])
print(x)
19 Which of the following is valid arithmetic operator in Python:
(i) // (ii)? (iii) < (iv) and
20 Namethe PythonLibrarymoduleswhichneedto be imported to invokethe
following functions:
(i) sin( ) (ii) randint ( )
21 Which is the correct form of declaration of dictionary?
(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‟]
22 If the following code is executed, what will be the output of the following code?
name="Computer Science with Python"
print(name[2:10])
23 Find the invalid identifier from the following
a) Subtotal b) assert c) temp_calc d) Name2
24 Given the list Lst = [ 12, 34, 4, 56, 78, 22, 78, 89], find the output of
print(Lst[1:6:2])
25 Which operator is used for replication?
a) + b) % c) * d) //
26 Give the output of the following code:
L = [ 1,2,3,4,5,6,7]
B=L
B[3:5] = 90,34
print(L)
27 What is the value of the expression
4+4.00, 2**4.0
28 A tuple is declared as T = (1,2), (1,2,4), (5,3)
What will be the value of min(T) ?
29 Which of the following functions generates an integer?
a) uniform( ) b) randint( ) c) random( ) d) None of the above
30 What is the output of the following code:
for i in range(-3,4,2):
print(i, end = '$')
31 Identify the invalid keyword in Python from the following:
(a) True (b) None (c) Import (d) return
32 Write the output of the following python expression:

33 Find the operator which cannot be used with a string in Python from the
following:
(a) + (b) in (c) * (d) //
34 Write the output of the following python statements:
35 Consider the tuple in python named DAYS=(”SUN”,”MON”,”TUES”). 1
Page No. 2
Identify the invalid statement(s) from the given below statements:
1. S=DAYS[1]
2. print(DAYS[2])
3. DAYS[0]=”WED”
4. LIST=list(DAYS)
36 Declare a dictionary in python named QUAD having Keys(1,2,3,4) and
Values(“India”,”USA”,”Japan”,”Australia”)
37 Identify the output of the following python statements if there is no
error. Otherwise, identify the error(s):

38 List one common property of a String and a Tuple.


39 Write the full form of IDLE.
40 Identify the valid logical operator in Python from the following.
a) ? b) < c) ** d) and
41 Suppose a tuple Tup is declared as Tup = (12, 15, 63, 80),
which of the following is incorrect?
a) print(Tup[1])
b) Tup[2] = 90
c) print(min(Tup))
d) print(len(Tup))
42 Write a statement in Python to declare a dictionary whose keys are 1,2,3 and values are Apple, Mango
and Banana respectively.
43 A tuple is declared as T = (2,5,6,9,8) 1
Page 2 of 6
What will be the value of sum(T)?
44 Name the built-in mathematical function / method that is used to return square root of a number.
45 Identify the valid declaration of P:
P= [‘Jan’, 31, ‘Feb’, 28]
a. dictionary b. string c.tuple d. list
46 If the following code is executed, what will be the output of the following code?
str="KendriyaVidyalayaSangathan"
print(str[8:16])
47 Can List be used as keys of a dictionary?
48 Which one is valid relational operator in Python
i. /
ii. =
iii. = =
iv. and
49 Which of the following can be used as valid variable identifiers in Python?
i) 4th Sum
ii) Total
iii) Number#
iv) _Data
50 Identify the mutable data types?
(i) List
(ii) Tuple
(iii) Dictionary
(iv) String
51 What is the length of the tuple shown below?
t=(((('a',1),'b','c'),'d',2),'e',3)
52 Name the python library need to be imported to invoke following function
i. sqrt()
ii. randint()
53 t1=(2,3,4,5,6)
print(t1.index(4))
output is
i. 4
ii. 5
iii. 6
iv. 2
55 Given
employee={'salary':10000,'age':22,'name':'Mahesh'}
employee.pop('age')
what is output
print(employee)
54 Which of the following are valid operators in Python:
(i) ** (ii) between (iii) like (iv) ||
55 Given the lists L=[“H”, “T”, “W”, “P”, “N”] , write the output of
print(L[3:4])
56 What will be the output of:
print(10>20)
57 Suppose a tuple T is declared as T = (10, 20, 30, 40), what will be
the output of print(T*2)
58 Write the ouput of following code:
d={'amit':19,'vishal':20}
print(d.keys())
59 A tuple is declared as T = (20,5,16,29,83) What will be the
problem with the code T[1]=100.
60 Name the built-in mathematical function / method that is used to
return greatest common divisor of x and y.
61 Identify the data type of X:
X = tuple(list( (1,2,3,4,5) ) )
Dictionary (b) string (c) tuple (d) list
62 Write the output of following code
t1 = [10, 12, 43, 39]
print(t1*3)
63 Find the invalid identifier from the following
a) yourName b) _false c) 2My_Name d) My_Name
64 Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[1:6])
65 Which of the following is a valid assignment operator in Python ?
a) ? b) < c) =* d) and e) //
66 Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is
incorrect?
a) print(T[1])
b) T[3] = 9
c) print(max(T))
d) print(len(T))
67 Write a statement in Python to declare a dictionary whose keys are 1, 2, 3
and values are Monday, Tuesday and Wednesday respectively.
68 A tuple is declared as
T = (2,5,6,9,8)
What will be the value of sum(T)?
69 Name the built-in mathematical function / method that is used to return an
absolute value of a number
70 Identify the valid declaration of L:
L = [„Mon‟, „23‟, „hello‟, ‟60.5‟]
a. dictionary b. string c.tuple d. list
71 If the following code is executed, what will be the output of the following
code?
name="ComputerSciencewithPython"
print(name[3:10])

You might also like