
Python Programming Quiz

Quiz
•
Computers
•
12th Grade
•
Hard
Janaki Sivakumar
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax to create a function in Python?
function myFunction():
def myFunction[]:
def myFunction():
create function myFunction():
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = [1, 2, 3] print(x * 2)
[1, 2, 3, 1, 2, 3]
[2, 4, 6]
[[1, 2, 3], [1, 2, 3]]
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to read a file in Python?
file = open("filename.txt", "r")
file = open("filename.txt")
file = open("filename.txt", "read")
file = open("filename.txt", "w")
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? my_list = [2, 4, 6, 8] my_list.append(10) print(my_list)
[2, 4, 6, 8]
[2, 4, 6, 8, 10]
[10, 2, 4, 6, 8]
None of the above
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following data structures does Python's set type represent?
Ordered collection of unique elements
Unordered collection of unique elements
Ordered collection with duplicate elements
Unordered collection with duplicate elements
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a list and a tuple in Python?
Lists are immutable, tuples are mutable
Tuples are immutable, lists are mutable
Lists are faster to iterate over
Tuples allow duplicate values while lists do not
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? x = 5 y = 10 x, y = y, x print(x, y)
5 10
10 5
None None
Error
Create a free account and access millions of resources
Similar Resources on Wayground
5 questions
How HTML works

Quiz
•
11th - 12th Grade
15 questions
Python. GuiZero

Quiz
•
7th - 12th Grade
10 questions
File Type Extensions

Quiz
•
8th Grade - University
15 questions
SOM - Comandos LINUX

Quiz
•
9th Grade - University
12 questions
Coding and Robotics

Quiz
•
8th - 12th Grade
15 questions
Знакомство с IDLE 6 класс

Quiz
•
6th Grade - University
12 questions
Uji Pengetahuan Sistem Operasi Linux

Quiz
•
9th - 12th Grade
6 questions
Python Training Module Quiz

Quiz
•
KG - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade