Python Quiz 1

Python Quiz 1

30 Qs

quiz-placeholder

Similar activities

Python Coding Techniques Quiz

Python Coding Techniques Quiz

KG - University

30 Qs

Turtle Quiz

Turtle Quiz

KG - University

25 Qs

R програмчлалын хэл, статистик

R програмчлалын хэл, статистик

KG - University

26 Qs

Code

Code

University

30 Qs

Тестирование

Тестирование

KG - University

29 Qs

Python Review - Input, Output, and Math

Python Review - Input, Output, and Math

9th - 12th Grade

25 Qs

Coding Contest Quiz

Coding Contest Quiz

KG - University

30 Qs

Wind-Down Friday!

Wind-Down Friday!

Professional Development

31 Qs

Python Quiz 1

Python Quiz 1

Assessment

Quiz

others

Hard

Created by

254009 BALASUBRAMANIAN

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the advantage of using generators compared to lists?
Generators are faster for large datasets.
Generators can be modified after creation.
Generators use less memory.
Generators use more memory.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the try-except block do in Python?
Defines a loop structure.
Handles potential errors during code execution
Checks for specific variable values.
Creates a conditional statement.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a module and a package in Python?
Modules contain functions and variables, packages group related modules.
Packages are executable code, modules are not.
Modules are for internal use, packages are for external use.
There's no difference.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you open a file for writing in Python?
open("filename.txt", "r")
open("filename.txt", "w")
open("filename.txt", "a") (append mode)
open("filename.txt") (default read mode)

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What are the pillars of Object-Oriented Programming (OOP)?
Inheritance, Encapsulation, Polymorphism
Functions, Variables, Loops
Modules, Packages, Libraries
Lists, Tuples, Dictionaries

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code? import array as arr MY_array=arr.array('i',[1,2,3,4,5]) MY-array[::-1]
[5, 4, 3, 2, 1]
array(‘i’, [5, 4, 3, 2, 1])
array([5, 4, 3, 2, 1])
array(‘i’, [1,2,3,4,5])

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a decorator in Python?
To modify the behavior of a function without changing its code.
To define a new data type.
To improve code readability.
To optimize code performance.

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?