Python Certification Exam Preparation Set 19

Consider below code:

What will be the output of executing above code?


Options are :

  • Error is displayed in the output
  • Today is Sunday, I'm at peace.
  • "Today is Sunday," "I'm at peace." (Correct)
  • "Today is Sunday, I'm at peace."

Answer :"Today is Sunday," "I'm at peace."

Consider below code of file1.py:

What will be the output of executing file1.py?


Options are :

  • one two 3 four
  • Error occurs during the execution
  • four (Correct)
  • onetwo3four
  • onetwo3 four

Answer :four

Python Certification Exam Preparation Set 60

Given the code fragment:

What is the result?


Options are :

  • RED ORANGE GREEN
  • REDORANGEGREEN
  • RED ORANGE GREEN
  • Error occurs during the execution (Correct)

Answer :Error occurs during the execution

What will be the output of executing below code?


Options are :

  • True
  • False
  • 0
  • 1 (Correct)
  • Error occurs during the execution

Answer :1

What will be the output of executing below code?


Options are :

  • Error occurs during the execution
  • False (Correct)
  • True
  • 0
  • 1

Answer :False

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

What will be the output of executing below code?


Options are :

  • Error occurs during the execution
  • False (Correct)
  • True
  • 0
  • 1

Answer :False

What will be the output of executing below code?


Options are :

  • 1 (Correct)
  • 4
  • 3
  • Error occurs during the execution

Answer :1

Consider below code snippet:

Which of the below option fills the blank such that True is displayed in the output?


Options are :

  • fruits[0]
  • fruits[-4] (Correct)
  • fruits[-3]
  • fruits[2]

Answer :fruits[-4]

Python Certification Exam Preparation Set 18

Consider below code snippet:

Which of the below options fills the blank such that True is displayed in the output?

Select 3 options.


Options are :

  • colors[1:2]
  • colors[1:2][0] (Correct)
  • colors[-3:-2][0] (Correct)
  • colors[-2:-3][0]
  • colors[-3] (Correct)
  • colors[2]

Answer :colors[1:2][0] colors[-3:-2][0] colors[-3]

Consider below code snippet:

Which of the following print statements will display ('u', 'o', 'i', 'e', 'a') on to the console?

Select 3 options.


Options are :

  • print(vowels[::-1]) (Correct)
  • print(vowels[-1:-6:-1]) (Correct)
  • print(vowels[4:-1:-1])
  • print(vowels[4:0:-1])
  • print(vowels[4::-1]) (Correct)

Answer :print(vowels[::-1]) print(vowels[-1:-6:-1]) print(vowels[4::-1])

What will be the output of executing below code?


Options are :

  • >python<
  • >nohtyp< (Correct)
  • ><
  • Error occurs during the execution

Answer :>nohtyp<

Python Certification Exam Preparation Set 60

What will be the output of executing below code?


Options are :

  • ['A', 'A+']
  • ['A', 'B'] (Correct)
  • []
  • ['A', 'A+', 'B']
  • ['A', 'B', 'A+']

Answer :['A', 'B']

Consider below code:

Which of the following statements will add string 'hola' at the end of list msgs1?

Select 2 options.


Options are :

  • msgs1[2] = msgs2[0]
  • msgs1[5:] = msgs2[0]
  • msgs1[5:] = msgs2 (Correct)
  • msgs1.append(msgs2)
  • msgs1.extend(msgs2) (Correct)
  • msgs1.insert(1, msgs2[0])

Answer :msgs1[5:] = msgs2 msgs1.extend(msgs2)

What will be the output of executing below code?


Options are :

  • cmaig
  • oprn (Correct)
  • giamc
  • nrpo

Answer :oprn

Python Certification Exam Preparation Set 58

What will be the output of executing below code?


Options are :

  • comparing
  • Comparing
  • Ccomparing
  • cComparing
  • Error occurs during the execution (Correct)

Answer :Error occurs during the execution

What will be the output of executing below code?


Options are :

  • aefgh
  • bcd
  • abcdefgh
  • Error occurs during the execution (Correct)

Answer :Error occurs during the execution

What will be the output of executing below code?


Options are :

  • ('R', 'G', 'B')
  • ('R', 'B')
  • ('G', 'B')
  • Error occurs during the execution (Correct)

Answer :Error occurs during the execution

Python Certification Exam Preparation Set 13

Consider below code:

Which of the following statements will replace # Line 2 such that on executing the modified code, ['A', 'T'] will be displayed in the output?

Select 2 options.


Options are :

  • del text[-3:-1] (Correct)
  • text[1:] = []
  • text[1:3] = [] (Correct)
  • text[1] = [] text[2] = []

Answer :del text[-3:-1] text[1:3] = []

Consider below code:

And also following code snippets:

1.

2.

3.

Which options can replace # Line 2 such that on executing modified code, output will be: [10, 8, 6, 4, 2]


Options are :

  • Only 1 or Only 2 or Only 3
  • Either 1 or 2
  • Either 2 or 3
  • Either 1 or 3
  • Either 1 or 2 or 3 (Correct)

Answer :Either 1 or 2 or 3

Consider below code:

Which of the following statements will replace # Line 2 such that on executing modified code, output will be: ['A', 'E', 'I', 'O', 'U']?

Select 3 options.


Options are :

  • del vowels[-5] (Correct)
  • vowels[-4:-5] = []
  • vowels[1:2] = () (Correct)
  • vowels[1] = ''
  • vowels.remove('B') (Correct)

Answer :del vowels[-5] vowels[1:2] = () vowels.remove('B')

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

What will be the output of executing below code?


Options are :

  • ALL
  • BALL
  • None
  • Error occurs during the execution (Correct)

Answer :Error occurs during the execution

What will be the output of executing below code?


Options are :

  • [[1, 2], (), 'hello']
  • [[1, 2], {}, 'hello']
  • [[1, 2], (), {}, "hello"]
  • None (Correct)
  • Error occurs during the execution

Answer :None

What will be the output of executing below code?


Options are :

  • [[9], [8, 7], [5, 4, 8]]
  • [[5, 4, 8], [8, 7], [9]] (Correct)
  • [[4, 5, 8], [7, 8], [9]]
  • [[9], [7, 8], [4, 5, 8]]

Answer :[[5, 4, 8], [8, 7], [9]]

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

Consider below code:

Which of the following statements will replace # Line 2 such that on executing modified code, output will be: [5, 4, 3, 2, 1]?

Select 3 options.


Options are :

  • nums = nums[-1:0]
  • nums = nums[::-1] (Correct)
  • nums.sort(reverse=True) (Correct)
  • nums.sort(reverse=False)
  • nums.reverse() (Correct)

Answer :nums = nums[::-1] nums.sort(reverse=True) nums.reverse()

What will be the output of executing below code?


Options are :

  • ("India", "Pakistan", "Bangladesh", "Sri Lanka", "Hong Kong", "Afghanistan")
  • ["India", "Pakistan", "Bangladesh", "Sri Lanka", "Hong Kong", "Afghanistan"]
  • ('Afghanistan', 'Bangladesh', 'Hong Kong', 'India', 'Pakistan', 'Sri Lanka')
  • ['Afghanistan', 'Bangladesh', 'Hong Kong', 'India', 'Pakistan', 'Sri Lanka'] (Correct)

Answer :['Afghanistan', 'Bangladesh', 'Hong Kong', 'India', 'Pakistan', 'Sri Lanka']

What will be the output of executing below code?


Options are :

  • Error occurs at Line 2 during execution
  • ['a', 'l', 'm', 'o', 's', 't'] (Correct)
  • ['o', 'a', 'm', 't', 's', 'l']
  • almost
  • oamtsl

Answer :['a', 'l', 'm', 'o', 's', 't']

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

What will be the output of executing below code?


Options are :

  • [8.9, 2, 3.5, 6, '']
  • ['', 2, 3.5, 6, 8.9]
  • [2, 3.5, 6, 8.9, '']
  • Error occurs during the execution (Correct)
  • [2, 3.5, 6, 8.9]

Answer :Error occurs during the execution

Given the code fragment:

What is the result?


Options are :

  • [False, True, 1.1, 9] (Correct)
  • (False, True, 1.1, 9)
  • Line 2 causes error
  • [1.1, 9, True, False]
  • (1.1, 9, True, False)

Answer :[False, True, 1.1, 9]

Given the code fragment:

What is the result?


Options are :

  • False (Correct)
  • 0
  • 0.0
  • Error occurs during the execution

Answer :False

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

Given the code fragment:

What is the result?


Options are :

  • 0 (Correct)
  • 1
  • 2
  • Error occurs during the execution

Answer :0

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions