WorksheetsPython Revision Tour
Total questions: 30
Worksheet time: 10mins
Choose the INVALID identifiers from the following
NUmbEr1
1NUMBer
A_B
A&B
________ are data items that have a fixed value
Tokens
Literals
Keyword
Operators
What is the answer to this expression, 22 % 3 is?
7
1
0
5
Which of the following cannot be a variable?
_init_
in
it
on
Which data type can store unique values?
List
Tuple
Set
Dictionar
print("Hello world!\nHello world!")
Hello world!
num1= 10
num2 = 30
(num1<num2) or (num2<0)
true
false
nothing
Which of these collections defines a DICTIONARY?
{"name": "apple", "color": "green"}
{"apple", "banana", "cherry"}
["apple", "banana", "cherry"]
("apple", "banana", "cherry")
Which statement is used to stop a loop?
exit
break
return
stop
Identify Mutable Data Types
LIST
TUPLE
STRING
DICTIONARY
Which is the correct version of while statement in python??
a
b
c
d
What would be the output of the following code
a
b
c
d
What would be the output of following code
a
b
c
d
consider the following code and find the output
5
6
56
None
Which part contains error
a
b
c
a and b
If you want to write code to check whether the given no. is divisible by 3. what condition will you write with if ( ) in the code written below
n/30==0
n//10==3
n/3==0
n%3==0
If you want to write code to check whether the given no. is divisible by 3. what condition will you write with if ( ) in the code written below
n/30==0
n//10==3
n/3==0
n%3==0
Identify the suitable construct to make the following Program
if
for
if...elif
Identify the type of structure in the following code snippet
if else
if else if
nested if else
'Classroom Diary' or "Python" will produce result
True
False
Classroom Diary
Python
not ( "Learn Python" and 2<3 ) will produce result
True
False
" "
Learn Python
In the expression x= 5/2 .....Data type of x is
int
float
bool
list
Data type of "TRUE" is
int
float
string
bool
Consider a tuple tup1 = (10, 15, 25, and 30). Identify the statement that will result in an error.
print(tup1[2])
tup1[2] = 20
print(min(tup1))
print(len(tup1))
Which of these about a dictionary is false?
The values of a dictionary can be accessed using keys
The keys of a dictionary can be accessed using values
Dictionaries aren’t ordered
Dictionaries are mutable
Identify the output of the following Python statements.
x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2]
print(y)
12.0
13.0
14.0
15.0
Identify the output of the following Python statements.
x = 2
while x < 9:
print(x, end='')
x = x + 1
12345678
123456789
2345678
23456789
Suppose list1 [0.5 * x for x in range(0, 4)], list1 is ?
[0, 1, 2, 3, 4]
[0, 1, 2, 3]
[0.0, 0.5, 1.0, 1.5]
[0.0, 0.5, 1.0, 1.5, 20]
What will be the output when the following code is executed?
>>> str1="helloworld"
>>> stri[:-1]
dlrowolleh
helloworld
hello
world
