LearnFrenzy
Sign in Take a free test

Strings · Exercise 1 of 4

Strings Strings MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on Python strings: immutability, indexing and slicing, find vs index, split and join, character tests, comparison and formatting. Pick an option to check your answer instantly.

Question 11 Medium

What does the r prefix do in r"C:\new"?

A It makes the string read-only
B It reverses the string
C Backslashes are kept literally instead of starting escape sequences
D It removes spaces
Question page & discussion
Question 12 Hard

What is "aaaa".count("aa")?

A 3
B 4
C 2
D 1
Question page & discussion
Question 13 Easy

What does chr(ord("a") + 1) return?

A 98
B "b"
C "a1"
D TypeError
Question page & discussion
Question 14 Easy

What is special about a triple-quoted string such as """…"""?

A It is a comment that Python ignores
B It is a bytes object
C It cannot contain quotes
D It can span several lines and keeps the line breaks
Question page & discussion
Question 15 Medium

What does f"{3.14159:.2f}" produce?

A "3.1"
B "3.14159"
C "3"
D "3.14"
Question page & discussion
Up next · Exercise 2Predict the Output15 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links