WorksheetsPython Programming Fundamentals - Multiple Choice Questions
Total questions: 25
Worksheet time: 4mins
Python is a ______ language.
High-level
Low-level
Assembly-level
Machine-level
Who developed Python programming language?
James Gosling
Guido van Rossum
Dennis Ritchie
Bjarne Stroustrup
Which of the following is the correct extension of Python files?
.p
.py
.pt
.pyt
What does indentation in Python signify?
End of statement
Start of a comment
Grouping of statements
Denotes error
Which of the following is a valid variable name in Python?
2num
num_2
num-2
@num
What is the output of the following code? x = 5 y = '5' print(x + int(y))
55
10
Error
5
Which symbol is used to start a comment in Python?
//
/* */
#
Which of the following data types is immutable?
List
Dictionary
Tuple
Set
What is the data type of the following? x = 3.14
int
float
str
complex
What is the output of this code? print('Hello' + ' World')
Hello World
HelloWorld
Hello+World
Error
Which function is used to take input from the user in Python?
get()
input()
scan()
enter()
What is the result of this code? x = 10 y = 3 print(x // y)
3.33
3
10.0
3.0
Which operator is used for exponentiation in Python?
**
%
//
What will this code display? x = 5 x += 3 print(x)
5
3
8
Error
Which keyword is used to define a function in Python?
function
define
def
fun
Which of these is NOT a core data type in Python?
Lists
Tuples
Class
Dictionary
Which function gives the data type of a variable?
datatype()
typeof()
type()
gettype()
What is the output of this code? print(2 * 'Hi')
HiHi
2Hi
Hi*Hi
Error
Which logical operator returns True if both operands are True?
or
not
and
nor
What is the output of this code? for i in range(3): print(i)
1 2 3
0 1 2
0 1 2 3
1 2
Which keyword is used to skip the current iteration in a loop?
break
stop
continue
pass
What is the output of this statement? print(type((1, 2, 3)))
What will this program output? def add(a, b): return a + b print(add(2, 3))
23
5
2+3
Error
Which of the following statements is TRUE about Python?
Python is compiled only
Python is interpreted only
Python is both compiled and interpreted
Python is low-level
Which of the following is used to represent a block of code with no action?
break
continue
pass
skip
