← Back to Subject
Python Programming • MCQ • Strings
Most Important 30 Objective Question - Strings
Q1. A string in Python is a collection of:

A) Numbers
B) Characters
C) Functions
D) Operators

Answer: B) Characters

Explanation:
A string is a sequence of characters enclosed in single, double, or triple quotes.

Q2. Which symbol is used to create a string?

A) ()
B) []
C) Quotes (' ' or " ")
D) {}

Answer: C) Quotes (' ' or " ")

Explanation:
Strings are written inside single quotes ' ' or double quotes " ".

Q3. Which of the following is a valid string?

A) "Hello"
B) 123
C) True
D) [1,2,3]

Answer: A) "Hello"

Explanation:
Anything written inside quotes becomes a string.

Q4. What is the index of the first character in a string?

A) 0
B) 1
C) -1
D) 2

Answer: A) 0

Explanation:
Python uses zero-based indexing, so the first character starts at index 0.

Q5. What is the index of the last character using negative indexing?

A) 0
B) -1
C) 1
D) -2

Answer: B) -1

Explanation:
Negative indexing starts from the end. The last character has index -1.

Q6. What is the output of "Python"[0]?

A) y
B) P
C) n
D) Error

Answer: B) P

Explanation:
Index 0 refers to the first character.

Q7. What is the output of "Python"[-1]?

A) P
B) y
C) n
D) h

Answer: C) n

Explanation:
-1 refers to the last character.

Q8. Which operation combines two strings?

A) -
B) *
C) +
D) /

Answer: C) +

Explanation:
+ is used for string concatenation.

Example: "Hi" + "There"

Q9. What is string repetition operator?

A) +
B) *
C) %
D) //

**Answer: B) ***

Explanation:
* repeats a string multiple times.

Example: "Hi"*3 = HiHiHi

Q10. Which slicing syntax is correct?

A) str(1:3)
B) str[1:3]
C) str{1:3}
D) str<1:3>

Answer: B) str[1:3]

Explanation:
Slicing uses square brackets with colon.

Q11. What does "Python"[1:4] return?

A) Pyt
B) yth
C) ytho
D) tho

Answer: B) yth

Explanation:
Starts from index 1 and stops before index 4.

Q12. Which function gives length of a string?

A) count()
B) len()
C) size()
D) length()

Answer: B) len()

Explanation:
len() returns the total number of characters.

Q13. Which method converts string to uppercase?

A) upper()
B) uppercase()
C) up()
D) capital()

Answer: A) upper()

Explanation:
upper() converts all letters into capital letters.

Q14. Which method converts string to lowercase?

A) lower()
B) lowercase()
C) low()
D) small()

Answer: A) lower()

Explanation:
lower() converts all letters into small letters.

Q15. Which method removes extra spaces?

A) trim()
B) strip()
C) remove()
D) clear()

Answer: B) strip()

Explanation:
strip() removes spaces from both ends of a string.

Q16. Which method replaces a word in string?

A) replace()
B) change()
C) modify()
D) update()

Answer: A) replace()

Explanation:
replace() changes one part of string into another.

Q17. Which method splits a string into list?

A) join()
B) divide()
C) split()
D) break()

Answer: C) split()

Explanation:
split() divides string into list elements.

Q18. Which method joins list items into string?

A) merge()
B) join()
C) combine()
D) add()

Answer: B) join()

Explanation:
join() combines list elements into a single string.

Q19. What is the output of "python".capitalize()?

A) python
B) PYTHON
C) Python
D) pYTHON

Answer: C) Python

Explanation:
capitalize() makes first letter uppercase.

Q20. Which method checks if string starts with specific text?

A) endswith()
B) startswith()
C) begin()
D) first()

Answer: B) startswith()

Explanation:
startswith() returns True if string starts with given text.

Q21. Which method checks if string ends with specific text?

A) endswith()
B) startswith()
C) last()
D) stop()

Answer: A) endswith()

Explanation:
endswith() checks ending characters.

Q22. What is string formatting?

A) Removing string
B) Printing string in a structured way
C) Deleting string
D) Creating list

Answer: B) Printing string in a structured way

Explanation:
Formatting helps display values neatly inside strings.

Q23. Which symbol is used in old string formatting?

A) &
B) %
C) #
D) @

Answer: B) %

Explanation:
Older Python versions commonly used % formatting.

Q24. Which modern method is used for string formatting?

A) format()
B) shape()
C) design()
D) create()

Answer: A) format()

Explanation:
format() is commonly used for better string formatting.

Q25. What is the output of "abc".upper()?

A) abc
B) ABC
C) Abc
D) Error

Answer: B) ABC

Explanation:
upper() converts all letters to uppercase.

Q26. What is the output of len("Hello")?

A) 4
B) 5
C) 6
D) Error

Answer: B) 5

Explanation:
There are 5 characters in “Hello”.

Q27. Are Python strings mutable?

A) Yes
B) No
C) Sometimes
D) Only numbers

Answer: B) No

Explanation:
Strings are immutable, meaning they cannot be changed directly.

Q28. Which operator checks substring existence?

A) is
B) in
C) ==
D) and

Answer: B) in

Explanation:
in checks whether a substring exists inside a string.

Q29. What is the output of "a" in "apple"?

A) True
B) False
C) Error
D) None

Answer: A) True

Explanation:
Since "a" exists in "apple", result is True.

Q30. Which statement is true?

A) Strings are mutable
B) Strings support slicing
C) Strings cannot be indexed
D) Strings are numbers

Answer: B) Strings support slicing

Explanation:
Strings support indexing, slicing, formatting, and many useful methods.
Google AdSense Ad Placement Here 📢