PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python String Quiz

Python String Quiz

Updated on: August 24, 2022 | 16 Comments

This Python String quiz provides Multiple Choice Questions(MCQ) to get familiar with Python String. To perform any programming tasks in Python, a good understanding of string manipulation is necessary. This online quiz focuses on testing your skills in Python String manipulation.

Also, Solve Python String Exercise

  • The quiz contains 15 Questions. Solve 10 correct to pass the test.
  • You will have to read all the given answers and click over the correct answer.

1. Select the correct output of the following String operations

strOne = str("pynative")
strTwo = "pynative"
print(strOne == strTwo)
print(strOne is strTwo)
 
 
 
 

2. Strings are immutable in Python, which means a string cannot be modified.

 
 

3. What is the output of the following string comparison

print("John" > "Jhon")
print("Emma" < "Emm")
 
 

4. Select the correct output of the following String operations

str = "my name is James bond";
print (str.capitalize())
 
 
 

5. Select the correct output of the following String operations

str1 = "my isname isisis jameis isis bond";
sub = "is";
print(str1.count(sub, 4))
 
 
 

6. What is the output of the following code

str1 = "My salary is 7000";
str2 = "7000"

print(str1.isdigit())
print(str2.isdigit())
 
 
 

7. Python does not support a character type; a single character is treated as strings of length one.

 
 

8. Choose the correct function to get the ASCII code of a character

 
 
 

9. Guess the correct output of the following code?

str1 = "PYnative"
print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1])
 
 
 

10. Select the correct output of the following String operations

str1 = 'Welcome'
print (str1[:6] + ' PYnative')
 
 
 
 

11. What is the output of the following string operations

str = "My salary is 7000";
print(str.isalnum())
 
 

12. Select the correct output of the following string operations

myString = "pynative"
stringList = ["abc", "pynative", "xyz"]

print(stringList[1] == myString)
print(stringList[1] is myString)
 
 

13. Guess the correct output of the following String operations

str1 = 'Welcome'
print(str1*2)
 
 

14. Which method should I use to convert String "welcome to the beautiful world of python" to "Welcome To The Beautiful World Of Python"

 
 

15. Choose the correct function to get the character from ASCII number

 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Basics Python Quizzes

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com