Search Header Logo

Python Strings

Authored by Nicholas Marsh

Computers

10th Grade

8 Questions

Used 3+ times

Python Strings
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following code snippet: "Hello" + "World"?

A) HelloWorld

B) Hello World

C) "HelloWorld"

D) "Hello World"

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

x = "Python", What is the result of x[0]?

A) P

B) y

C) Py

D) p

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you slice the string x = "coding" to get the output "cod"?

A) x[0:2]

B) x[0:3]

C) x[:3]

D) x[3:]

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to get the last character of the string s = "data"?

A) s[-1]

B) s[3]

C) s[len(s)]

D) Both A and B

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the effect of x = "Data", x.upper()?

A) data

B) DATA

C) Data

D) dATA

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does x = "PYTHON", x.lower() return?

A) python

B) PYTHON

C) Python

D) pYTHON

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How would you replace all occurrences of "l" with "z" in the string "hello"? For the purposes of this question, don't worry about reassignment.

A) "hello".replace("l", "z")

B) "hello".replace("z")

C) "hello".replace("l")

D) "hello".replace("z", "l")

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