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.
List
Tuple
Dictionary
None
space
colon
semi colon
anywhere in between the file
End
beginning
second line of the file
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("xyyzxyzxzxyy".count('xyy', 2, 11))
2
0
1
error
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 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
index()
find()
Both of the above
None of the above
print("xyyzxyzxzxyy".count('xyy', -10, -1))
print("abcdef".find("cd"))
True
3
None of the mentioned
count()
upper()
strip()
All the above
indexing
Replication
concatenation
None of the Above
x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
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’, ”)
what will the output of following code
my_string="Hello,world"print(my_string[-6:-1])
,worl
worl
world
oworld
print("abc DEF".capitalize())
abc def
ABC DEF
Abc def
Abc Def
print('abcdefcdghcd'.split('cd', 2))
[‘ab’, ‘ef’, ‘ghcd’]
[‘ab’, ‘efcdghcd’]
[‘abcdef’, ‘ghcd’]
Concatenation
Membership
Slicing
All of the above
str1="helloworld"print(str1[::-1])
dlrowolleh
hello
helloworld
print("xyyzxyzxzxyy".endswith("xyy"))
example = "helle"print(example.find("e"))
-1
print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
xyyxyyxyxyxxy
12y12y1212x12
print('ab'.isalpha())
False
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,
x = 'abcd'for i in x: print(i) x.upper()
a B C D
a b c d
A B C D
delete all the trailing whitespace characters
delete all the leading whitespace characters
delete all the leading and trailing whitespace characters
delete upper case characters
Strings can be modified using indexing.
Strings are immutable.
Strings can only contain alphabetic characters.
Strings must end with a newline character.
example = "NITIN" print(example.rfind("N"))
4
string = "my name is x"for i in string.split(): print (i, end=", ")
copy()
capitalize()
White Space
,
e
S
print('1Rn@'.lower())
n
1rn@
rn
r
What is the output of the following program:
print ("Hello World"[::-1])
dlroW olleH
Hello Worl
D
23
'2+3'
'23'
islower()
isupper()
Islower()
print('11'.isnumeric())
dlroWolleH
d
print("Welcome to Python".split())
[“Welcome”, “to”, “Python”]
(“Welcome”, “to”, “Python”)
{“Welcome”, “to”, “Python”}
“Welcome”, “to”, “Python”
print('a B'.isalpha())
print(''.isdigit())
print('a@ 1,'.islower())
slicer
None of these-
x = "abcdef"i = "a"while i in x: x = x[1:] print(i, end = " ")
no output
print('abef'.replace('cd', '12'))
abef
12
print('abcdef'.partition('cd'))
(‘ab’, ‘ef’)
(‘abef’)
(‘ab’, ‘cd’, ‘ef’)
>>>max("what are you")
what
y
print('abcdef12'.replace('cd', '12'))
ab12ef12
abcdef12
ab12efcd
x = 'abcd'for i in range(len(x)): x[i].upper()print (x)
abcd
ABCD
print('1.1'.isnumeric())