Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer

From 721 to 735 of 820

Q. +2+3?

a. hello123

b. hello

c. error

d. hello6

  • c. error

Q. >>>print("A", end = ' ')

a. dcba

b. a, b, c, d

c. d c b a

d. d, c, b, a will be displayed on four lines

  • c. d c b a

Q. Say s=”hello” what will be the return value of type(s)?

a. int

b. bool

c. str

d. string

  • c. str

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

a. heeeo

b. heelo

c. heleo

d. none

  • a. heeeo

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)

  • c. s.    getitem    (3)

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()

  • a. s.    len    ()

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

  • d. all of the mentioned

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)

  • a. s1.    contains    (s2)

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)

  • b. i.    add    (j)

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

a. true false

b. true true

c. false true

d. false false

  • c. false true

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”))

  • a. input(“enter a string”)

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

a. * abcdef *

b. * abcdef *

c. *abcdef *

d. * abcdef*

  • d. * abcdef*

Q. , 1))

a. 1abcdef

b. abcdef1

c. abcdef

d. error

  • d. error
Subscribe Now

Get All Updates & News