Search Header Logo

Chapter 4 Test: Strings and Methods

Authored by Tim Sexton

others

Used 5+ times

Chapter 4 Test: Strings and Methods
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

30 sec • 5 pts

Which of the following statements contain valid Python string literals? Select all that are correct:

string = 'Hello, world.'
string = "1234"
string = "We're #1!"
string = Hello, world.
string = 1234

2.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What’s the value of x after this code snippet executes? x = "Real" + "Python"

'Real Python'
'RealPython'
' RealPython '
'realpython'

3.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What’s the value of x after this code snippet executes? x = 1234 + 5

12345
'12345'
1239
'1239'

4.

FILL IN THE BLANK QUESTION

30 sec • 5 pts

Create a string literal with the following text: Spock said, "Live long and prosper." Assign the string to a variable named vulcan_logic. #hint: pay attention to your spacing

5.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

What’s the value of x after this code snippet executes? x = "1234" + 5

This fails with a TypeError
'12349'
'12345'
12345

6.

FILL IN THE BLANK QUESTION

30 sec • 5 pts

Suppose the following strings are defined: topping1 = "Peanut Butter" topping2 = "Jelly" Use string concatenation to create the string "Peanut Butter & Jelly" that is assigned to a variable named sandwich.

7.

MULTIPLE CHOICE QUESTION

30 sec • 5 pts

Characters:

individual letters or symbols in a string
the quotes surrounding a string
joins two strings
gets a single character from a 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?