Python Programming

Quiz
•
•
Hard
nithish singh
Used 1+ times
FREE Resource
Student preview

20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a correct syntax to output "Hello World" in Python?
display('Hello World')
console.log('Hello World')
output('Hello World')
print('Hello World')
Answer explanation
The correct syntax to output 'Hello World' in Python is print('Hello World'). This statement will display the text 'Hello World' on the console.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a function in Python?
def function_name():
function function_name{}
function_name[]:
function_name(){}
Answer explanation
To create a function in Python, use the 'def' keyword followed by the function name and parentheses. The correct choice is 'def function_name():'.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a list in Python?
list = [1, 2, 3]
list: 1, 2, 3
list(1, 2, 3)
list = 1, 2, 3
Answer explanation
To create a list in Python, use the syntax list = [1, 2, 3]. This correctly initializes a list with the values 1, 2, and 3.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a dictionary in Python?
dict = {1:'a', 2:'b', 3:'c'}
dict: 1='a', 2='b', 3='c'
dict(1='a', 2='b', 3='c')
dict = 1='a', 2='b', 3='c'
Answer explanation
To create a dictionary in Python, use the syntax dict = {1:'a', 2:'b', 3:'c'}. This assigns key-value pairs to the dictionary.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a tuple in Python?
tuple = (1, 2, 3)
tuple: 1, 2, 3
tuple(1, 2, 3)
tuple = 1, 2, 3
Answer explanation
To create a tuple in Python, use the syntax tuple = (1, 2, 3). This choice correctly assigns the values 1, 2, and 3 to the tuple variable.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you create a set in Python?
set = {1, 2, 3}
set: 1, 2, 3
set(1, 2, 3)
set = 1, 2, 3
Answer explanation
To create a set in Python, use the syntax: set = {1, 2, 3}. This correctly initializes a set with the values 1, 2, and 3.
Create a free account and access millions of resources
Popular Resources on Wayground
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade
Discover more resources for
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
10 questions
"LAST STOP ON MARKET STREET" Vocabulary Quiz

Quiz
•
3rd Grade
19 questions
Fractions to Decimals and Decimals to Fractions

Quiz
•
6th Grade
16 questions
Logic and Venn Diagrams

Quiz
•
12th Grade
15 questions
Compare and Order Decimals

Quiz
•
4th - 5th Grade
20 questions
Simplifying Fractions

Quiz
•
6th Grade
20 questions
Multiplication facts 1-12

Quiz
•
2nd - 3rd Grade