# Python Functions Quiz Part-2 for Experienced

Don’t miss to attempt this Python functions Quiz Part-2 for experienced programmers. It includes 21 questions of medium to high complexity levels.

We’ve delivered this post in continuation to our last quiz that included another 20 basic questions on functions in Python. Since it’s an important topic, so we wanted to give it full coverage. Before you move on to start the quiz, let’s listen to a few facts about the subject.

Functions are a useful way to split your code into logical blocks, allow modularization, turn it more readable, and make it reusable. Also, functions are an intuitive way to create interfaces so the programmers can easily publicize their code.

Some cool facts – In Python, a function can return multiple values. It gets possible by returning the result in the form of a tuple. Also, you can list down the functions of a module by using the <getmembers()> function of the <inspect> module.

Now, enjoy running through the quiz.

## Python Functions Quiz Part-2 for Experienced.

Python Functions Quiz Part-2

### Q-1.  What is the output of the following code snippet?

A. Values inside the function:  [1, 2, 3, 4]
Values outside the function:  [10, 20, 30]
B. Values inside the function:  [10, 20, 30]
Values outside the function:  [10, 20, 30]
C. Values inside the function:  [1, 2, 3, 4]
Values outside the function: [1, 2, 3, 4]
D. None of the above

### Q-2. What is the output of the following code snippet?

A. x is 50
Changed global x to 2
Value of x is 50
B. x is 50
Changed global x to 2
Value of x is 2
C. x is 50
Changed global x to 50
Value of x is 50
D. None of the mentioned

### Q-3.Which of the following function calls can be used to invoke the below function definition?

A. test(1, 2, 3, 4)
B. test(a = 1, 2, 3, 4)
C. test(a = 1, b = 2, c = 3, 4)
D. test(a = 1, b = 2, c = 3, d = 4)
E. test(1, 2, 3, d = 4)

B and C leads to SyntaxError: positional argument follows keyword argument

### Q-4. What is the output of the following code snippet?

A. a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
a is 5 and b is 100 and c is 50
B. a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
a is 50 and b is 100 and c is 5
C. a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
D. None of the above

A. 4
B. 3
C. 0
D. 1

### Q-6. What is the output of the following code snippet?

A. 1 3
B. 3 1
C. The program has a runtime error because the function returns the multiple values
D. 3 -1
E. -1 3

A. Welcome All
B. All Welcome
C. All
D. Welcome

A. 9997
B. 9999
C. 9996
D. 9998

A. 8
16
B. 16
256
C. 32
1024
D. 128
1256

of all values
6
15
B. 6
15
C. 123
12345
D. 6
120

### Q-11. What is the output of the following code snippet?

A.  2
B.  4
C.  5
D.  An exception is thrown

### Q-12. What is the output of the following code snippet?

A.  +++%s+++
B.  Python functions
C.  +++Python functions+++
D.  +++1 Python functions+++

### Q-13. What is the order of usage of  *args, **kwargs, and formal args in function header?

A.  some_func(fargs, *args, **kwargs)
B.  some_func(**kwargs, *args, fargs)
C.  some_func(*args, **kwargs, fargs)
D.  some_func(*args, fargs, **kwargs)

A.  str
B.  int
C.  tuple
D.  list
E.  dict

A.  str
B.  int
C.  tuple
D.  list
E.  dict

### Q-16. What is the output of the following code snippet?

A.  formal arg: 1
another arg: two
another arg: 3
B.  formal arg: 1
another arg: two
C.  An exception is thrown
D.  None of the above

### Q-17. What is the output of the following code snippet?

A.  formal arg: 1
another keyword arg: myarg2: two
another keyword arg: myarg3: 3
B.  formal arg: 1
another keyword arg: myarg2: two
C.  An exception is thrown
D.  None of the above

### Q-18. What is the output of the following code snippet?

A.  Inside func(): [1, 2, 3, 0]
After function call: [1, 2, 3, 4, 5]
B.  Inside func(): [0, 1, 2, 3]
After function call: [0, 1, 2, 3]
C.  Inside func(): [1, 2, 3, 0]
After function call: [1, 2, 3, 0]
D.  Inside func(): [1, 2, 0, 3]
After function call: [1, 2, 0, 3]

### Q-19. What is the output of the following code snippet?

A. [2, 3, 4, 5, 6, 7, 8]
B. [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
C. [2, 3, 5, 6, 7, 10, 15, 19, 20, 27, 35, 41, 49]
D. [2, 3, 5, 9, 13, 17, 26, 31, 35, 37, 41, 43, 47, 49]

### Q-20. What is the output of the following code snippet?

A. [7, 2, 3, 5, 2, 6]
B. [30]
C. [7, 3, 4, 5, 6, 3]
D. [30, 23, 20, 15, 13, 7]

A. 47
B. 42
C. 102
D. 11