<
RHD
/>
Home
Blog
Quiz
Resources
About
Contact
// guest
▾
Login
Request Account
[ light ]
// Functions
Functions Quiz
// question 1 of 10
What is printed? def f(x): if x>0: return ""P"" else: return ""N"" ; print(f(-1))?
-1
N
P
// question 2 of 10
Can a local variable be used outside the function?
No
Only with return
Yes
// question 3 of 10
What happens if too many arguments are passed?
Concatenated
Ignored
Error
// question 4 of 10
What is printed? def f(): print(""Hi"") ; print(f())?
Hi
Hi then None
Error
// question 5 of 10
What is printed? try: print(int(""a"")) except ValueError: print(""Bad"")?
a
Bad
Error
// question 6 of 10
What is printed? def f(x): return x*3 ; print(f(4))?
7
43
12
// question 7 of 10
What is printed? def f(x): if x>0: return ""P"" else: return ""N"" ; print(f(1))?
1
P
N
// question 8 of 10
What is printed? def greet(name): return ""Hi ""+name ; print(greet(""Ana""))?
Error
Ana Hi
Hi Ana
// question 9 of 10
What is printed? def f(a,b): return a or b ; print(f(False,True))?
False
Error
True
// question 10 of 10
What is printed? def cube(x): return x**3 ; print(cube(2))?
4
8
6
Submit Answers →