Search Header Logo

python strings

Authored by Assoc.Prof,IT Chennai

Professional Development

Professional Development

python strings
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the following Python code snippet do?

string = "Hello, World!"

print(string.upper())

Prints “Hello, World!” in lowercase

Converts “Hello, World!” to uppercase and prints it

Reverses the string “Hello, World!”

Removes all whitespace characters from the string “Hello, World!”

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How can you concatenate two strings in Python?

Using the concat() method

Using the join() method

Using the & operator

Using the + operator

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following Python code snippet?

string = "Hello, World!"

print(string[3:7])

“Hello”

“lo, “

“lo, W”

“lo, World”

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which method is used to split a string into a list of substrings based on a delimiter in Python?

split()

substring()

separate()

divide()

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the strip() method do in Python string manipulation?

Removes all whitespace characters from both ends of the string

Removes all characters except alphabets from the string

Converts the string to uppercase

Converts the string to lowercase

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following Python code snippet?

string = "Hello, World!"

print(string.rjust(20))

” Hello, World!”

“Hello, World! “

” Hello, World! “

“Hello, World! “

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What does the isdigit() method do in Python string manipulation?

Checks if all characters in the string are digits

Converts the string to lowercase

Checks if all characters in the string are alphabets

Checks if the string is empty

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Professional Development