Ctrl + Quiz

Ctrl + Quiz

University

30 Qs

quiz-placeholder

Similar activities

Latihan Lab 1 - Pemrograman Python

Latihan Lab 1 - Pemrograman Python

University

30 Qs

CodeHS Basic Data Structures in Python

CodeHS Basic Data Structures in Python

University - Professional Development

26 Qs

Collections

Collections

University - Professional Development

30 Qs

PROG3 - Chapter 7

PROG3 - Chapter 7

University

30 Qs

AITECH_1

AITECH_1

University

25 Qs

ข้อสอบปลายภาค วิชาการเขียนโปรแกรม

ข้อสอบปลายภาค วิชาการเขียนโปรแกรม

University

30 Qs

Fun with Data and Python

Fun with Data and Python

University

30 Qs

python basic

python basic

University

27 Qs

Ctrl + Quiz

Ctrl + Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Son Goku

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the purpose of the if statement in Python?

To define a function

To create a loop

To make decisions based on conditions

To import modules

2.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the main purpose of the else statement in Python?

To skip the execution of the if statement block
To execute a block of code regardless of the if statement condition
To define a block of code that will be executed if the conditional statement in the if statement is false.
To define a block of code that will be executed if the conditional statement in the if statement is true

3.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the difference between lists and tuples in Python?

Lists are immutable, and tuples are mutable 

Tuples can have duplicate elements, but lists cannot 

Lists are ordered, and tuples are unordered 

Lists are defined with parentheses, and tuples are defined with square brackets 

4.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

How do you open a file in Python for reading?

file.open("filename.txt", "r") 

 open("filename.txt", "read") 

open("filename.txt", "r") 

file.read("filename.txt", "open") 

5.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the purpose of the break statement in a loop?

To end the loop and move to the next iteration 

To skip the current iteration and move to the next one 

To exit the program 

To restart the loop 

6.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the role of the init method in a class?

To initialize the class object 

To define the class variables 

To create an instance of the class 

To destroy the class object 

7.

MULTIPLE CHOICE QUESTION

20 sec • 10 pts

What is the purpose of the strip() method for strings?

To remove leading and trailing whitespaces 

To split the string into a list 

To concatenate two strings 

To capitalize the first letter of the string 

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?