
Python Quiz
Quiz
•
Information Technology (IT)
•
University
•
Hard
Ms.ROOP R
Used 1+ times
FREE Resource
23 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the primary advantage of using list comprehensions in Python?
Slower execution time
More readable and concise code
Uses more memory
Requires additional libraries
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax for a list comprehension that squares numbers from 1 to 5?
[x^2 for x in range(1,6)]
[x**2 for x in range(1,6)]
{x**2 for x in range(1,6)}
(x**2 for x in range(1,6))
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a lambda function in Python?
A function with a name
A function that can have multiple statements
An anonymous function defined using the lambda keyword
A function that must return a list
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you define a lambda function that returns the sum of two numbers?
lambda x, y: return x + y
lambda x, y: x + y
def lambda(x, y): return x + y
lambda (x, y): x + y
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a Python decorator?
To modify the behavior of a function without changing its code
To convert a function into a lambda function
To create a new function from scratch
To execute functions in reverse order
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following decorator code?
Prints only "Hello!"
Throws an error
Prints "Before function call", "Hello!", "After function call"
Prints "Hello!" followed by "Before function call"
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about iterators in Python is TRUE?
Iterators do not support the __next__() method
Iterators can only be used once
Iterators require an index to retrieve values
Iterators are only applicable to dictionaries
Create a free account and access millions of resources
Similar Resources on Wayground
21 questions
SAA-C03 (95-116)
Quiz
•
University
18 questions
SDC_SAP_C02-Part02 (19-36)
Quiz
•
University
20 questions
2F-1 | Python Quiz | 14/10/2024
Quiz
•
University
25 questions
PPL (Quiz 5) Procedures and Functions
Quiz
•
University
18 questions
Python Library Routines Quiz
Quiz
•
10th Grade - University
20 questions
Python
Quiz
•
University
20 questions
H0 - 06 Define la librería Scikit-Learn y Pytorch
Quiz
•
University
25 questions
G9-Introduction to Python Programming
Quiz
•
9th Grade - 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
Discover more resources for Information Technology (IT)
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms
Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors
Interactive video
•
4th Grade - University
15 questions
Properties of Equality
Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*
Quiz
•
10th Grade - University
21 questions
Advise vs. Advice
Quiz
•
6th Grade - University
12 questions
Reading a ruler!
Quiz
•
9th Grade - University
