PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

University

15 Qs

quiz-placeholder

Similar activities

PROBLEM SOLVING USING R  UNIT I  MCQS

PROBLEM SOLVING USING R UNIT I MCQS

University

15 Qs

Javascript

Javascript

University

12 Qs

Quiz on List and Tuples

Quiz on List and Tuples

University

16 Qs

The AI Shield

The AI Shield

University

15 Qs

Unit 28 - Quiz #1

Unit 28 - Quiz #1

University

15 Qs

Internet seguro

Internet seguro

8th Grade - University

10 Qs

Tema 5: Lenguaje audiovisual y los medios de comunicación

Tema 5: Lenguaje audiovisual y los medios de comunicación

University

10 Qs

Evaluación SENA

Evaluación SENA

University

10 Qs

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

MS.SHYAMALADEVI C

Used 5+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers