
Python Revision

Quiz
•
Computers
•
University
•
Medium

ncz9hjmftz apple_user
Used 1+ times
FREE Resource
16 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is a lambda function in Python?
A lambda function in Python is a small anonymous function defined using the lambda keyword. It can take any number of arguments, but can only have one expression.
A lambda function in Python is a function that requires a return statement
A lambda function in Python is a function that can only take one argument
A lambda function in Python is a built-in function that performs mathematical operations
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you add a key-value pair to a dictionary in Python?
dictionary_name[key] = value
dictionary_name.update(key, value)
dictionary_name[key] += value
dictionary_name.add(key, value)
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the difference between append() and extend() methods in Python lists?
append() adds multiple elements, extend() adds a single element
append() and extend() are the same method with different names
append() and extend() are used for removing elements from a list
append() adds a single element, extend() adds multiple elements
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What are *args and **kwargs in Python functions?
*args and **kwargs are interchangeable and can be used interchangeably in Python functions.
*args and **kwargs are reserved keywords in Python that cannot be used in functions.
*args are used for keyword arguments, and **kwargs are used for non-keyword arguments in Python functions.
*args are used for non-keyword arguments, and **kwargs are used for keyword arguments in Python functions.
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Write a Python function to find the sum of all elements in a list using recursion.
def sum_list(lst): if len(lst) == 0: return 0 else: return lst[0] + sum_list(lst[1:])
def sum_list(lst): return lst[0] + sum_list(lst[1:])
def sum_list(lst): return lst[0] + sum_list(lst)
def sum_list(lst): return lst[0] + sum_list(lst[:-1])
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you remove a key from a dictionary in Python?
dictionary.pop(key)
dictionary.remove(key)
dictionary.clear(key)
dictionary.delete(key)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main difference between the pop() and clear() methods in Python lists?
pop() method removes the last element of a list, while clear() method removes all elements from a list.
pop() method removes the first element of a list, while clear() method removes the last element from a list.
pop() method removes an element at a specified index, while clear() method removes all occurrences of a specified value.
pop() method removes all elements from a list, while clear() method removes the last element of a list.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Основы Python: Условия и Циклы

Quiz
•
University
13 questions
HTML beginners quiz

Quiz
•
9th Grade - Professio...
15 questions
SCRIPTING PROGRAMMING WITH PYTHON

Quiz
•
University
15 questions
Python функциялары 7 сынып

Quiz
•
12th Grade - University
20 questions
1212 Midterm Review

Quiz
•
University
20 questions
CETA'S Quizzard

Quiz
•
University
20 questions
GirlsWhoML Workshop 0

Quiz
•
University
20 questions
Python basics

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University