WorksheetsPython Programming Quiz
Total questions: 19
Worksheet time: 38mins
What is the standard file extension for a Python source file?
.pt
.py
.python
.p
Which statement about Python is true?
Python code must always be compiled before it can run.
Python can only be used on Linux systems.
Python is an interpreted, high-level programming language.
Python cannot work with text data.
Which function is used to display text on the screen in Python?
echo()
out()
print()
show()
What is the result of the expression 3 + 4 * 2 in Python?
14
11
7
3
Which of the following is an integer (int) value in Python?
"5"
5.0
5
True
How does a single-line comment start in Python?
//
/*
#
--
Which line shows a correct assignment statement?
x == 5
5 = x
x = 5
int x = 5
Which of the following is a list in Python?
{1, 2, 3}
[1, 2, 3]
(1, 2, 3)
"1, 2, 3"
What is the value of len("python")?
5
6
7
It causes an error.
Which operator is used for the remainder (modulo) operation?
//
**
%
#
What sequence of numbers is produced by range(3)?
1, 2, 3
0, 1, 2
0, 1, 2, 3
1, 2
Which keyword is used to define a function in Python?
func
define
def
function
Which of the following is a Boolean value?
"True"
1
True
"False"
In the line if x > 0:, what is x > 0 called?
a block
a condition
a loop
a function
How many times does the loop run? for i in range(5): print(i)
4 times
5 times
6 times
It runs forever.
Which of the following is a dictionary (dict) in Python?
[1, 2, 3]
("name", "Ali")
{"name": "Ali", "age": 15}
{"Ali", "Veli"}
What is the type of the value returned by type(3.5)?
int
float
str
bool
What is the output of "python".upper()?
python
PYTHON
Python
It causes an error.
Which list method removes the last element from a list?
remove()
delete()
pop()
cut()
