Higher Order Functiond and Regex

Higher Order Functiond and Regex

12th Grade

15 Qs

quiz-placeholder

Similar activities

python quiz

python quiz

12th Grade

20 Qs

12CS (1-5)

12CS (1-5)

12th Grade

20 Qs

Python Lambda Functions

Python Lambda Functions

12th Grade

14 Qs

Python Functions and Error Handling

Python Functions and Error Handling

10th Grade - University

20 Qs

AP CSP - Python Lists and Arrays

AP CSP - Python Lists and Arrays

9th - 12th Grade

10 Qs

Strings, Lists & Tuples

Strings, Lists & Tuples

9th - 12th Grade

20 Qs

Python lists and tuples

Python lists and tuples

12th Grade

10 Qs

Python List Basics

Python List Basics

12th Grade

14 Qs

Higher Order Functiond and Regex

Higher Order Functiond and Regex

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Dhana Lakshmi

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a lambda function in Python?

A lambda function is an anonymous function defined with the lambda keyword, allowing for quick, inline function definitions.

A lambda function is a method for defining classes in Python.

A lambda function is a built-in Python library for data analysis.

A lambda function is a type of variable in Python.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a lambda function that adds two numbers?

lambda x, y: x - y

lambda a, b: a * b

lambda num1, num2: num1 / num2

lambda x, y: x + y

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the map() function in Python?

The purpose of the map() function in Python is to apply a function to every item in an iterable and return an iterator of the results.

To filter items from an iterable

To sort items in an iterable

To create a new list from an existing list

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How does the filter() function work in Python?

filter() modifies the original iterable by removing elements.

filter() filters elements from an iterable based on a function that returns True or False.

filter() sorts elements in an iterable based on their values.

filter() creates a new iterable without any conditions.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the reduce() function do in Python?

The reduce() function reduces an iterable to a single value by applying a function cumulatively.

The reduce() function filters elements from an iterable based on a condition.

The reduce() function sorts an iterable in ascending order.

The reduce() function splits an iterable into multiple values.

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Can you provide an example of using map() with a lambda function?

list(map(lambda x: x-1, range(5))

list(map(lambda x: x+1, [1, 2, 3, 4]))

map(lambda x: x*2, [1, 2, 3])

list(map(lambda x: x**2, [1, 2, 3, 4]))

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code: list(map(lambda x: x**2, [1, 2, 3, 4]))?

[1, 2, 3, 4]

[1, 8, 27, 64]

[0, 1, 4, 9]

[1, 4, 9, 16]

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?