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.

M

Mr. Dubey • 101.14K Points
Coach

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

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

M

Mr. Dubey • 101.14K Points
Coach

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

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

M

Mr. Dubey • 101.14K Points
Coach

Q. 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)
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

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

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

M

Mr. Dubey • 101.14K Points
Coach

Q. 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
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

Q. 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)
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

Q. 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)
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

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

  • (A) true false
  • (B) true true
  • (C) false true
  • (D) false false
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

Q. What function do you use to read a string?

  • (A) input(“enter a string”)
  • (B) eval(input(“enter a string”))
  • (C) enter(“enter a string”)
  • (D) eval(enter(“enter a string”))
Show Answer Discuss Share

M

Mr. Dubey • 101.14K Points
Coach

Q. ), '*', sep= '')

  • (A) * abcdef *
  • (B) * abcdef *
  • (C) *abcdef *
  • (D) * abcdef*
Show Answer Discuss Share

Jump to

Download our easy to use, user friendly Android App from Play Store. And learn MCQs with one click.

Image