What will be the output of the following Python code?
a) a a a a a a
b) a
c) no output
d) error
Explanation: The string x is being shortened by one character in each iteration.
What will be the output of the following Python code?
a) a a a a a a
b) a
c) no output
d) error
Explanation: i is not in x[1:].
What will be the output of the following Python code?
a) a B C D
b) a b c d
c) A B C D
d) error
Explanation: Changes do not happen in-place, rather a new instance of the string is returned.
What will be the output of the following Python code?
a) a b c d
b) A B C D
c) a B C D
d) error
Explanation: The instance of the string returned by upper() is being printed.
What will be the output of the following Python code?
a) a b c d
b) 0 1 2 3
c) error
d) none of these
Explanation: range(str) is not allowed.
What will be the output of the following Python code?
a) a b c d
b) 0 1 2 3
c) error
d) 1 2 3 4
Explanation: i takes values 0, 1, 2 and 3.