Python Functions and Modules Quiz

Python Functions and Modules Quiz

University

30 Qs

quiz-placeholder

Similar activities

Calibración en Python

Calibración en Python

University - Professional Development

27 Qs

GE8151 IAT2 Python Part A

GE8151 IAT2 Python Part A

University

30 Qs

Quiz_python

Quiz_python

University

29 Qs

Script_programming_test

Script_programming_test

University

25 Qs

Python Programming Quiz

Python Programming Quiz

University

25 Qs

Python_Unit4

Python_Unit4

University

25 Qs

8 ci sinif ümumiləşdirici test

8 ci sinif ümumiləşdirici test

6th Grade - University

30 Qs

Unit-1 Python Programming

Unit-1 Python Programming

University

30 Qs

Python Functions and Modules Quiz

Python Functions and Modules Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Dr. Deepti Sharma

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? python Copy code def func(a, b=5): return a + b print(func(3))

None

Error

5

3

8

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following allows a function to accept a variable number of keyword arguments?

**kwargs

**variables

*args

kwargs[]

*variables

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the following code output? python Copy code def func(): return "Hello", "World" result = func() print(type(result))

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement about Python functions is false?

Functions can accept keyword arguments.

Functions can have default arguments.

Functions can be nested.

Functions can return multiple values as tuples.

Functions must return a value.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python Copy code def func(x, y): x = x + y return x print(func("Hello", "World"))

HelloWorld

Hello World

Error

None

Hello-World

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code? python Copy code def add(a, b=10): return a + b print(add(5))

None

15

5

Error

10

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the *args in a function definition?

It allows the function to accept any number of non-keyword arguments.

It allows the function to accept a fixed number of arguments.

It allows the function to accept any number of keyword arguments.

It is used for returning multiple values from a function.

It helps to create default parameters in the function.

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?