
Python end assesment-2

Quiz
•
Computers
•
University
•
Medium
Narendra Varma
Used 2+ times
FREE Resource
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
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Python Basics

Quiz
•
University
15 questions
CODE ZENITH

Quiz
•
University
10 questions
Python User Input Quiz

Quiz
•
6th Grade - University
10 questions
Python3

Quiz
•
4th Grade - University
20 questions
Big Data & Hadoop

Quiz
•
University
15 questions
Python Programming

Quiz
•
5th Grade - University
10 questions
Basic python

Quiz
•
University
12 questions
Neural Networks Basic with Python

Quiz
•
University - Professi...
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University