2nd Quizz Python

2nd Quizz Python

12th Grade

15 Qs

quiz-placeholder

Similar activities

Python for loop/lists

Python for loop/lists

9th Grade - University

15 Qs

Laravel Entry Assessment

Laravel Entry Assessment

12th Grade

14 Qs

แข่งขันcodingม.ต้น

แข่งขันcodingม.ต้น

12th Grade - University

15 Qs

Fundamentos de Programación en Python

Fundamentos de Programación en Python

6th Grade - University

10 Qs

LKPD (Tugas MIT App Inventor)

LKPD (Tugas MIT App Inventor)

12th Grade

10 Qs

Python Library Routines Quiz

Python Library Routines Quiz

10th Grade - University

18 Qs

PyGame akz

PyGame akz

9th Grade - University

10 Qs

9 Weeks Test

9 Weeks Test

9th - 12th Grade

16 Qs

2nd Quizz Python

2nd Quizz Python

Assessment

Quiz

Information Technology (IT)

12th Grade

Medium

Created by

Science Quiz

Used 2+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of a function in Python?

To execute code only once in a program

To create variables in Python

To define classes in Python

The purpose of a function in Python is to encapsulate code for reuse and organization.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you define a class in Python?

class ClassName() {}

class ClassName: pass()

class ClassName: pass

define ClassName as a function

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code: if 5 > 3: print('A') else: print('B')?

A

5

B

C

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you create a list in Python?

You create a list in Python using square brackets, e.g., my_list = [1, 2, 3].

You create a list in Python by calling the list() function, e.g., my_list = list(1, 2, 3).

You create a list in Python using curly braces, e.g., my_list = {1, 2, 3}.

You create a list in Python by using parentheses, e.g., my_list = (1, 2, 3).

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the difference between a list and a tuple in Python?

Tuples are mutable; lists are immutable.

Lists are mutable; tuples are immutable.

Lists can contain only numbers; tuples can contain any data type.

Lists are faster than tuples in all cases.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access a value in a dictionary using a key?

Use dictionary_name[key] to modify the value.

Access the value with dictionary_name.key.

Use dictionary_name.get(key) to retrieve the value.

Use dictionary_name[key] to access the value.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of the operation 10 % 3?

1

10

0

3

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?