Python Certification Exam Preparation Set 53

Which of the following is a use case of Python?


Options are :

  • Cyber Security (Correct)
  • Data Science (Correct)
  • Web Scrapping (Correct)
  • Web Scrapping (Correct)

Answer :Cyber Security Data Science Web Scrapping Web Scrapping

Python is strongly typed laguage


Options are :

  • True
  • False (Correct)

Answer :False

Python Certification Exam Preparation Set 8

Creating a list in 'one line' of code is better known as:


Options are :

  • List creation
  • Pythonic Code
  • Linear Looping
  • List Comprehension (Correct)

Answer :List Comprehension

"Now is better than never."

Is the quote from where/ by whom?


Options are :

  • Quoted in Zen of Python (Correct)
  • Quoted by the open source community to praise the Python
  • Quoted by Linus Torvald on the release of Linux
  • Quoted by Guido van Rossum on the release of Python 3.x

Answer :Quoted in Zen of Python

Which of the following is not a data type in python?


Options are :

  • Frozen Set
  • Set
  • List
  • None of the above (Correct)

Answer :None of the above

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

Which of the following is not a in-built module/package for the Python?


Options are :

  • math
  • hashlib
  • sqlite3
  • numpy (Correct)

Answer :numpy

Popular package installer for the Python is


Options are :

  • apt-get
  • pip (Correct)
  • npm
  • gem

Answer :pip

Python 3.x is the only version maintained by the community


Options are :

  • True (Correct)
  • False

Answer :True

Python Certification Exam Preparation Set 32

What will the output of the following snippet?


Options are :

  • (Correct)

Answer :

Python Certification Exam Preparation Set 31

What will be the output of the following snippet?


Options are :

  • [5,6,7,8,1,1,1,1] (Correct)
  • [5,6,7,8,1]
  • Error: Can't perform addition on non integers types
  • [6,7,8,9]

Answer :[5,6,7,8,1,1,1,1]

What is the best way to check if list is empty or not?

[ not that all of the below can be used to check if the list is empty or not, choose the most pythonic approach ]


Options are :

  • if len(lst) == 0: return "empty"
  • try: a = lst[0] except: return "empty"
  • if lst: return "not empty" (Correct)
  • return lst.isempty( )

Answer :if lst: return "not empty"

What will be the output of the following snippet?


Options are :

  • ('h', 'e', 'l', 'o')
  • ['hello']
  • Error: Can not explicitly convert a str object to list.
  • ['h', 'e', 'l', 'l', 'o'] (Correct)

Answer :['h', 'e', 'l', 'l', 'o']

Python Certification Exam Preparation Set 64

What will be the value of "lst3" mentioned in the snippet below?


Options are :

  • [1,4,3,2,2]
  • [1,2,3,4,5]
  • [1,4,3,[2,5]]
  • [1,4,3,2,5] (Correct)

Answer :[1,4,3,2,5]

List is useful to identify the unique values in the iterator.


Options are :

  • False (Correct)
  • True

Answer :False

Is this code fine? If not, where is the error?


Options are :

  • Code is completely fine and will give the output: 3.5
  • Line 4 because we have to print the statement to get the output.
  • Line 3 because there is an extra "," at the end of the list
  • Line 2 because avg( ) is not a default function (Correct)

Answer :Line 2 because avg( ) is not a default function

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

What will the lst1 contain at the end of following snippet?


Options are :

  • All the even numbers ranging from 1 to 100
  • All the numbers from 1 to101 multiplied by 2
  • All the numbers odd numbers ranging from 1 to 100 (Correct)
  • All the odd numbers ranging from 1 and 101

Answer :All the numbers odd numbers ranging from 1 to 100

Notice the given snippet:

According to your observation, what can be the ** SECRET ** in following snippet?

>>> denotes the python console


Options are :

  • ['a','b','c',4] (Correct)
  • ['a','b','c']
  • 4
  • ['a','b','c','d']

Answer :['a','b','c',4]

What will be the value of "lst3" mentioned in the snippet below?


Options are :

  • [1,1,2,3,5]
  • [1,2,3,1,5]
  • [1,2,3,[1,5]] (Correct)
  • [1,5,1,2,3]

Answer :[1,2,3,[1,5]]

Python Certification Exam Preparation Set 4

Have a look at the following snippet:

>>> ** SECRET MOVE **


Which among the following, can be the secret move mentioned in the snippet, gave the latter result?


[ here >>> denotes the python console ]


Options are :

  • >>> lst1.sort( )
  • >>> sorted(lst1, reverse = True)
  • >>> lst1.sort( reverse = True) (Correct)
  • >>> lst1.reverse( )

Answer :>>> lst1.sort( reverse = True)

Select all the functions we can use with <class 'list'> u


Options are :

  • sum( ) (Correct)
  • max( ) (Correct)
  • enumerate( ) (Correct)
  • len( ) (Correct)

Answer :sum( ) max( ) enumerate( ) len( )

I want to convert the following list:

['1','2','3','4','5']

to the list which looks like this:

[1,2,3,4,5]

Which is the most pythonic way to achieve the result?


Options are :

  • Once the list is created it can not be changed
  • map( ) (Correct)
  • for loop + int( )
  • int( )

Answer :map( )

Python Certification Exam Preparation Set 15

What will be the output of the following snippet?


Options are :

  • None of the above
  • [1,2,3,4,5,6,7,8,9]
  • [5,6,2,1,3,4,8,7,9] (Correct)
  • [9,8,7,6,5,4,3,2,1]

Answer :[5,6,2,1,3,4,8,7,9]

What will be the output of the following snippet:


Options are :

  • '1'-'2'-'3'-'4'-'5'
  • '1-2-3-4-5'
  • 1-2-3-4-5
  • None of the above (Correct)

Answer :None of the above

What is the output of this code?


Options are :

  • Second
  • First Second
  • Third (Correct)
  • First

Answer :Third

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

What is the output of this code?


Options are :

  • Third
  • First
  • First Third (Correct)
  • Second

Answer :First Third

How would you fill in the blank areas (1)__, 2)__, etc.) to make the following code return the expected output:

Expected output:

Code:


Options are :

  • 1) if 2) if 3) else (Correct)
  • 1) while 2) if 3) else
  • There is no way to achieve this output.
  • 1) if 2) elif 3) else

Answer :1) if 2) if 3) else

What would be the value of the names variable after running this code?


Options are :

  • []
  • ['Alice', 'Bob']
  • ['Alice', 'Bob', 'Lance', 'Mike'] (Correct)
  • ['Alice', 'Bob', 'Lance']

Answer :['Alice', 'Bob', 'Lance', 'Mike']

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

What is the output of this code?


Options are :

  • Second
  • First Second
  • Third
  • First (Correct)

Answer :First

What is the output of this code?


Options are :

  • 3 6
  • 3
  • 1 4
  • This would cause an infinite loop and not print anything. (Correct)

Answer :This would cause an infinite loop and not print anything.

What is the output of the following code?


Options are :

  • 6 (Correct)
  • None
  • 3

Answer :6

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

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions