Given a string example=”hello” what is the output of example.count(‘l’)?
a) 2
b) 1
c) None
d) 0
Explanation: l occurs twice in hello.
What will be the output of the following Python code?
a) Error
b) -1
c) 1
d) 0
Explanation: Returns lowest index.
What will be the output of the following Python code?
a) -1
b) 4
c) 3
d) 1
Explanation: Returns highest index.
What will be the output of the following Python code?
a) dlrowolleh
b) True
c) -1
d) None
Explanation: Starts with checks if the given string starts with the parameter that is passed.
To concatenate two strings to a third what statements are applicable?
a) s3 = s1 . s2
b) s3 = s1.add(s2)
c) s3 = s1.__add__(s2)
d) s3 = s1 * s2
Explanation: __add__ is another method that can be used for concatenation.
What will be the output of the following Python statement?
a) A
b) B
c) a
d) Error
Explanation: Execute in shell to verify.