PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

PROGRAMMING IN PYTHON - UNIT II - TEST 2 - MCQS

University

15 Qs

quiz-placeholder

Similar activities

Software Engineering Quiz 1

Software Engineering Quiz 1

University

20 Qs

Determining System Requirements

Determining System Requirements

University

11 Qs

CIS2303 Week 4_5 Ch_3

CIS2303 Week 4_5 Ch_3

University

18 Qs

INTO Artificial Intelligence

INTO Artificial Intelligence

University - Professional Development

10 Qs

ITF Chapter 1 Computing Devices

ITF Chapter 1 Computing Devices

University

14 Qs

INTRODUCCION A LA PROGRAMACION

INTRODUCCION A LA PROGRAMACION

6th Grade - University

10 Qs

U3BigData01

U3BigData01

University

18 Qs

Sains Komputer Tingkatan 5 - 1.3.1 Menerangkan get logik

Sains Komputer Tingkatan 5 - 1.3.1 Menerangkan get logik

1st Grade - Professional Development

20 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