Fun with Python

Fun with Python

Test your knowledge about Python programming language with this fun quiz!

published on January 020 responses 0
Next »
1/12

Which of the following is NOT a Python data type?

Which of the following is NOT a Python data type?
Integer
String
Boolean
Object
2/12

What is used to define a block of code in Python?

What is used to define a block of code in Python?
Brackets
Curly braces
Indentation
Semicolons
3/12

Which of the following is a Python keyword to define a function?

Which of the following is a Python keyword to define a function?
create
define
function
def
4/12

What is the output of the following code?
print(3 + 5 * 2)

What is the output of the following code? print(3 + 5 * 2)
16
13
11
9
5/12

Which of the following is used to comment a single-line in Python?

Which of the following is used to comment a single-line in Python?
//
#
--
-->
6/12

What will the following code print?
print('Hello' + 'World')

What will the following code print? print('Hello' + 'World')
HelloWorld
Hello World
'Hello' 'World'
Hello, World
7/12

Which module is used for working with regular expressions in Python?

Which module is used for working with regular expressions in Python?
re
regex
regexp
regexpy
8/12

What is the output of the following code?
print(len('Python'))

What is the output of the following code? print(len('Python'))
5
6
7
8
9/12

Which of the following is used to open a file in Python?

open()
file()
start()
read()
10/12

What does the 'else' clause do in a Python 'if' statement?

What does the 'else' clause do in a Python 'if' statement?
It specifies the condition to be checked
It is executed if the condition is true
It is executed if the condition is false
It is executed regardless of the condition
11/12

What is the correct way to create a dictionary in Python?

What is the correct way to create a dictionary in Python?
dict = {1: 'apple', 2: 'banana'}
dict = [1=['apple'], 2=['banana']}
dict = (1='apple', 2='banana')
dict = {1, 'apple', 2, 'banana'}
12/12

Which of the following is used to convert a string to uppercase in Python?

Which of the following is used to convert a string to uppercase in Python?
to_upper()
upper()
uppercase()
convert_up()