Question 1 of 25
Hints left: 3
Q1
What is the purpose of the title() method for strings?
Q2
What is the output of the following code: string = "Python" print(string[1:])
Q3
What is the output of the following code: string = "Python" print(string.find("th"))
Q4
What is the purpose of the find() method for strings?
Q5
What will be the output of the following Python code? print("xyyzxyzxzxyy".count('xyy', 2, 11))
Q6
What is the output of the following code: string = "Python is fun" print(string.split())
Q7
Which method is used to replace a substring in a string with another substring?
Q8
What is the purpose of the strip() method for strings?
Q9
What is the output of the following code: string = "Python" print(string[::-1])
Q10
In Python, how can you check if a string starts with a specific substring?
Q11
Which method is used to split a string into a list of substrings based on a specified separator?
Q12
What method is used to convert a string to uppercase in Python?
Q13
Which method is used to count the occurrences of a substring in a string?
Q14
What will be the output of the following Python code snippet? print('a@ 1,'.islower())
Q15
What is the purpose of the join() method for strings?
Q16
Which method is used to remove leading and trailing whitespace from a string?
Q17
In Python, how can you check if a string ends with a specific substring?
Q18
What will be the output of the following code: string = "Hello, world!" print(string.replace("o", "i"))
Q19
What will the following code output: string = "Python" print(string.lower())
Q20
What will be the output of the following Python code? >>>example = "helle" >>>example.find("e")
Q21
In Python, which escape sequence is used to represent a tab character?
Q22
What will be the output of the following Python code snippet? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
Q23
What does the isalpha() method of a string object check for?
Q24
In Python, how can you check if a string contains only numeric characters?
Q25
What will be the output of the following Python code snippet? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))