Quiz of Namespace and Scope
FREE Online Courses: Elevate Skills, Zero Cost. Enroll Now!
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
- Which of the following is not a namespace in Python?
CorrectIncorrect -
Question 2 of 15
2. Question
How many types of namespaces and scopes exist in Python respectively?
CorrectIncorrect -
Question 3 of 15
3. Question
- Which of the following is not true about built-in scoped variables?
CorrectIncorrect -
Question 4 of 15
4. Question
Which of the following are global variables in the below code?
var1=3.4
def func1():
var2=12
def func2():
var3=36
global var4
num4=9
func2()CorrectIncorrect -
Question 5 of 15
5. Question
name=”PythonGeeks”
print(id(name))
CorrectIncorrect -
Question 6 of 15
6. Question
How many namespaces can exist at a time?
CorrectIncorrect -
Question 7 of 15
7. Question
def func1():
var=12
func1()
print(‘var’)
CorrectIncorrect -
Question 8 of 15
8. Question
Which of the following is the biggest scope?
CorrectIncorrect -
Question 9 of 15
9. Question
var=3.4
def outer():
var=5.7
def inner():
global var
var=1.2
outer()
print(var)
CorrectIncorrect -
Question 10 of 15
10. Question
Identify the code snipped that does not give an error.
a.
def func1():
var=12
func1()
print(var)
b.
def func1():
global var
var=12
func1()
print(Var)
c.
def func1():
global var
var=12
func1()
print(var)
CorrectIncorrect -
Question 11 of 15
11. Question
var=”Python”
var2=var
var=”python”
print(id(var2)==id(“python”))
CorrectIncorrect -
Question 12 of 15
12. Question
var=12
def outer():
var=5
def inner():
global var
var=2
inner()
print(var)
outer()
CorrectIncorrect -
Question 13 of 15
13. Question
Which of the following code blocks gives an error?
a.
var=12
def outer():
var=5
def inner():
var=2
outer()
print(var)
b.
def outer():
var=5
def inner():
var=2
outer()
print(var)
c.
var=12
def outer():
def inner():
var=2
outer()
print(var)
print(var)
CorrectIncorrect -
Question 14 of 15
14. Question
var=12
def fun1():
def fun2():
nonlocal var
var=2
fun2()
print(var)
fun1()
CorrectIncorrect -
Question 15 of 15
15. Question
What could be the output of the below code?
no=19
def fun1():
no=4
def fun2():
global no
no=13
fun2()
print(no)fun1()
CorrectIncorrect