Search Header Logo

Python Strings and Lists(12 adv Comp. Sci)

Authored by Imhotep Brooks

Computers

12th Grade

Used 2+ times

Python Strings and Lists(12 adv Comp. Sci)
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method would you use to convert a string to lowercase in Python?

.lower()

.toLowerCase()

lowercase()

convertToLower()

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you concatenate two strings in Python?

Use the '&' operator to join strings.

Call the concat() method on the string object.

Use the '+' operator to concatenate strings.

Use the '*' operator to concatenate strings.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

numbers = [10, 20, 30, 40, 50, 60, 70, 80]

print(numbers[2:6:2])

(Hint: ([start:stop:step])

[30, 40, 50, 60]

[30, 50]

[20, 40, 60]

[10, 30, 50, 70]

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you find the length of a string in Python?

Use string.length() to find the length.

Use len(your_string) to get the length of a string.

Use the size() function to get the length.

Count the characters manually in a loop.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code?

numbers = [1, 2, 3, 4, 5]

print(numbers[::-1])

Hint([start:stop:step])

[1, 2, 3, 4, 5]

[5, 4, 3, 2, 1]

None

Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you access the first element of a list in Python?

my_list[0]

get_first(my_list)

my_list[1]

my_list.first()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method would you use to add an element to the end of a list?

insert()

add()

push()

append()

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?