Difference between python function and decorator?
Write decorator function to calculate execution time by each function?
Example of a parametrized decorator.
What are kwargs and args ?
Difference between lists and tuples?
How are list stored in python?
What is pass by value in python?
What is first class object in python?
MRO in python
List comprehension example ?
Class initialization in python?
Program to remove duplicate element from a list?
Find all the number in string using regular expression
Difference between Container and virtualization?
Refer -https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/containers-vs-vm
1.what is difference between type() and isinstance()?
Whereas, isinstance(): returns true if the object argument is an instance of the classinfo argument, or of a (direct, indirect or virtual) subclass thereof.
- REST is representation state transfer whereas SOAP is simple object access protocol
- SOAP is a protocol where as REST is architectural pattern
- SOAP is stateful whereas REST is stateless
- REST is lightweight whereas SOAP is heavyweight because of the wsdl file
- SOAP is used in cases of shopping sites where state have to maintained between different pages
- REST is simple to code as compared to REST
- SOAP just support XML whereas REST supports xml,json
- REST supports only HTTP whereas SOAP support HTTP,FTP
3.How is data members hidden in python?
In Python, we use double underscore (
__
) before the attributes name to make those attributes private.
We can use single underscore (
4.What is metaclass?_
) before the attributes name to make those attributes protected.A metaclass is a class whose instances are classes. Like an "ordinary" class defines the behavior of the instances of the class, a metaclass defines the behavior of classes and their instances.
Metaclasses are not supported by every object-oriented programming language. That programming language, which supports metaclasses, considerably varies in the way they implement them. Python is supporting them.
Some programmers see metaclasses in Python as "solutions waiting or looking for a problem".
There are numerous use cases for metaclasses. Just to name a few:
logging and profiling
interface checking
registering classes at creation time
automatically adding new methods
automatic property creation
proxies
automatic resource locking/synchronization.
5. What is auto correlation?
- To detect non-randomness in data.
- To identify an appropriate time series model if the data are not random.
By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it.
7.What is Object relational Mapper ?
An object-relational mapper (ORM) is a code library that automates the transfer of data stored in relational databases tables into objects that are more commonly used in application code.
8.How to implement linked list in python?
class Node(object): def __init__(self, data=None, next_node=None): self.data = data self.next_node = next_node def get_data(self): return self.data def get_next(self): return self.next_node def set_next(self, new_next): self.next_node = new_next
9.What is advantage of linked list over array?
10.What is advantage of list comprehension and dictionary comphrension?
List comprehension is basically just a "syntactic sugar" for the regular
for
loop. In this case the reason that it performs better is because it doesn't need to load the append attribute of the list and call it as a function at each iteration. In other words and in general, list comprehensions perform faster because suspending and resuming a function's frame, or multiple functions in other cases, is slower than creating a list on demand.11.What is transparent data encryption?
Transparent Data Encryption (TDE) encrypts SQL Server, Azure SQL Database, and Azure SQL Data Warehouse data files, known as encrypting data at rest. You can take several precautions to help secure the database such as designing a secure system, encrypting confidential assets, and building a firewall around the database servers. However, in a scenario where the physical media (such as drives or backup tapes) are stolen, a malicious party can just restore or attach the database and browse the data. One solution is to encrypt the sensitive data in the database and protect the keys that are used to encrypt the data with a certificate. This prevents anyone without the keys from using the data, but this kind of protection must be planned in advance.
TDE performs real-time I/O encryption and decryption of the data and log files. The encryption uses a database encryption key (DEK), which is stored in the database boot record for availability during recovery. The DEK is a symmetric key secured by using a certificate stored in the master database of the server or an asymmetric key protected by an EKM module. TDE protects data "at rest", meaning the data and log files. It provides the ability to comply with many laws, regulations, and guidelines established in various industries. This enables software developers to encrypt data by using AES and 3DES encryption algorithms without changing existing applications.
13.What is collection in python?
This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers,
dict
, list
, set
, and tuple
.
factory function for creating tuple subclasses with named fields
| |
list-like container with fast appends and pops on either end
| |
dict-like class for creating a single view of multiple mappings
| |
dict subclass for counting hashable objects
| |
dict subclass that remembers the order entries were added
| |
dict subclass that calls a factory function to supply missing values
| |
wrapper around dictionary objects for easier dict subclassing
| |
wrapper around list objects for easier list subclassing
| |
wrapper around string objects for easier string subclassing
|
Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the Python memory manager. The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching.
At the lowest level, a raw memory allocator ensures that there is enough room in the private heap for storing all Python-related data by interacting with the memory manager of the operating system. On top of the raw memory allocator, several object-specific allocators operate on the same heap and implement distinct memory management policies adapted to the peculiarities of every object type. For example, integer objects are managed differently within the heap than strings, tuples or dictionaries because integers imply different storage requirements and speed/space tradeoffs. The Python memory manager thus delegates some of the work to the object-specific allocators, but ensures that the latter operate within the bounds of the private heap.
It is important to understand that the management of the Python heap is performed by the interpreter itself and that the user has no control over it, even if they regularly manipulate object pointers to memory blocks inside that heap. The allocation of heap space for Python objects and other internal buffers is performed on demand by the Python memory manager through the Python/C API functions listed in this document.
15.Difference between Pandas and numpy?
15.Difference between Pandas and numpy?
The
Pandas
module is used for working with tabular data. It allows us to work with data in table form, such as in CSV or SQL database formats. We can also create tables of our own, and edit or add columns or rows to tables. Pandas provides us with some powerful objects like DataFrames and Series which are very useful for working with and analyzing data.
The
Numpy
module is mainly used for working with numerical data. It provides us with a powerful object known as an Array. With Arrays, we can perform mathematical operations on multiple values in the Arrays at the same time, and also perform operations between different Arrays, similar to matrix operations.16.Difference between put and patch and post?
17.If a list is there in a tuple can it be modified?
Ans- Yes
Django follows a Model-View-Controller(MVC) architecture, which is split up into three different parts:
The Model is the logical data structure behind the entire application and is represented by a database(generally relational databases such as MySql, Postgres).
The View is the user interface — what you see in your browser when you visit a website. These are represented by HTML/CSS/Javascript files.
The Controller is the middleman that connects the view and model together, meaning that it is the one passing data from the model to the view.
Why do we use framework in python?
What the types of inheritance supported in pyton?
What is the problem of multiple inheritance and how is multiple inheritance tackled in python?
How is program compiled in python ?Explain the execution of python program
To “compile” a Python program into an executable, use a bundling tool, such as Gordon McMillan’s installer (alternative download) (cross-platform), Thomas Heller’s py2exe (Windows), Anthony Tuininga’s cx_Freeze (cross-platform), or Bob Ippolito’s py2app (Mac). These tools puts your modules and data files in some kind of archive file, and creates an executable that automatically sets things up so that modules are imported from that archive. Some tools can embed the archive in the executable itself.
How is abstraction done in python?
How is encapulation done in python?
Explain database connection in django?
numpy--advantages
Logger in python handlers
test python
pickling and unpickling?
Difference between instance method,class method and static method?
What is assumption in linear regression?
Difference between linear and logistic regression?
Difference between supervised and unsupervised learning?
Difference between regression and classification?
Difference files created when creating Django project?
What is the tear down request ?
how is python program executed?
What multi collinearity?
Difference between random forest /logistic regression?
Difference between List and tuple?
Answer- List is mutable and tuple is immutable
How to get index of number in list in python?
Answer-
>>> l = ["foo", "bar", "baz"]
>>> l.index('bar')
1
What is list comprehension?
What is difference between range and xrange?
Is the function overloading in python?
What is difference between encapsulation and abstraction?
Can you we pass parameter in lambda?
When do we use lambda express?
Small anonymous functions can be created with the
How do handle error in rest call?
Is self a reserved keyword in python?
Answer-No
Why do we use __ in front of init ?
Middleware-
how does django replace encryption
how does manage
cookies in django
multiple thread,multiple process
fstring in python
connection
different mode in pickle
iterate over dataframe
closure
late const
semantics in html
What is difference between range and xrange?
range() and xrange() are two functions that could be used to iterate a certain number of times in for loops in Python. In Python 3, there is no xrange , but the range function behaves like xrange in Python 2.If you want to write code that will run on both Python 2 and Python 3, you should use range().
range() – This returns a list of numbers created using range() function.
xrange() – This function returns the generator object that can be used to display numbers only by looping. Only particular range is displayed on demand and hence called “lazy evaluation“.
xrange() – This function returns the generator object that can be used to display numbers only by looping. Only particular range is displayed on demand and hence called “lazy evaluation“.
Both are implemented in different ways and have different characteristics associated with them. The points of comparisons are:
- Return Type
- Memory
- Operation Usage
- Speed
Return Type
range() returns – the list as return type.
xrange() returns – xrange() object.
What is difference between POST and PUT ?xrange() returns – xrange() object.
Is the function overloading in python?
What is difference between encapsulation and abstraction?
Can you we pass parameter in lambda?
When do we use lambda express?
Small anonymous functions can be created with the
lambda
keyword. This function returns the sum of its two arguments: lambda a, b: a+b
. Lambda functions can be used wherever function objects are required. They are syntactically restricted to a single expression. Semantically, they are just syntactic sugar for a normal function definition. Like nested function definitions, lambda functions can reference variables from the containing scope:How do handle error in rest call?
Is self a reserved keyword in python?
Answer-No
Why do we use __ in front of init ?
Middleware-
how does django replace encryption
how does manage
cookies in django
multiple thread,multiple process
fstring in python
connection
different mode in pickle
iterate over dataframe
closure
late const
semantics in html
Python allows you to focus on core functionality of the application by taking care of common programming tasks. The simple syntax rules of the Python programming language makes it easier for a developer to keep the code base readable and application maintainable.
ReplyDeletePython course in pune
Python classes in pune
python certification in pune
python course fees in pune
software testing institute in pune
software testing course in pune
software testing classes in pune
best software testing institute in pune
java courses in pune
java classes in pune
best java classes in pune
Core java classes in pune
java training institute in pune
java certification course in pune
Java Training in Pune
Java Training in Pune with Placement