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
15 questions
AdBase Quiz No 2

Quiz
•
University
14 questions
python functions

Quiz
•
University
20 questions
9618 Chp11 Programming Basics Quiz

Quiz
•
11th Grade - University
15 questions
002_Java Methods

Quiz
•
12th Grade - University
15 questions
Java Method

Quiz
•
University
15 questions
Deep Learning Quiz

Quiz
•
University
10 questions
AND_OR Excel Functions Quiz

Quiz
•
9th Grade - University
10 questions
Module 09 - Day 3

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University