Python Basic Quiz #5 – String Manipulation Level #1

Welcome to your Python Basic Quiz #5 - String Manipulation Level #1

The questions in this Quiz are based on the below strings.

string1 = "Once upon a time a girl named Cinderella lived with her stepmother and two stepsisters"
string2 = "Cinderella"

1. 
From String1, to get the total number of occurances of character "e", the below code has been written. What will be the result?

string1.count("e")

2. 
From "string1", we need to extract the string "girl named Cinderella". Which of the below codes will not do return "girl named Cinderella"?

3. 
From String2, we need to get the characters as given below. Which of the below code will not result the below expected result?

Expected Output: Cneel

Select all that apply.

4. 
From the "string2", we need to check whether the string "in" existing or not. Which of below code will give the expected result?

Select all that apply.

5. 
From the "string2", we need to extract the word "ella". Which of below code will give the expected result?

Select all that apply.

Leave a Reply

Your email address will not be published. Required fields are marked *