Python Developer

  Home  Web Development  Python Developer


“Python Developer related Frequently Asked Questions by expert members with professional career as Python Developer. These list of interview questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts”



77 Python Developer Questions And Answers

21⟩ Suppose ou are having multiple Memcache servers running Python, in which one of the memcacher server fails, and it has your data, will it ever try to get key data from that one failed server?

The data in the failed server won’t get removed, but there is a provision for auto-failure, which you can configure for multiple nodes. Fail-over can be triggered during any kind of socket or Memcached server level errors and not during normal client errors like adding an existing key, etc.

 130 views

22⟩ Do you know how is Multithreading achieved in Python?

☛ Python has a multi-threading package but if you want to multi-thread to speed your code up.

☛ Python has a construct called the Global Interpreter Lock (GIL). The GIL makes sure that only one of your ‘threads’ can execute at any one time. A thread acquires the GIL, does a little work, then passes the GIL onto the next thread.

☛ This happens very quickly so to the human eye it may seem like your threads are executing in parallel, but they are really just taking turns using the same CPU core.

☛ All this GIL passing adds overhead to execution. This means that if you want to make your code run faster then using the threading package often isn’t a good idea.

 168 views

23⟩ Tell me what Flask is and its benefits?

Flask is a web micro framework for Python based on “Werkzeug, Jinja2 and good intentions” BSD license. Werkzeug and Jinja2 are two of its dependencies. This means it will have little to no dependencies on external libraries. It makes the framework light while there is little dependency to update and less security bugs.

A session basically allows you to remember information from one request to another. In a flask, a session uses a signed cookie so the user can look at the session contents and modify. The user can modify the session if only it has the secret key Flask.secret_key.

 150 views

24⟩ Explain me what Is The Statement That Can Be Used In Python If The Program Requires No Action But Requires It Syntactically?

The pass statement is a null operation. Nothing happens when it executes. You should use “pass” keyword in lowercase. If you write “Pass” you’ll face an error like “NameError: name Pass is not defined.” Python statements are case sensitive.

letter = "hai friend"

for i in letter:

if i == "a":

pass

print("pass statement is execute ..............")

else:

print(i)

 140 views

25⟩ Explain me what Are The Principal Differences Between The Lambda And Def?

☛ Lambda Vs Def.

def can hold multiple expressions while lambda is a uni-expression function.

def generates a function and designates a name so as to call it later. lambda forms a function and returns the function itself.

def can have a return statement. lambda can’t have return statements

lambda supports to get used inside a list and dictionary.

 142 views

30⟩ Tell me what is the difference between Django, Pyramid, and Flask?

Flask is a “microframework” primarily build for a small application with simpler requirements. In flask, you have to use external libraries. Flask is ready to use.

Pyramid are build for larger applications. It provides flexibility and lets the developer use the right tools for their project. The developer can choose the database, URL structure, templating style and more. Pyramid is heavy configurable.

Like Pyramid, Django can also used for larger applications. It includes an ORM.

 132 views

31⟩ Tell me how Memcached should not be used in your Python project?

☛ • Memcached common misuse is to use it as a data store, and not as a cache

☛ • Never use Memcached as the only source of the information you need to run your application. Data should always be available through another source as well

☛ • Memcached is just a key or value store and cannot perform query over the data or iterate over the contents to extract information

☛ • Memcached does not offer any form of security either in encryption or authentication

 177 views

32⟩ Explain me inheritance in Python with an example?

Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code reusability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class.

They are different types of inheritance supported by Python:

☛ Single Inheritance – where a derived class acquires the members of a single super class.

☛ Multi-level inheritance – a derived class d1 in inherited from base class base1, and d2 is inherited from base2.

☛ Hierarchical inheritance – from one base class you can inherit any number of child classes

☛ Multiple inheritance – a derived class is inherited from more than one base class.

 161 views

33⟩ Tell me what is Flask & its benefits?

Flask is a web micro framework for Python based on “Werkzeug, Jinja 2 and good intentions” BSD licensed. Werkzeug and jingja are two of its dependencies.

Flask is part of the micro-framework. Which means it will have little to no dependencies on external libraries. It makes the framework light while there is little dependency to update and less security bugs.

 164 views

35⟩ Explain what is namespace in Python?

In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed. Whenever the variable is searched out, this box will be searched, to get corresponding object.

 182 views

38⟩ Do you know what Are The Optional Statements That Can Be Used Inside A <Try-Except> Block In Python?

There are two optional clauses you can use in the <try-except> block.

☛ The <else> clause

☛ It is useful if you want to run a piece of code when the try block doesn’t create any exception.

☛ The <finally> clause

☛ It is useful when you want to execute some steps which run, irrespective of whether there occurs an exception or not.

 172 views