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: Objects of type int have no attribute upper().
What will be the output of the following Python code snippet?
a) a b c d
b) 0 1 2 3
c) error
d) none of these
Explanation: Objects of type int have no attribute upper().
What will be the output of the following Python code snippet?
a) abcd
b) ABCD
c) error
d) none of these
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 snippet?
a) abcd
b) ABCD
c) error
d) none of these
Explanation: Objects of type int aren’t subscriptable. However, if the statement was x[i], an error would not have been thrown.
What will be the output of the following Python code snippet?
a) a
b) abcd abcd abcd
c) a a a a
d) none of these
Explanation: range() is computed only at the time of entering the loop.
What will be the output of the following Python code snippet?
a) a
b) abcd abcd abcd abcd
c) a a a a
d) none of these
Explanation: abcd a a a is the output as x is modified only after ‘abcd’ has been printed once.