PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

University

15 Qs

quiz-placeholder

Similar activities

DBMS E-R Diagram Quiz 2

DBMS E-R Diagram Quiz 2

University

20 Qs

Online Test-3 ( Wipro Talent Next )- 30th July 2020

Online Test-3 ( Wipro Talent Next )- 30th July 2020

University

20 Qs

Advanced Database Systems - Prelim Quiz

Advanced Database Systems - Prelim Quiz

University

15 Qs

Advanced Excel

Advanced Excel

KG - University

20 Qs

C++ Assesment 1

C++ Assesment 1

University

20 Qs

Latihan Rekursif

Latihan Rekursif

University

12 Qs

Analysis of Algorithms

Analysis of Algorithms

University

10 Qs

Enumeration and Recursion

Enumeration and Recursion

11th Grade - University

12 Qs

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

Assessment

Quiz

Computers

University

Hard

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?