python strings

python strings

Professional Development

15 Qs

quiz-placeholder

Similar activities

Deloitte_Python_Day2

Deloitte_Python_Day2

Professional Development

10 Qs

Python - Day 2

Python - Day 2

Professional Development

15 Qs

Day 7

Day 7

Professional Development

10 Qs

Python Basics - Second step of Baby python

Python Basics - Second step of Baby python

Professional Development

10 Qs

Python - CDT

Python - CDT

Professional Development

20 Qs

ABREDES - Devasc Python

ABREDES - Devasc Python

Professional Development

14 Qs

HTML, CSS, JS Quiz

HTML, CSS, JS Quiz

Professional Development

20 Qs

python dictionary and set

python dictionary and set

Professional Development

15 Qs

python strings

python strings

Assessment

Quiz

Professional Development

Professional Development

Hard

Created by

Assoc.Prof,IT Chennai

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?