Q. A peer,was explaining to his team,the concept of partial functions,in Python.
He gave them the following example:
from functools import partial
def partial_eg(first,second,third):
return first* second* third
result = partial(partial_eg,5,8)
print(result(2))
Mark the correct answer.
Q. Developers were provided,the following statements,about Caching in Python,in an interview.They were asked to mark them as True or False:
Using Memcached is a nice option,when the application system,is spread across a network.
Python has a data structure lfu_cache,which uses least frequently used algorithm,to limit the cache size.
If the memcached server goes down,the client keeps sending a request,till the time-out limit is reached.s
We can use memcache,as a data store,as well as,a cache.
Choose the correct answer.
Q. A group of developers were involved,in a debate about Python 2 and 3 differences: DevA- In Python3,there are two byte classes - the bytearray and byte.In Python2, there is no byte type present.Filter() and map() return lists in Python2.Python3 raises a SyntaxError, if exception arguments are not enclosed in parentheses. DevB- In Python3, TypeError is raised as a warning,if unorderable types are compared.The same does not happens with Python2.Filter() returns a list in Python2 and Python3 version,but, map() returns the same, only in Python2.Python3 never raises a SyntaxError, if exception arguments are not enclosed in parentheses. DevC- Both Python versions,have a byte type present.A bytearray type,is not present in Python2.In Python3 and Python2 version,map() returns a list,wheres filter() returns a list only in Python2.
Mark the correct output of the same.
Q. A developer was working with Numpy library. He was told,to create the following types of arrays:
Create an 2x3 array, of complex type, with real value number 3.
Create a 4x1 array,containing all zeros.
Create a sequence of integers,from 0 to 25 with steps of 4.
Mark the appropriate syntax, to do the above.(NOTE: np is the numpy object)
Q. A lead was teaching his team,about the zipping files,in Python.He stated the following:
The compression using the python zipfile is lossless.
Python zipfile can also create encrypted files,or,handle multi-disk ZIP files.
The Zipfile, creates just a single file that contains all the compressed files.
Files that handle ZIP64 extensions, can be handled by the zipfile module.
Choose the right option.
Q. A developer was told,to provide a customised message('This key does not exists'),if any key that was searched,was not present in the dictionary. If the existing code was as follows: