Chapter 4 Test: Strings and Methods

Chapter 4 Test: Strings and Methods

20 Qs

quiz-placeholder

Similar activities

ML 1 Python

ML 1 Python

University

20 Qs

Python

Python

KG - University

15 Qs

Python Nivel1

Python Nivel1

KG - University

20 Qs

Поняття мови програмування. Python.

Поняття мови програмування. Python.

KG - University

20 Qs

Programming 1 Exam 2

Programming 1 Exam 2

KG - University

18 Qs

Level 5 - Crypto Quiz 1 of 2

Level 5 - Crypto Quiz 1 of 2

KG - University

20 Qs

10 - Computação com Cloud Functions

10 - Computação com Cloud Functions

KG - University

20 Qs

Chapter 4 Test: Strings and Methods

Chapter 4 Test: Strings and Methods

Assessment

Quiz

others

Hard

Created by

Tim Sexton

Used 4+ times

FREE Resource

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

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?