Home / CSE MCQs / Python MCQs :: Python Strings

CSE MCQs :: Python MCQs

  1. What is the output of the following?

    print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
  2. A.
    xyyxyyxyxyxxy
    B.
    12y12y1212x12
    C.
    none of the mentioned
    D.
    error

  3. What is the output of the following?

    print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))
  4. A.
    abcd
    B.
    1234
    C.
    error
    D.
    none of the mentioned