Home > Python > Quizzes > Python Programming Basics Practice Test: Argument Passing, Variables and Recursion
Python Programming Basics Practice Test: Argument Passing, Variables and Recursion
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 0% Most missed: “What is the value stored in sys.argv[0]?”
Quiz questions on argument parsing, global and local variables, recursion, differences between shallow and deep copy. In Python, arguments are passed to functions by assignment. This means that when a function is called, the values of the arguments are assigned to the corresponding parameters in the function's definition. There are two types of arguments in Python: positional arguments and keyword arguments. Positional arguments are the arguments that are passed to a function in the order that they appear in the function's definition. Keyword arguments are the arguments that are passed to... Show more
Python Programming Basics Practice Test: Argument Passing, Variables and Recursion
Time left 00:00
25 Questions

1. What happens if a local variable exists with the same name as the global variable you want to access?
2. What happens if the base condition isn’t defined in recursive programs?
3. What is tail recursion?
4. How are required arguments specified in the function heading?
5. In ____________________ copy, the modification done on one list affects the other list. In ____________________ copy, the modification done on one list does not affect the other list.
6. The nested list undergoes shallow copy even when the list as a whole undergoes deep copy.
7. What is the length of sys.argv?
8. What is the type of sys.argv?
9. How are variable length arguments specified in the function heading?
10. On assigning a value to a variable inside a function, it automatically becomes a global variable.
11. Only problems that are recursively defined can be solved using recursion.
12. Which of these is not true about recursion?
13. How many keyword arguments can be passed to a function in a single function call?
14. How are keyword arguments specified in the function heading?
15. What will be the output of the following Python code?
a=10
globals()['a']=25
print(a)
16. Which of the following statements is false about recursion?
17. What will be the output of the following Python code?
def f(): x=4
x=1
f()
x
18. Where are the arguments received from the command line stored?
19. Recursion and iteration are the same programming approach.
20. Which of these is not true about recursion?
21. In _______________ copy, the base address of the objects are copied. In _______________ copy, the base address of the objects are not copied.
22. What is the type of each element in sys.argv?
23. Which of the following data structures is returned by the functions globals() and locals()?
24. How are default arguments specified in the function heading?
25. What is the value stored in sys.argv[0]?