Python Basic Quiz #4 – Strings

Welcome to your Python Basic Quiz #4 - Strings

1. 
What will be the output of the below code?

string_1 = "Python"
string_2 = "Python"

print(id(string_1) == id(string_2))

2. 
What will be the output of the below code?

string = "Python"
print(string[2])
string[2] = 'A'

3. 
What will be the output of the below code?

multi_line = """This is a String.\nWell, It's multi-line."""
print(multi_line)

4. 
Which of the below are the correct way of defining strings in Python?

Select all that apply

5. 
What will be the output of the below code?

string_1 = "Python"
string_1 = string_1 + '1'

print(id(string_1) == id(string_2))

Leave a Reply

Your email address will not be published. Required fields are marked *