Python Certification Exam Preparation Set 20

Given the code fragment:

What is the result?


Options are :

  • 0
  • 1
  • 2 (Correct)
  • 3

Answer :2

Given the code fragment:

What is the result?


Options are :

  • (['R'], ['G'], ['B'])
  • (['Red'], ['G'], ['B'])
  • ([['Red']], ['G'], ['B']) (Correct)
  • An error is raised during execution

Answer :([['Red']], ['G'], ['B'])

Python Certification Exam Preparation Set 6

Given the code fragment:

What is the result?


Options are :

  • (10, 20) (Correct)
  • (100, 200)
  • An error is raised during execution

Answer :(10, 20)

Given the code fragment:

What is the result?


Options are :

  • ('hello')
  • hello (Correct)
  • ('h', 'e', 'l', 'l', 'o')
  • ['h', 'e', 'l', 'l', 'o']

Answer :hello

Given the code fragment:

What is the result?


Options are :

  • Line 1 raises an error during execution
  • 5
  • 4 (Correct)
  • 0

Answer :4

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 11

Given the code fragment:

What is the result?


Options are :

  • 1
  • 2
  • 3
  • An error is raised by Line 3 (Correct)

Answer :An error is raised by Line 3

Given:

Which of the following option can be filled in 2 blanks such that output will be 4?


Options are :

  • ( and )
  • { and } (Correct)
  • [ and ]
  • Not possible with above options

Answer :{ and }

Given:

Which of the following 2 options can be filled in the blank such that output will be [0, 1, 0]?


Options are :

  • remove(1)
  • pop() (Correct)
  • pop(1)
  • remove()
  • pop(-1) (Correct)

Answer :pop() pop(-1)

Python Certification Exam Preparation Set 61

Given:

Which of the following option can be filled in the blank such that output will be 4?


Options are :

  • x = x * 2
  • x.add([3000, 4000])
  • x.update(3000, 4000)
  • x.update([3000, 4000]) (Correct)

Answer :x.update([3000, 4000])

Given the code fragment:

What is the result?


Options are :

  • ['a', 'e', 'i', 'o', 'u'] (Correct)
  • ['u', 'o', 'i', 'e', 'a']
  • Line 3 raises an error
  • Line 4 raises an error

Answer :['a', 'e', 'i', 'o', 'u']

Given the code fragment:

What is the result?


Options are :

  • hello
  • Hello
  • Hhello
  • hellH
  • An error is raised (Correct)

Answer :An error is raised

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 18

Consider below code snippet:

Which of the following options will display Python in the output?

Select 2 options.


Options are :

  • print(a1, a2, a3, a4, a5, a6)
  • print("".join(a1, a2, a3, a4, a5, a6))
  • print("".join({a1, a2, a3, a4, a5, a6}))
  • print("".join([a1, a2, a3, a4, a5, a6])) (Correct)
  • print(a1 + a2 + a3 + a4 + a5 + a6) (Correct)

Answer :print("".join([a1, a2, a3, a4, a5, a6])) print(a1 + a2 + a3 + a4 + a5 + a6)

Given the code fragment:

What is the result?


Options are :

  • 5
  • 10-5
  • -10-5-
  • -5
  • An error is raised (Correct)

Answer :An error is raised

Given the code fragment:

What is the result?


Options are :

  • An error is raised
  • python:
  • :python
  • p:y:t:h:o:n (Correct)

Answer :p:y:t:h:o:n

Python Certification Exam Preparation Set 14

Given the code fragment:

What is the result?


Options are :

  • True (Correct)
  • False

Answer :True

Given the code fragment:

What is the result?


Options are :

  • ['b', 'n', 'n']
  • ['b', 'n', 'na'] (Correct)
  • ['b', 'nana']
  • ['banana']
  • ['b', 'n', 'n', '']

Answer :['b', 'n', 'na']

Given the code fragment:

What is the result?


Options are :

  • 0
  • 1
  • 2 (Correct)
  • 3

Answer :2

Python Certification Exam Preparation Set 44

Given the code fragment:

Which of the following statements will trim leading and trailing white-spaces and will display attack on to the console?

Select 2 options.


Options are :

  • trim(msg)
  • print(msg.trim())
  • print(msg.strip()) (Correct)
  • print(msg.lstrip().rstrip()) (Correct)
  • print(msg.ltrim().rtrim())

Answer :print(msg.strip()) print(msg.lstrip().rstrip())

Given the code fragment:

What is the result?


Options are :

  • DACB
  • DAC
  • DA
  • D (Correct)

Answer :D

Which of the string functions are used to remove leading and/or trailing white spaces?

Select 3 options.


Options are :

  • strip() (Correct)
  • lstrip() (Correct)
  • rstrip() (Correct)
  • stripBoth()
  • trim()
  • trimBoth()

Answer :strip() lstrip() rstrip()

Python Certification Exam Preparation Set 10

Given the code fragment:

What is the result?


Options are :

  • True (Correct)
  • False

Answer :True

Given the code fragment:

What is the result?


Options are :

  • True
  • False
  • An error is raised (Correct)

Answer :An error is raised

Given the code snippet:

Which of the following statements will display 13 in the output?

Select 3 options.


Options are :

  • print(txt.find('tt'))
  • print(txt.rfind('tt')) (Correct)
  • print(txt.find('tt', 1))
  • print(txt.find('tt', 2)) (Correct)
  • print(txt.find('tt', 3, 14))
  • print(txt.find('tt', 3, 15)) (Correct)

Answer :print(txt.rfind('tt')) print(txt.find('tt', 2)) print(txt.find('tt', 3, 15))

Python Certification Exam Preparation Set 8

Given the code fragment:

What is the result?


Options are :

  • 0
  • 2 (Correct)
  • 3
  • 4

Answer :2

Given the code fragment:

Which of the following statement will print Python Vs Java?


Options are :

  • print(fight.capitalize())
  • print(fight.title()) (Correct)
  • print(fight.upperfirst())
  • print(fight.upper())

Answer :print(fight.title())

Given the code fragment:

What is the result?


Options are :

  • space station
  • Space station
  • Space Station
  • spacestation
  • Spacestation (Correct)
  • SpaceStation

Answer :Spacestation

Python Certification Exam Preparation Set 37

A bank's swift code is generally of 11 characters and used in international money transfers.

An example of swift code: ICICINBBRT4

ICIC: First 4 letters for bank code

IN: Next 2 letters for Country code

BB: Next 2 letters for Location code

RT4: Next 3 letters for Branch code


Given the code fragment:

Which of the following code correctly extracts country code from the swift code referred by string reference variable swift_code?


Options are :

  • swift_code[4:6] (Correct)
  • swift_code[5:6]
  • swift_code[5:7]
  • swift_code[4:5]

Answer :swift_code[4:6]

Given the code fragment:

What is the result?


Options are :

  • R:G:B
  • Red:Green:Blue (Correct)
  • R:Red:G:Green:B:Blue
  • An error is raised

Answer :Red:Green:Blue

Given the code fragment:

What is the result?


Options are :

  • 0
  • 1 (Correct)
  • 2
  • 3
  • An error is raised

Answer :1

Python Certification Exam Preparation Set 33

Given the code fragment:

What is the result?


Options are :

  • apple
  • None
  • null
  • An error is raised (Correct)

Answer :An error is raised

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions