Python Programming (2180711) MCQs

MCQs of Introduction to Python

Showing 71 to 80 out of 170 Questions
71.
What will be the output of the following Python code snippet? ['hello', 'morning'][bool('')]
(a) error
(b) no output
(c) hello
(d) morning
Answer:

Option (c)

72.
What will be the output of the following Python code snippet? not(3>4) not(1&1)
(a) True True
(b) True False
(c) False True
(d) False False
Answer:

Option (b)

73.
What will be the output of the following Python code? ['f', 't'][bool('spam')]
(a) TRUE
(b) FALSE
(c) No output
(d) Error
Answer:

Option (a)

74.
What will be the output of the following Python code? l=[1, 0, 2, 0, 'hello', '', []] list(filter(bool, l))
(a) Error
(b) [1, 0, 2, 0, ‘hello’, ”, []]
(c) [1, 0, 2, ‘hello’, ”, []]
(d) [1, 2, ‘hello’]
Answer:

Option (d)

75.
What will be the output of the following Python code? if (9 < 0) and (0 < -9): print(""hello"") elif (9 > 0) or False: print(""good"") else: print(""bad"")
(a) error
(b) hello
(c) good
(d) bad
Answer:

Option (c)

76.
Which of the following Boolean expressions is not logically equivalent to the other three?
(a) not(-6<0 or-6>10)
(b) -6>=0 and -6<=10
(c) not(-6<10 or-6==10)
(d) not(-6>10 or-6==10)
Answer:

Option (d)

77.
What will be the output of the following Python code snippet? not(10<20) and not(10>30)
(a) TRUE
(b) FALSE
(c) Error
(d) No output
Answer:

Option (b)

78.
What will be the output of the following Python code snippet? X=”hi” print(“05d”%X)
(a) 00000hi
(b) 000hi
(c) hi000
(d) error
Answer:

Option (d)

79.
What will be the output of the following Python code snippet? X=”gtu-chandkheda” print(“%56s”,X)
(a) 56 blank spaces before gtu-chandkheda
(b) 56 blank spaces before gtu and chandkheda
(c) 56 blank spaces after gtu-chandkheda
(d) no change
Answer:

Option (a)

80.
What will be the output of the following Python expression if X=345? print(“%06d”%X)
(a) 345000
(b) 000345
(c) 000000345
(d) 345000000
Answer:

Option (b)

Showing 71 to 80 out of 170 Questions