  ## Python Certification Exam Preparation Set 25

Options are :

• 0.0
• 1.0
• 0 (Correct)
• 1

##### What will be the output of the following Python code?`l1=[1,2,3]l2=[4,5,6][x*y for x in l1 for y in l2]`

Options are :

• [4, 5, 6, 8, 10, 12, 12, 15, 18] (Correct)
• [4, 8, 12, 5, 10, 15, 6, 12, 18]
• [18, 12, 6, 15, 10, 5, 12, 8, 4]
• [4, 10, 18]

Answer :[4, 5, 6, 8, 10, 12, 12, 15, 18]

##### Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?

Options are :

• print(list1)
• print(list1[:-2])
• all of the mentioned (Correct)
• print(list1[:2])

##### What is the output of print(k) in the following Python code snippet?`k = [print(i) for i in my_string if i not in "aeiou"]print(k)`

Options are :

• all characters of my_string that aren't vowels
• list of Falses
• list of Trues
• a list of Nones (Correct)

Options are :

• None
• 2
• 25 (Correct)
• Error

##### To shuffle the list(say list1) what function do we use?

Options are :

• random.shuffleList(list1)
• list1.shuffle()
• shuffle(list1)
• random.shuffle(list1) (Correct)

##### What is the value of the following expression?`8/4/2, 8/(4/2)`

Options are :

• (1.0, 1.0)
• (1.0, 4.0) (Correct)
• (4.0, 4.0)
• (4.0. 1.0)

##### Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?

Options are :

• [2, 33, 222, 14] (Correct)
• Error
• [25, 14, 222, 33, 2]
• 25

##### Which of the following is the correct expansion of list_1 = [expr(i) for i in list_0 if func(i)]?

Options are :

• list_1 = [] for i in list_0: if func(i): list_1.append(i)
• list_1 = [] for i in list_0: if func(i): list_1.append(expr(i)) (Correct)
• none of the mentioned
• for i in list_0: if func(i): list_1.append(expr(i))

Answer :list_1 = [] for i in list_0: if func(i): list_1.append(expr(i))

##### What will be the output of the following Python code snippet?`k = [print(i) for i in my_string if i not in "aeiou"]`

Options are :

• prints all the vowels in my_string
• prints only on executing print(k)
• prints all characters of my_string that aren't vowels (Correct)
• prints all the consonants in my_string

Answer :prints all characters of my_string that aren't vowels

##### What will be the output of the following Python code snippet?`print([[i+j for i in "abc"] for j in "def"])`

Options are :

• ['ad', 'ae', 'af', 'bd', 'be', 'bf', 'cd', 'ce', 'cf']
• ['da', 'ea', 'fa', 'db', 'eb', 'fb', 'dc', 'ec', 'fc']
• [['ad', 'bd', 'cd'], ['ae', 'be', 'ce'], ['af', 'bf', 'cf']] (Correct)
• [['da', 'db', 'dc'], ['ea', 'eb', 'ec'], ['fa', 'fb', 'fc']]

##### The value of the expressions 4/(3*(2-1)) and 4/3*(2-1) is the same.

Options are :

• True (Correct)
• False

Options are :

• 1 (Correct)
• 3
• 5
• 25

##### Who created Python?

Options are :

• Guido ban Rossum
• Guido van Rossum (Correct)
• Guido the Russian
• Guodo van Rossum

##### Which of the following is not a python version?

Options are :

• CPython
• Cython
• Jython
• PyPY
• Zython (Correct)

##### Name a tool which helps to launch your code step by step and allow you to inspect it at each moment of execution:

Options are :

• Editor
• Compiler
• Debugger (Correct)
• Console

##### Select the correct code from the given options to match the below expected output:`Python-Essentials->Must-Read`

Options are :

• print("Python","Essentials", sep="-", end="->") print("Must","Read", sep="-") (Correct)

Options are :

• Octal
• Binary
• Decimal

##### An integer number preceded by an 0o (Zero-o) will be treated as:

Options are :

• Octal (Correct)
• Binary
• Decimal

Options are :

• 2 (Correct)
• 10
• 8
• 16

Options are :

• 2
• 8
• 10
• 16 (Correct)

Options are :

• 2
• 8 (Correct)
• 10
• 16

Options are :

• 2
• 8
• 10 (Correct)
• 16

##### Which of the following code will give an error?

Options are :

• print('I like "Python" ')
• print("I like \"Python\" ")
• print("I like 'Python' ")
• print("I like "Python" ") (Correct)

##### What will be the output of the following code snippet?print(True > False)print(True < False)

Options are :

• 1 0
• 0 1
• True False (Correct)
• False True

##### Lists can be nested.

Options are :

• True (Correct)
• False

##### Which of the following is the correct way to define a function in Python?

Options are :

• def fun(): (Correct)
• del fun():
• desc fun():
• defi fun():

##### The len() function is used:

Options are :

• To increase the length of the List.
• To check the length of the List. (Correct)
• To get log value of the number.
• None of these option.

Answer :To check the length of the List.

##### Dictionary in Python is a mutable data structure.

Options are :

• True (Correct)
• False

##### Which of the following is incorrect for a dictionary in Python?

Options are :

• each key must be unique
• the key should be an immutable object
• the len() function returns the numbers of key-value elements in the dictionary
• the len() function returns the sum of key-value elements in the dictionary (Correct)

Answer :the len() function returns the sum of key-value elements in the dictionary

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions