
Python end assesment-2
Quiz
•
Computers
•
University
•
Practice Problem
•
Medium
Narendra Varma
Used 2+ times
FREE Resource
Enhance your content in a minute
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
11 questions
What is a computer
Quiz
•
KG - University
16 questions
Algo Quiz
Quiz
•
University
12 questions
CIS1103 Week 9_10 CLO3 Part 1
Quiz
•
University
18 questions
PRUEBA FINAL COMPUTACION
Quiz
•
1st Grade - University
20 questions
IT 101 - Quiz 3
Quiz
•
University
20 questions
NACOS Kahoot Session II
Quiz
•
University
10 questions
pointers and structures
Quiz
•
University
20 questions
COA_QUIZ_UNIT I
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
