What will be the output of the following Python statement?
a) a
b) b
c) c
d) A
Explanation: Execute in the shell to verify.
Which of the following statement prints hello\example\test.txt?
a) print(“hello\example\test.txt”)
b) print(“hello\\example\\test.txt”)
c) print(“hello\”example\”test.txt”)
d) print(“hello”\example”\test.txt”)
Explanation: \is used to indicate that the next \ is not an escape sequence.
Suppose s is “\t\tWorld\n”, what is s.strip()?
a) \t\tWorld\n
b) \t\tWorld\n
c) \t\tWORLD\n
d) World
Explanation: Execute help(string.strip) to find details.
The format function, when applied on a string returns……….
a) Error
b) int
c) bool
d) str
Explanation: Format function returns a string.
What will be the output of the “hello” +1+2+3?
a) hello123
b) hello
c) Error
d) hello6
Explanation: Cannot concatenate str and int objects.
What will be the output of the following Python code?
a) DCBA
b) A, B, C, D
c) D C B A
d) D, C, B, A will be displayed on four lines
Explanation: Execute in the shell.