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
13 questions
Instalacion de Equipos #1
Quiz
•
9th Grade - University
10 questions
BIOMETRICS-UNIT-I
Quiz
•
University
20 questions
DreamWeaver CS6
Quiz
•
University
10 questions
CHAPTER 1: COMPUTER SECURITY REVIEW
Quiz
•
University
20 questions
Banco de Dados
Quiz
•
University - Professi...
19 questions
DSA Quest 1.0
Quiz
•
University
20 questions
Quiz #1 RStudio
Quiz
•
University
16 questions
W6_BIS
Quiz
•
University
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
