Python Quiz 1

Python Quiz 1

30 Qs

quiz-placeholder

Similar activities

แบบทดสอบ Python พื้นฐาน

แบบทดสอบ Python พื้นฐาน

KG - University

30 Qs

Python

Python

KG - University

33 Qs

Formulir tanpa judul PENILAIAN AKHIR SEMESTER 1 /  GANJIL 2023

Formulir tanpa judul PENILAIAN AKHIR SEMESTER 1 / GANJIL 2023

KG - University

31 Qs

Compiling and Interpreting Source Code

Compiling and Interpreting Source Code

KG - University

30 Qs

ECE B_Python Class Test_QA

ECE B_Python Class Test_QA

KG - University

25 Qs

DCS:  HTML - Structuring Websites Test

DCS: HTML - Structuring Websites Test

KG - University

27 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?