Home / Engineering / Problem Solving and Python Programming MCQs / Page 18

Problem Solving and Python Programming MCQs | Page - 18

Dear candidates you will find MCQ questions of Problem Solving and Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.

Q. 171) What will be the output of the following
Python code?
for i in range(int(2.0)):
print(i)

(A) 0.0 1.0
(B) 0 1
(C) error
(D) none of the mentioned
View Answer Discuss Share

Q. 172) What will be the output of the following
Python code snippet?
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0])

(A) 0 1 2 3
(B) 0 1 2 2
(C) 3 3 3 3
(D) error
View Answer Discuss Share

Q. 173) What will be the output of the following
Python statement?
>>>"a"+"bc"

(A) a
(B) bc
(C) bca
(D) abc
View Answer Discuss Share

Q. 174) What is “Hello”.replace(“l”, “e”)?

(A) heeeo
(B) heelo
(C) heleo
(D) none
View Answer Discuss Share

Q. 175) To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed)?

(A) s[]
(B) s.getitem(3)
(C) s. getitem (3)
(D) s.getitem(3)
View Answer Discuss Share

Q. 176) To return the length of string s what command do we execute?

(A) s. len ()
(B) len(s)
(C) size(s)
(D) s.size()
View Answer Discuss Share

Q. 177) If a class defines the     str    (self) method, for an object obj for the class, you can use which command to invoke the     str      method.

(A) obj. str ()
(B) str(obj)
(C) print obj
(D) all of the mentioned
View Answer Discuss Share

Q. 178) To check whether string s1 contains another string s2, use                  

(A) s1. contains (s2)
(B) s2 in s1
(C) s1.contains(s2)
(D) si.in(s2)
View Answer Discuss Share

Q. 179) Suppose i is 5 and j is 4, i + j is same as

(A) i. add(j)
(B) i. add (j)
(C) i. add(j)
(D) i. add(j)
View Answer Discuss Share

Q. 180) print(id(s1) == id(s2))

(A) true false
(B) true true
(C) false true
(D) false false
View Answer Discuss Share

Explore Sets

Problem Solving and Python Programming MCQs Set 1

Problem Solving and Python Programming MCQs Set 2

Problem Solving and Python Programming MCQs Set 3

Problem Solving and Python Programming MCQs Set 4

Problem Solving and Python Programming MCQs Set 5

Problem Solving and Python Programming MCQs Set 6

Problem Solving and Python Programming MCQs Set 7

Problem Solving and Python Programming MCQs Set 8

Problem Solving and Python Programming MCQs Set 9

Problem Solving and Python Programming MCQs Set 10

Problem Solving and Python Programming MCQs Set 11

Problem Solving and Python Programming MCQs Set 12

Problem Solving and Python Programming MCQs Set 13

Problem Solving and Python Programming MCQs Set 14

Problem Solving and Python Programming MCQs Set 15

Problem Solving and Python Programming MCQs Set 16

Problem Solving and Python Programming MCQs Set 17

Problem Solving and Python Programming MCQs Set 18

Problem Solving and Python Programming MCQs Set 19

Problem Solving and Python Programming MCQs Set 20

Problem Solving and Python Programming MCQs Set 21

Problem Solving and Python Programming MCQs Set 22

Problem Solving and Python Programming MCQs Set 23

Problem Solving and Python Programming MCQs Set 24

Problem Solving and Python Programming MCQs Set 25

Problem Solving and Python Programming MCQs Set 26

Problem Solving and Python Programming MCQs Set 27

Problem Solving and Python Programming MCQs Set 28

Problem Solving and Python Programming MCQs Set 29

Problem Solving and Python Programming MCQs Set 30

Problem Solving and Python Programming MCQs Set 31

Problem Solving and Python Programming MCQs Set 32

Problem Solving and Python Programming MCQs Set 33

Problem Solving and Python Programming MCQs Set 34

Problem Solving and Python Programming MCQs Set 35

Problem Solving and Python Programming MCQs Set 36

Problem Solving and Python Programming MCQs Set 37

Problem Solving and Python Programming MCQs Set 38

Problem Solving and Python Programming MCQs Set 39

Problem Solving and Python Programming MCQs Set 40

Problem Solving and Python Programming MCQs Set 41

Problem Solving and Python Programming MCQs Set 42

Problem Solving and Python Programming MCQs Set 43