Question 1
How can you find the number of occurrences of a substring sub in a string?
Question 2
What will the expression return?
Question 3
What is the output of the following code?
text=Python is fun
print(text.split())
Question 4
Which of the following is the correct way to escape a single quote within a string?
Question 5
Which method is used to remove trailing whitespace from a string?
Question 6
Which method is used to replace occurrences of a substring in a string?
Question 7
How can you convert an integer num to a string in python?
Question 8
Which method is used to check if a string contains only alphabetical characters?
Question 9
Which method is used to check if a string contains only lowercase characters?
Question 10
What does the rjust( ) method do?
Question 11
What will the following expression evaluate to?
Question 12
Which method is used to remove leading whitespace from a string?
Question 13
How can you determine the length of a string?
Question 14
What will the expression return?
Question 15
Which of the following is the correct way to reverse a string text?
Question 16
Which method is used to check if a string contains only decimal characters?
Question 17
Which method is used to split a string into a list of substrings based on a delimiter?
Question 18
What does the isdigit( ) method do?
Question 19
Which operator is used to concatenate two strings?
Question 20
What is the result of the expression?
Question 21
How can you convert a string to a list of characters?
Question 22
Which method is used to check if a string ends with a specific substring?
Question 23
Which method is used to check if a string is composed of only printable characters?
Question 24
What is the output of the following code?
text =Hello, World!
print(text[-6:-1])
Question 25
Which of the following is the correct way to declare a string in python?
Question 26
What will the following code snippet do?
text =Python
result=text.center(10,-)
print(result)
Question 27
What is the output of the following code snippet?
text =Python
print( text[1:] )
Question 28
Which method is used to swap the cases of characters in a string?
Question 29
What will the following code snippet do?
text =python programming
result = text.title( )
print(result)
Question 30
How can you check if a string contains a specific substring sub? ?
Question 31
What is the result of the expression?
Question 32
What is the output of the following code snippet?
text =programming
print(text.count(g))
Question 33
What is the output of the following code?
text =python programming
print(text.upper())
Question 34
Which method is used to check if all characters in a string are in uppercase?
Question 35
What is the purpose of the format() method for strings?
Question 36
What will the following code output?
word =Python
print(word[10])
Question 37
What is the result of the expression?
Question 38
What will the following code snippet print?
string =Python
print(string[0])
Question 39
What does the method isnumeric() do?
Question 40
Which method is used to convert a string to uppercase?
Question 41
What will the expression return?
Question 42
Which method is used to check if a string starts with a specific substring?
Question 43
Which of the following is not a valid way to create a multi-line string?
Question 44
What will the following code do?
string =Hello, World!
result =string.strip( )
print(result)
Question 45
How can you remove all occurrences of a character char from a string?
Question 46
What does the center() method do?
Question 47
What is the purpose of the join( ) method for strings?
Question 48
Which method is used to find the index of the first occurrence of a substring in a string?
Question 49
Strings are immutable. what does this mean?
Question 50
What will the expression return?