PYnative

Python Programming

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

Python String Quiz

Updated on: March 9, 2021 | Python Tags: Basics Python Quizzes

TweetF  sharein  shareP  Pin

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

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

2. What is the output of the following string operations

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

3. Select the correct output of the following String operations

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

4. Select the correct output of the following String operations

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

5. What is the output of the following string comparison

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

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

 
 

7. What is the output of the following code

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

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

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

 
 
 

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

 
 

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

 
 

11. Guess the correct output of the following String operations

str1 = 'Welcome'
print(str1*2)
 
 

12. Guess the correct output of the following code?

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

13. Select the correct output of the following String operations

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

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

14. Select the correct output of the following String operations

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

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

 
 
 

Loading ... Loading …

Loading

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:

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

Leave a Reply Cancel reply

your email address will NOT be published. all comments are moderated according to our comment policy.

Use <pre> tag for posting code. E.g. <pre> Your code </pre>

12 Comments

  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
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python Regex Python Random Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON
TweetF  sharein  shareP  Pin

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
  • Privacy Policy
  • Cookie Policy
  • Terms Of Use
  • Contact Us
DMCA.com Protection Status

Copyright © 2018-2021 · [pynative.com]

This website uses cookies to ensure you get the best experience on our website.Privacy PolicyGot it!