Font size
WorksheetsPython Programming Quiz
Total questions: 28
Worksheet time: 18mins
What is your name
What is the correct way to create a variable in Python?
let x = 5
int x = 5
x = 5
x := 5
What will this code output?
Hello World
Hello+World
HelloWorld
Hello World (with space)
What type of data is stored in this variable: x = "ICT"?
Integer
Boolean
String
Float
What symbol is used to take user input in Python?
read()
scan()
input()
enter()
Which of these is a Python keyword?
var
function
if
define
What does the following code output?
print(10 // 3)
3.33
3
4
0
What is the result of 5 ** 2 in Python?
10
25
7
2.5
How do you write a comment in Python?
-- this is a comment
# this is a comment
// this is a comment
/* this is a comment */
Which of the following is a correct if statement?
if x == 5:
if (x = 5)
if x = 5:
if x equals 5
Which data type would be used to store True or False?
Integer
Float
Boolean
String
What function is used to display output in Python?
write()
echo()
print()
say()
What will be the value of y in this code?
x = 3
y = x + 2
3
2
5
x + 2
Which of the following is a correct way to get input from a user and store it in a variable?
name == input("Enter your name: ")
input name = "Enter your name"
name = input("Enter your name: ")
input(name) = "Enter your name"
What will the following code output?
print("5" + "6")
11
56
Error
5 + 6
What is the correct way to convert a string "8" to an integer in Python?
int("8")
str(8)
float("8")
8 = int
Who created the Python programming language?
Dennis Ritchie
Guido van Rossum
James Gosling
Elon Musk
In which year was Python first released?
1980
1991
2000
2010
Why is Python considered a beginner-friendly programming language?
It uses a lot of symbols
It is hard to install
It has simple and readable syntax
It requires complex setup
Which of the following is a common use of Python?
Web design only
Data science and web development
Video editing
Text messaging
What is one benefit of using Python?
It's only for experts
It's expensive to use
It works on many platforms and is free
It is used only for games
What is IDLE in full
(a)
\n creates a line return in a string of text
\t creates a new line
\\ allows a backslash to appear in a string of text
\" allows a speech mark to be used in a string of text
Name this mathematical operator *
(a)
Which of the following is correct
== equal to
> less than
!= not equal to
>= greater than or equal to
