PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
MS.SHYAMALADEVI C
Used 5+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a recursive function in Python?
A function that calls itself
A function that returns a Boolean value
A function that performs mathematical operations
A function that has multiple return values
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet?
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
print(factorial(5))
1
5
10
120
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the "return" statement in a function?
To end the execution of a function
To return a value from a function
To print output from a function
To define a local variable within a function
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the "return" statement in a function?
To end the execution of a function
To return a value from a function
To print output from a function
To define a local variable within a function
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the scope of a variable defined inside a function?
Global scope
Local scope within the function
Both global and local scope
It is not possible to define variables inside a function
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the base case in a recursive function?
The initial condition that ends the recursion
The final output of the recursive function
The maximum number of recursive calls allowed
The condition for starting the recursion
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code snippet?
def countdown(n):
if n <= 0:
return
print(n)
countdown(n-1)
countdown(5)
5 4 3 2 1
1 2 3 4 5
0
Error
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
20 questions
COA_QUIZ_UNIT I
Quiz
•
University
10 questions
Excel 2016 Formato de celda
Quiz
•
University
16 questions
Algo Quiz
Quiz
•
University
10 questions
Server Administration- Quiz 1
Quiz
•
12th Grade - University
11 questions
Computer Science (1-9) - Identifying & Preventing Threats
Quiz
•
University
19 questions
Informatika Kelas 5 Bab 2
Quiz
•
5th Grade - University
18 questions
PRUEBA FINAL COMPUTACION
Quiz
•
1st Grade - University
20 questions
DI (EM24) - Diseño de Contenidos (T8)
Quiz
•
University - Professi...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
