<
RHD
/>
Home
Blog
Quiz
Resources
About
Contact
// guest
▾
Login
Request Account
[ light ]
// Functions
Functions Quiz
// question 1 of 10
What is printed? x=5 ; def f(): x=2 ; print(x) ; f()?
5
2
Error
// question 2 of 10
What is printed? def f(x): return x[0] ; print(f(""abc""))?
b
a
abc
// question 3 of 10
What is printed? x=10 ; def f(): print(x+5) ; f()?
15
105
10
// question 4 of 10
What is printed? x=1 ; def f(): global x ; x=3 ; f() ; print(x)?
Error
3
1
// question 5 of 10
What is printed? def f(x): return x+1 ; print(f(2))?
2
3
21
// question 6 of 10
What is printed? def greet(name): return ""Hi ""+name ; print(greet(""Ana""))?
Hi Ana
Error
Ana Hi
// question 7 of 10
What does except ValueError do?
Handles missing variables
Handles loops
Handles invalid values
// question 8 of 10
What is printed? try: print(""A"") finally: print(""B"")?
A then B
A
B then A
// question 9 of 10
What is printed? def f(x): return x%2 ; print(f(5))?
5
1
0
// question 10 of 10
Can a function call another function?
Only with import
No
Yes
Submit Answers →