11.What are the disadvantages of using Python?
1. Python is slow as compared to other programming languages. Although, this slow pace doesn’t matter much, at times, we need other language to handle performance-critical situations.
2. It is ineffective on mobile platforms; fewer mobile applications are developed using python. The main reason behind its instability on smartphones is Python’s weakest security. There are no good secure cases available for Python until now
3. Due to dynamic typing, Programmers face design restrictions while using the language. The code needs more and more testing before putting it into action since the errors pop up only during runtime.
12. Explain the use of split function?
The split() function in Python breaks a string into shorter strings using the defined separator. It renders a list of all words present in the string.
>>> y= ‘true,false,none’
Result: (‘true’, ‘false’, ‘none’)
What is the use of generators in Python?
Generators are primarily used to return multiple items but one after the other. They are used for iteration in Python and for calculating large result sets. The generator function halts until the next time request is placed.
One of the best uses of generators in Python coding is implementing callback operation with reduced effort and time. They replace callback with iteration. Through the generator approach, programmers are saved from writing a separate callback function and pass it to work-function as it can applying ‘for’ loop around the generator.
13. How to create a multidimensional list in Python?
As the name suggests, a multidimensional list is the concept of a list holding another list, applying to many such lists. It can be one easily done by creating single dimensional list and filling each element with a newly created list.
14. What is lambda?
lambda is a powerful concept used in conjunction with other functions like filter(), map(), reduce(). The major use of lambda construct is
to create anonymous functions during runtime, which can be used where they are created. Such functions are actually known as throw-away functions in Python. The general syntax is lambda argument_list:expression.
>>> def intellipaat1 = lambda i, n : i+n
>> intellipaat = [1, 6, 11, 21, 29, 18, 24]
>> print filter (lambda x: x%3 = = 0, intellipaat)
[6, 21, 18, 24]
15. Define Pass in Python?
The pass statement in Python is equivalent to a null operation and a placeholder, wherein nothing takes place after its execution. It is mostly used at places where you can let your code go even if it isn’t written yet.
If you would set out a pass after the code, it won’t run. The syntax is pass
16. How to perform Unit Testing in Python?
Referred to as PyUnit, the python Unit testing framework-unittest supports automated testing, seggregating test into collections, shutdown testing code and testing independence from reporting framework. The unittest module makes use of TestCase class for holding and preparing test routines and clearing them after the successful execution.
17. Define Python tools for finding bugs and performing static analysis?
. PyChecker is an excellent bug finder tool in Python, which performs static analysis unlike C/C++ and Java. It also notifies the programmers about the complexity and style of the code. In addition, there is another tool, PyLint for checking the coding standards including the code line length, variable names and whether the interfaces declared are fully executed or not.
18. How to convert a string into list?
Using the function list(string). For instance:
>>> list(‘intellipaat’) in your lines of code will return
[‘i’, ‘n’, ‘t’, ‘e’, ‘l’, ‘l’, ‘i’, ‘p’, ‘a’, ‘a’, ‘t’]
In Python, strings behave like list in various ways. Like, you can access individual characters of a string
>> > y = “intellipaat”
19. What OS do Python support?
Linux, Windows, Mac OS X, IRIX, Compaq, Solaris
20. Name the Java implementation of Python?