Python - IT & Programming

Practice questions to test your knowledge and improve your understanding.

0
Answered
0
Correct
0%
Accuracy
Question 1 Medium Mcq

What will be the output of following code? d = lambda p: p * 2 t = lambda p: p * 3 x = 2 x = d(x) x = t(x) x = d(x) print x

Question 2 Easy Mcq

What is the purpose of the map function?

Question 3 Medium Mcq

Which of the following code samples will read arguments if the script is run from the command line?

Question 4 Medium Mcq

Invoking the ___ method converts raw byte data to a string?

Question 5 Easy Mcq

What is one of the most common use of Python's sys library?

Question 6 Medium Mcq

Which of the following will throw an exception in Python?

Question 7 Medium Mcq

Find the output of the following Python code and choose the correct answer from the given options.double = lambda x: x * 2mt = [1, 5, 4, 6, 8, 11, 3, 12]ns = list(filter(lambda x: (x%2 == 0) , mt))print(double(6))print(ns)

Question 8 Medium Mcq

How can an element be removed from a list using its list index?

Question 9 Easy Mcq

What is the basic difference between theses two operations in 're' module: match() and search()?

Question 10 Medium Mcq

Which of the following options does not contain duplicate elements?

Question 11 Medium Mcq

Read the following statements:>>> import string>>> str = "Mary had a lamp in her Hand">>> str = string.replace(str, 'ha', 'stan')>>> strWhich of the following will be the output?

Question 12 Easy Mcq

What is the correct syntax for instantiating a new object of the type Game?

Question 13 Medium Mcq

Analyse the given Python code and answer the question that follows.def att_d(fun):fun.data = 3return fun@att_ddef xyz (x. y):return x + y鈥�print(xyz(2, 23))print(xyz.data)What will be the correct output of the above Python code?

Question 14 Medium Mcq

In Python 3.2's stand CPython implementation, all built-in types support weak-referencing.

Question 15 Medium Mcq

What will typing the following at the Python interpreter produce? sequence = ['A','B','C','D','E','F'] ; sequence[1:2:3]

Question 16 Medium Mcq

Read the following statements:>>> import string>>> s = 'mary\011had a little lamb'>>> print sWhich of the following will be the output of the above code snippet?

Question 17 Medium Mcq

class Foo(object): def bar(self, x): pass foo = Foo() is foo.bar and foo.bar.__func__ is the same object?

Question 18 Medium Mcq

Various email and news clients store messages in a variety of formats, many providing hierarchical and structured folders. Which of the following provides a uniform API for reading the messages stored in all the most popular folder formats?

Question 19 Medium Mcq

Which of these will allow you to put more than one statement in one line of text?

Question 20 Medium Mcq

Which Python implementation is best for testing Java code?

Question 21 Medium Mcq

Which of the following databases can be used with Python?1. MySQL2. Oracle3. Maria DB4. Microsoft SQL Server

Question 22 Medium Mcq

Consider the Python 3.4.2 code that is given in the image. Choose the correct line(s) number from thefollowing options that will not give an output as "None".

Question 23 Medium Mcq

What will be the correct output of the following Python code?lst = [3, 1, 2, 5, 4, 3, 8]del lst[2 : 5]print (end="")for i in range(0, len(lst)):print(lst[i]+1, end=" ")print("\r")lst.pop(2)print (end="")for i in range(0, len(lst)):print(lst[i]+2, end=" ")

Question 24 Medium Mcq

What will be the correct output of the following Python code?lis = [11, 22, 33]lis1 = [14, 5, 6]lis2= lis + lis1print (end="")for i in range(0,len(lis2)):print (lis2[i]*1, end=" ")print ("\r")lis3 = lis * 2print (end="")for i in range(0,len(lis3)):print (lis3[i]+1, end=" ")

Question 25 Easy Mcq

What is the index of the first item in a tuple or list?

Question 26 Medium Mcq

All Warnings in Python are subclassed from:

Question 27 Easy Mcq

What is a future statement?

Question 28 Medium Mcq

The side option of the pack manager may be _____?

Question 29 Medium Mcq

What built-in list method would you use to remove items from a list?

Question 30 Medium Mcq

Which of the following code snippets concatenates the list a_list = [1, 2, 3] with the tuple a_tuple = (4, 5), so the result would be [1, 2, 3, 4, 5]?

Question 31 Medium Mcq

Python 2.3+ includes a standard module that implements a set datatype. Which of the following statements is true about the set datatype?

Question 32 Medium Mcq

Choose the option below for which instance of the class cannot be created

Question 33 Medium Mcq

What will be the output of this code? [1,2,3] * 3

Question 34 Medium Mcq

Which of the following is true regarding urlopen function from the standard module urllib in Python 2?

Question 35 Medium Mcq

Read the following code snippet: >>> o1 = C() >>> o1.lst = [1,2,3] >>> o3 = copy.deepcopy(o1) >>> o1.lst.append(17) What will be the output of '>>> o3.lst' and '>>> o1.lst'?

Question 36 Medium Mcq

Which of the following is floor division ?

Question 37 Medium Mcq

How can you define a tuple having one element?

Question 38 Medium Mcq

What will be the output of the following? my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] new_list = list(filter(lambda x: (x%2 == 0) , my_list)) print(new_list)

Question 39 Medium Mcq

Which of the following functions is used to send audio data via the Internet?

Question 40 Medium Mcq

What will be the correct output of the following Python code?import matha = 3.4536print ("Result = ",end="")print (math.trunc(a)+math.ceil(a)+math.floor(a))

Question 41 Easy Mcq

What is the method to retrieve the list of all active thread objects?

Question 42 Medium Mcq

On a Unix-like system, what does Python's sleep.time() function block?

Question 43 Easy Mcq

When opening a file, what is the difference between text mode and binary mode?

Question 44 Medium Mcq

Which statement is true regarding the __all__ module level variable?

Question 45 Medium Mcq

Which of the following is the base language of Python?

Question 46 Medium Mcq

Which of the following code samples will determine the last day of a given month?

Question 47 Medium Mcq

Which built-in Python function can be used to get the length of a list, tuple, string, dictionary or other object?

Question 48 Medium Mcq

What will be the correct output of the following Python code?def abc():y = 2018if (y % 4) == 0:if (y % 100) == 0:if (y % 400) == 0:print("0")else:print("1")else:print("0")else:print("1")abc()

Question 49 Medium Mcq

Which of these is NOT a characteristic of namedtuples?

Question 50 Medium Mcq

What are the states/features supported by a RLock object?

Showing 50 of 835 questions