WorksheetsPython Worksheet MCQs
Total questions: 35
Worksheet time: 18mins
Who developed the Python programming language?
Wick van Rossum
Rasmus Lerdorf
Guido van Rossum
Niene Stom
Which type of programming does Python support?
Object-oriented
Structured
Functional
All of the mentioned
Is Python case sensitive when dealing with identifiers?
No
Yes
Machine dependent
None
Which of the following is the correct extension of a Python file?
.python
.pl
.py
.p
Is Python code compiled or interpreted?
Both compiled and interpreted
Neither compiled nor interpreted
Only compiled
Only interpreted
All keywords in Python are in ________
Capitalized
Lower case
UPPER CASE
None of the mentioned
What will be the output of print(4 + 3 % 5)?
7
2
4
1
Which of the following is used to define a block of code in Python?
Indentation
Key
Brackets
All of the mentioned
Which keyword is used for a function in Python?
Function
def
Fun
Define
Which character is used for single-line comments in Python?
//
#
!
/*
What will be the output of the given while loop code with i += 1?
1 2 3
SyntaxError
1 2
None
Which of the following functions shows the Python version?
sys.version(1)
sys.version(0)
sys.version()
sys.version
Python supports creation of anonymous functions using ________
pi
anonymous
lambda
none
What is the order of precedence in Python?
Exp, Par, Mult, Div, Add, Sub
Exp, Par, Div, Mult, Add, Sub
Par, Exp, Mult, Add, Div, Sub
Par, Exp, Mult, Div, Add, Sub
What does pip stand for in Python?
Pip Installs Python
Pip Installs Packages
Preferred Installer Program
All of the mentioned
Which of the following is true for Python variable names?
Only underscore & ampersand allowed
Unlimited length
All private members have leading & trailing underscores
None
What are the values of print(2**(3**2)), print((2**3)**2)?
512, 64
512, 512
64, 512
64, 64
Which of these is the truncation division operator?
|
//
/
%
Output of list(filter(bool, [1,0,2,0,'hello','', []]))?
[1,0,2,'hello','', []]
Error
[1,2,'hello']
[1,0,2,0,'hello','', []]
Which is a built-in function in Python?
factorial()
print()
seed()
sqrt()
What is the use of id() in Python?
Object doesn’t have unique id
Returns object identity
All of the mentioned
None
The given decorator function can work with _____ parameters.
Any number of
0
1
2
Which is not a core data type in Python?
Tuples
Lists
Class
Dictionary
Which is the definition of packages in Python?
A set of main modules
A folder of Python modules
Many Python files
Programs using modules
What is the output of len(["hello",2,4,6])?
Error
6
4
3
What will be the output of the loop printing .upper() for 'abcd'?
A B C D
a b c d
error
ABCD
What is the namespace lookup order in Python?
Built-in → Global → Local
Built-in → Local → Global
Local → Global → Built-in
Global → Local → Built-in
What does this print: for i in [1,2,3,4][::-1]?
4 3 2 1
error
1 2 3 4
none
What will be printed by print("a"+"bc")?
bc
abc
a
bca
Which function is called when using format(f)?
str()
format()
str()
format()
Which of the following is NOT a keyword in Python?
pass
eval
assert
nonlocal
What will be printed by the tester class snippet?
12
224
None
Error
What will be output of comparing id(q) == foo(q) where foo modifies list?
Error
None
False
Which arithmetic operator cannot be used with strings?
*
-
+
All of the mentioned
Output of print("abc. DEF".capitalize())?
Abc. def
abc. def
Abc. Def
ABC. DEF
