PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

Quiz
•
Computers
•
University
•
Hard
MS.SHYAMALADEVI C
Used 3+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
Python - Functions

Quiz
•
University
17 questions
Revision 2 C

Quiz
•
University
10 questions
Functions in Python

Quiz
•
University
15 questions
Exploring Python Fundamentals

Quiz
•
12th Grade - University
10 questions
IT Quiz Round 3

Quiz
•
University
10 questions
FGCT4023 Topic 6 - Interactivity

Quiz
•
University
20 questions
C++ Chapter 6 Review - Functions

Quiz
•
10th Grade - University
20 questions
Mastering Python Loops and Functions

Quiz
•
10th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University