On This Page

This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 23

Q1 | <20) and not(10>30)
  • true
  • false
  • error
  • no output
Q2 | )
  • 0 1 2 0
  • 0 1 2
  • error
  • none of the mentioned
Q3 | )
  • 0 1 2 3 0
  • 0 1 2 0
  • 0 1 2
  • error
Q4 | :]: print(i, end = " ")
  • a a a a a a
  • a
  • no output
  • error
Q5 | ): print(i)
  • 0
  • no output
  • error
  • none of the mentioned
Q6 | 0): print(i)
  • 0.0 1.0
  • 0 1
  • error
  • none of the mentioned
Q7 | 0)): print(i)
  • 0.0 1.0
  • 0 1
  • error
  • none of the mentioned
Q8 | ])
  • 0 1 2 3
  • 0 1 2 2
  • 3 3 3 3
  • error
Q9 | ] in a: print(a[0])
  • 0 1 2 3
  • 0 1 2 2
  • 3 3 3 3
  • error
Q10 | >>>"a"+"bc
  • a
  • bc
  • bca
  • abc
Q11 | >>>"abcd"[2:]
  • a
  • ab
  • cd
  • dc
Q12 | >>> str1[-1:]
  • olleh
  • hello
  • h
  • o
Q13 | What arithmetic operators cannot be used with strings?
  • +
  • *
  • all of the mentioned
Q14 | >>>print (r"\nhello")
  • a new line and hello
  • \\nhello
  • the letter r and then hello
  • error
Q15 | >>>print('new' 'line')
  • error
  • output equivalent to print ‘new\\nline’
  • newline
  • new line
Q16 | >>>str1[::-1]
  • dlrowolleh
  • hello
  • world
  • helloworld
Q17 | xA + 0xB + 0xC)
  • 0xa0xb0xc
  • error
  • 0x22
  • 33
Q18 | >>>print "%d %d" % (obj.o1, obj.o2)
  • none none
  • none 22
  • 22 none
  • error is generated
Q19 | >>>print(temp.id)
  • 224
  • error
  • 12
  • none
Q20 | >>>print("%s" % example[4:7])
  • wo
  • world
  • sn
  • rl
Q21 | >>>print example
  • snow
  • snow world
  • error
  • snos world
Q22 | >>>max("what are you")
  • error
  • u
  • t
  • y
Q23 | Given a string example=”hello” what is the output of example.count(‘l’)?
  • 2
  • 1
  • none
Q24 | >>>example.find("e")
  • error
  • -1
  • 1
Q25 | >>>example.rfind("e")
  • -1
  • 4
  • 3
  • 1