
Python Operators, For and While Loops, Lists, Sets, Dictionaries

Quiz
•
Computers
•
12th Grade
•
Medium
Aagya Sharma
Used 2+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the symbol used for exponentiation in Python?
**
^^
//
^
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a list and a set in Python?
A list allows duplicates and is unordered, while a set does not allow duplicates and is ordered.
A list does not allow duplicates and is ordered, while a set allows duplicates and is unordered.
A list allows duplicates and is ordered, while a set does not allow duplicates and is unordered.
A list allows duplicates and is unordered, while a set allows duplicates and is ordered.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you access a value in a dictionary in Python?
dictionary_name.value
dictionary_name.get(key)
dictionary_name[value]
dictionary_name[key]
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the syntax for creating a tuple in Python?
my_tuple = (1, 2, 3)
my_tuple = {1, 2, 3}
my_tuple = (1, 2, 3,)
my_tuple = [1, 2, 3]
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the 'in' operator used for in Python?
Used to format text output in Python
Used to check if a specified element is present in a sequence.
Used to calculate mathematical operations
Used to define functions in Python
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you iterate over a list in Python using a for loop?
for item in my_list:
for i in range(len(my_list)):
for index, value in enumerate(my_list):
for element in my_list:
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a while loop in Python?
To terminate the program
To execute a block of code only once
To repeatedly execute a block of code as long as a specified condition is true.
To skip a block of code
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you add an element to a set in Python?
set_name.add(element)
set_name.append(element)
set_name.insert(element)
set_name.update(element)
9.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between a tuple and a list in Python?
Tuples can contain duplicate elements, while lists cannot.
Tuples can be resized dynamically, while lists have a fixed size.
Tuples are mutable and defined using parentheses, while lists are immutable and defined using square brackets.
Tuples are immutable and defined using parentheses, while lists are mutable and defined using square brackets.
Similar Resources on Wayground
10 questions
MySQL

Quiz
•
12th Grade
12 questions
12cs cha9

Quiz
•
12th Grade
7 questions
Python-list,tuple,Dictionary

Quiz
•
11th - 12th Grade
10 questions
AL-(S)

Quiz
•
12th Grade
10 questions
Python Revision Tour

Quiz
•
12th Grade
10 questions
Python Generators

Quiz
•
10th Grade - University
10 questions
Day 4

Quiz
•
12th Grade - University
10 questions
U1_AI-B_Formativo

Quiz
•
12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade