Week 5 Unit 4: Self-test
Last updated:
(05. April 2024)
Question 1
Which of the following statements about variables in functions are correct?
Note: There are 3 correct answers to this question.
Using the keyword "global", variables defined outside of the function can be made visible inside the function.
✅The terms local and global are good for communication, but do not have any semantics.
❌Local variables are not visible outside of the function.
✅Variables in functions have either a global or a local scope.
✅If there is a global and a local variable with the same name, an error is triggered.
❌Question 2
What is the outcome of the following program?



