Search Header Logo

Ctrl + Quiz

Authored by Son Goku

Computers

University

Used 1+ times

Ctrl + Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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 

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers