Python end assesment-2

Python end assesment-2

University

15 Qs

quiz-placeholder

Similar activities

Django-quiz

Django-quiz

5th Grade - University

20 Qs

Basic on Operating System

Basic on Operating System

University

10 Qs

21CSC305P - Machnine Learning - Quiz

21CSC305P - Machnine Learning - Quiz

University

15 Qs

Kuis Dadakan ;)

Kuis Dadakan ;)

10th Grade - University

15 Qs

Topic 4-2: Multiple if-else and switch-case

Topic 4-2: Multiple if-else and switch-case

University

10 Qs

1-基本数据类型

1-基本数据类型

University

10 Qs

Introduction to AI - Healthcare & Business

Introduction to AI - Healthcare & Business

University - Professional Development

10 Qs

Python Quiz For Starters

Python Quiz For Starters

3rd Grade - Professional Development

17 Qs

Python end assesment-2

Python end assesment-2

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Narendra Varma

Used 2+ 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

1.What is the purpose of a function in Python?

To declare variables

To repeat a block of code

To perform a specific task

To import modules

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword is used to define a function in python?

func

define

def

int main(int a,intb)

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

3)What will be the output of the following Python code

import random

def generate_random_numbers():

numbers = [random.randint(1, 10) for in range(5)]

return numbers

try:

print(generaterandom_numbers())

except Exception as e:

print("Error:", e)

finally: print("Finally block executed"

Note:The above mentioned try-catch block is not in generate_random_numbers function.It was outside of it.

A list of 5 random numbers between 1 and 10

Error: 'random' module not found

Error: Invalid input to randint() function

Finally block executed

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

4.What is recursion?

A loop structure

A function that calls itself

An error in python

A module in python

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

5.What is an anonymous function in Python?

A function that doesnt have a name

A built-in python function

A function with multiple parameters

A function with single line of code

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is NOT a built-in exception in Python

FileNotFoundError

TypeError

ZeroDivisionError

CustomError

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the finally block in exception handling?

To execute regardless of whether an exception occurs or not

To catch exceptions

TO define custom exceptions

TO raise exceptions

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