Grokking Python Fundamentals
Ask Author
Back to course home

0% completed

Vote For New Content
Quiz
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

What will the following function return when called?
def add(x, y):
    return x + y

result = add(5, 3)
print(result)
``
A
8
B
5
C
None
D
Error
What is recursion in programming?
A
When a function calls another function.
B
When a function calls itself.
C
When a function loops indefinitely.
D
When a function prevents an error.
What will be the output of the following code?
def my_function(*args):
    return sum(args)

print(my_function(1, 2, 3, 4))
A
10
B
(1, 2, 3, 4)
C
Error
D
None
What does the following lambda function do?
double = lambda x: x * 2
print(double(5))
A
10
B
2
C
5
D
Error
Which keyword is used to import a specific function from a module in Python?
A
from
B
import
C
get
D
load
What does this code output?
def outer():
    x = "local"
    def inner():
        nonlocal x
        x = "nonlocal"
        print("Inner:", x)
    inner()
    print("Outer:", x)

outer()
A
Inner: local, Outer: local
B
Inner: nonlocal, Outer: nonlocal
C
Inner: nonlocal, Outer: local
D
Error

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible