Search Header Logo

String Methods

Authored by harshit shukla

Computers

8th Grade

Used 8+ times

String Methods
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the index value of ‘i’ in string “Learning”?

3

5

6

7

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following will result in an error?
str1="python"

str1[1]="x"

print(str1[2])

print(str1[0:9])

Both (b) and (c)

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be the output of the following Python statement?

 

print("abcd"[2:])

a

ab

dc

cd

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

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

.capitalize()

.title()

.firstcaseupper()

.upper()

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What will be output for the following code?

string = "   HAVANA   "

print(string.rstrip().lower())

"HAVANA"

"havana"

" HAVANA"

" havana"

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code:

str1 = "My salary is 7000";

str2 = "7000"

print(str1.isdigit())

print(str2.isdigit())

False, False

True, False

False, True

True, True

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Guess the correct output of the following code?

str1 = "PYnative"

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

PYn PYnat ive PYnativ vitanYP

Yna PYnat tive PYnativ vitanYP

Yna PYnat tive PYnativ PYnativ

None of these

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

Already have an account?