what will the output of following code
my_string="Hello,world"print(my_string[-6:-1])
,worl
worl
world
oworld
index()
find()
Both of the above
None of the above
What will be the output of the following Python code snippet?
a = [0, 1, 2, 3]for a[0] in a: print(a[0])
0 1 2 3
0 1 2 2
3 3 3 3
error
What does the following code print ?
x = 'mohan'for i in range (len(x)): x[i].upper()print (x)
mohan
MOHAN
Error
None of These
What will be the output of the following Python code?
print('abcd'.partition('cd'))
(‘ab’, ‘cd’, ”)
(‘ab’, ‘cd’)
none of the mentioned
23
'2+3'
'23'
print('1Rn@'.lower())
n
1rn@
rn
r
example = "snow world"example[3] = 's'print (example)
snow
snow world
snos world
startswith()
startswith_prefix()
startswithwith()
startswiths()
matches a pattern at the start of the string.
matches a pattern at any position in the string.
such a function does not exist
none of the mentioned.
print('Hello World'.istitle())
True
False
None
print(''.isdigit())
slicer
Slicing
Membership
None of these-
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
string = "my name is x"for i in string: print (i, end=", ")
m, y, , n, a, m, e, , i, s, , x,
m, y, , n, a, m, e, , i, s, , x
my, name, is, x,
print('abef'.partition('cd'))
(‘abef’)
(‘abef’, ‘cd’, ”)
(‘abef’, ”, ”)
Index of 'a'
Frequency of 'a'
Boolean
print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
xyyxyyxyxyxxy
12y12y1212x12
print('abc'.islower())
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘ab’, ‘cd’, ‘ef’)
2
Removes all spaces from the string.
Removes the first and last character of the string.
Removes whitespace from the beginning and end of the string.
Converts the string into a list of characters.
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
List
Tuple
Dictionary
print('Hello!2@#World'.istitle())
print('ab'.isalpha())
print('ab cd-ef'.title())
Ab cd-ef
Ab Cd-ef
Ab Cd-Ef
None of the mentioned
print("abcdef".find("cd") == "cd" in "abcdef")
length
length()
len()
print('1.1'.isnumeric())
delete all the trailing whitespace characters
delete all the leading whitespace characters
delete all the leading and trailing whitespace characters
delete upper case characters
space
colon
semi colon
strip()
lstrip()
rstrip()
trim()
count()
upper()
उपरोकà¥à¤¤ सà¤à¥€
print('abcdefcdghcd'.split('cd', 2))
[‘ab’, ‘ef’, ‘ghcd’]
[‘ab’, ‘efcdghcd’]
[‘abcdef’, ‘ghcd’]
What will be the output of the following expression?
a = 2b = 8print(a|b )print(a >> 1)
10 0
10 2
2 2
10 1
print("abcdef".find("cd"))
3
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
a a a a a
a a a a a a
a a a a a a … infinite Time
a
print('abcdefcdghcd'.split('cd'))
[‘ab’, ‘ef’, ‘gh’]
[‘ab’, ‘ef’, ‘gh’, ”]
(‘ab’, ‘ef’, ‘gh’)
(‘ab’, ‘ef’, ‘gh’, ”)
x = 'abcd'for i in range(len(x)): x[i].upper()print (x)
abcd
ABCD
print('11'.isnumeric())
print('HelloWorld'.istitle())
islower()
isupper()
Islower()
Strings can be modified using indexing.
Strings are immutable.
Strings can only contain alphabetic characters.
Strings must end with a newline character.
What is the output?
s = "Python"print(s[-1:-4])
hon
hon in reverse
IndexError
Empty string
print("xyyzxyzxzxyy".count('yy', 1))
0
1
s[1:4]
s[1:3]
s[2:5]
s[1:5:2]
print("xyyzxyzxzxyy".endswith("xyy"))
string = "my name is x"for i in string.split(): print (i, end=", ")
print s[0]
print s.lower()
s[1]='r'
print s.strip()
print('abef'.replace('cd', '12'))
abef
12