What will be the output of the following Python code?
print("Welcome to Python".split())
[“Welcome”, “to”, “Python”]
(“Welcome”, “to”, “Python”)
{“Welcome”, “to”, “Python”}
“Welcome”, “to”, “Python”
What will be the output of the following Python code snippet?
print('1.1'.isnumeric())
True
False
None
Error
length
length()
len()
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.
index()
find()
Both of the above
None of the above
delete all the trailing whitespace characters
delete all the leading whitespace characters
delete all the leading and trailing whitespace characters
delete upper case characters
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.
19
18
17
count()
upper()
strip()
All the above
print("abcdef".find("cd") == "cd" in "abcdef")
None of the mentioned
print s[0]
print s.lower()
s[1]='r'
print s.strip()
print('abcdefcdghcd'.split('cd'))
[‘ab’, ‘ef’, ‘gh’]
[‘ab’, ‘ef’, ‘gh’, ”]
(‘ab’, ‘ef’, ‘gh’)
(‘ab’, ‘ef’, ‘gh’, ”)
x = 'abcd'for i in x: print(i) x.upper()
a B C D
a b c d
A B C D
error
anywhere in between the file
End
beginning
second line of the file
उपरोकà¥à¤¤ सà¤à¥€
print('ab,12'.isalnum())
print('abc'.islower())
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
example = "NITIN" print(example.rfind("N"))
-1
4
3
1
wd[4:]
wd[:4]
wd[-5:]
wd[:-4]
print(max("what are you"))
u
t
y
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘abef’)
(‘ab’, ‘cd’, ‘ef’)
2
print('HelloWorld'.istitle())
print('abcefd'.replace('cd', '12'))
ab1ef2
abcefd
ab1efd
ab12ed2
23
'2+3'
'23'
None of These
x = "abcdef"i = "a"while i in x: x = x[:-1] print(i, end = " ")
i i i i i i
a a a a a a
a a a a a
none of the mentioned
What will be the output of following statement ?
>>>"m"+"n1"
'm+nl'
'mn1'
'm n1'
'm'
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
a a a a a a … infinite Time
a
str1[ : : -1 ]
str1[ : : 1 ]
str1[ : -1 : -1 ]
x = 'abcd'for i in range(len(x)): x[i].upper()print (x)
abcd
ABCD
string = "my name is x"for i in string.split(): 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'.replace('cd', '12'))
abef
12
copy()
capitalize()
print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
xyyxyyxyxyxxy
12y12y1212x12
print('abcdefcdghcd'.split('cd', -1))
print('abcdefcdghcd'.split('cd', 2))
[‘ab’, ‘ef’, ‘ghcd’]
[‘ab’, ‘efcdghcd’]
[‘abcdef’, ‘ghcd’]
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
>>>max("what are you")
what
What does the following code print ?
x = 'mohan'for i in range (len(x)): x[i].upper()print (x)
mohan
MOHAN
print("abcdef".find("cd"))
print('ab cd ef'.title())
Ab cd ef
Ab cd eF
Ab Cd Ef
print('abcdefcdgh'.partition('cd'))
(‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
(‘ab’, ‘cd’, ‘efcdgh’)
(‘abcdef’, ‘cd’, ‘gh’)
str1="helloworld"print(str1[::-1])
dlrowolleh
hello
world
helloworld
what will the output of following code
my_string="Hello,world"print(my_string[-6:-1])
,worl
worl
oworld
print('Hello World'.istitle())
islower()
isupper()
Islower()
string = "my name is x"for i in string: print (i, end=", ")
print('a B'.isalpha())
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
indexing
Replication
concatenation
None of the Above