Font size
WorksheetsPython Programming Basics 1
Total questions: 25
Worksheet time: 14mins
Is Python case sensitive when dealing with identifiers?
Yes
No
Machine Dependent
None of the mentioned
What is the maximum possible length of an identifier?
31 characters
63 characters
79 characters
None of the mentioned
Which of the following is an invalid variable?
my_string_1
1st_string
foo
_
Which of the following is not a keyword?
assert
eval
nonlocal
pass
Which of the following cannot be a variable?
__init__
in
it
on
Consider the code:
a=21; b=6
print(a/b); print(a//b); print(a%b)
What is the result?
3.0
3
3
3
3
3
3.5
3
3
3.5
3.5
3
Consider the code and What is the result?
s='AB CD'
list=list(s)
list.append('EF')
print(list)
('A','B',' ','C','D','EF')
['A','B','C','D','E','F']
{'A','B',' ','C','D','EF'}
['A','B',' ','C','D','EF']
Which is the correct operator for power(xy)?
x^y
x**y
x^^y
None of the above
Which one of these is floor division?
/
//
\
\\
What is the order of precedence in python?
i) Parentheses, ii) Exponential
iii) Multiplication, iv) Division
v) Addition, vi) Subtraction
i,ii,iii,iv,vi,v
ii,i,iv,iii,v,vi
ii,i,iii,iv,v,vi
i,ii,iii,iv,v,vi
Operators with the same precedence are evaluated in which manner?
Left to Right
Right to Left
Can’t say
None of the mentioned
What is the output of this expression, 3*1**3?
27
9
3
313
The expression int(x) implies that the variable x is converted to integer. State whether true or false.
True
False
Which one of the following have the highest precedence in the expression?
Exponential
Addition
Parentheses
Multiplication
Exponent operator ** has (a) associativity in Python.
Which of these in not a core data type?
Lists
Dictionary
Tuples
Class
Given a function that does not return any value, what value is thrown by default when executed in shell.
int
bool
void
None
Following set of commands are executed in shell, what will be the output?
>>>str="hello"
>>>str[:2]
he
lo
olleh
hello
What is the return type of function id?
bool
dict
int
float
What error occurs when you execute?
apple = mango
SyntaxError
ValueError
TypeError
NameError
IndentationError
cannot perform mathematical operation on string's.
hello2
hello2hello2
What is the mutable object given below?
dict
str
list
tuple
In order to store values in terms of key and value we use what core data type.
list
tuple
set
dict
Option A
Option B
Option C
Option D
What is the average value of the code that is executed below ?
>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2
85
85.0
85.1
90.0
