Join Our Email Alerts-Subscribe
Important Note:Login & Check Your Email Inbox and Activate Confirmation Link

Enter Your Email :

Copyright Disclaimer:
Section 107 of the Copyright Act Fair Use Contents .
We are forwarding content link(s) from our website to content website & We are not serving any contents.
Main the Content PDF link(s) is/are obtained from GoogleSearch
for the purpose of Education & Teaching Intention. Not for commercial purpose. is not liable/responsible for any copyright issues.

Python Materials-Free Download

26) Mention what are the rules for local and global variables in Python? 

Local variables: If a variable is assigned a new value anywhere within the function's body, it's assumed to be local. 

Global variables: Those variables that are only referenced inside a function are implicitly global. 

27) How can you share global variables across modules? 

To share global variables across modules within a single program, create a special module. Import the config module in all modules of your application. The module will be available as a global variable across modules. 

28) Explain how can you make a Python Script executable on Unix? 

To make a Python Script executable on Unix, you need to do two things,

• Script file's mode must be executable and

• the first line must begin with # ( #!/usr/local/bin/python)

29) Explain how to delete a file in Python? 

By using a command os.remove (filename) or os.unlink(filename) 

30) Explain how can you generate random numbers in Python? 

To generate random numbers in Python, you need to import command as 

import random 


This returns a random floating point number in the range [0,1) 

31) Explain how can you access a module written in Python from C? 

You can access a module written in Python from C by following method, 

Module = =PyImport_ImportModule(""); 

32) Mention the use of // operator in Python? 

It is a Floor Divisionoperator , which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance, 10//5 = 2 and 10.0//5.0 = 2.0. 

33) Mention five benefits of using Python? 

• Python comprises of a huge standard library for most Internet platforms like Email, HTML, etc.

• Python does not require explicit memory management as the interpreter itself allocates the memory to new variables and free them automatically 

• Provide easy readability due to use of square brackets

• Easy-to-learn for beginners

• Having the built-in data types saves programming time and effort from declaring variables

34) Mention the use of the split function in Python? 

The use of the split function in Python is that it breaks a string into shorter strings using the defined separator. It gives a list of all words present in the string. 

35) Explain 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. 

36) Mention 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. 

37) Mention what is Flask-WTF and what are their features? 

Flask-WTF offers simple integration with WTForms. Features include for Flask WTF are 

• Integration with wtforms

• Secure form with csrf token

• Global csrf protection

• Internationalization integration

• Recaptcha supporting

• File upload that works with Flask Uploads

38) Explain what is the common way for the Flask script to work? 

The common way for the flask script to work is 

• Either it should be the import path for your application

• Or the path to a Python file

39) Explain how you can access sessions in Flask? 

A session basically allows you to remember information from one request to another. In a flask, it 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. 

41) Explain database connection in Python Flask? 

Flask supports database powered application (RDBS). Such system requires creating a schema, which requires piping the shema.sql file into a sqlite3 command. So you need to install sqlite3 command in order to create or initiate the database in Flask. 

Flask allows to request database in three ways 

• before_request() : They are called before a request and pass no arguments

• after_request() : They are called after a request and pass the response that will be sent to the client

• teardown_request(): They are called in situation when exception is raised, and response are not guaranteed. They are called after the response been constructed. They are not allowed to modify the request, and their values are ignored. 

42) You 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. 

43) Explain how you can minimize the Memcached server outages in your Python Development? 

• When one instance fails, several of them goes down, this will put larger load on the database server when lost data is reloaded as client make a request. To avoid this, if your code has been written to minimize cache stampedes then it will leave a minimal impact 

• Another way is to bring up an instance of Memcached on a new machine using the lost machines IP address 

• Code is another option to minimize server outages as it gives you the liberty to change the Memcached server list with minimal work 

• Setting timeout value is another option that some Memcached clients implement for Memcached server outage. When your Memcached server goes down, the client will keep trying to send a request till the time-out limit is reached 

44) Explain what is Dogpile effect? How can you prevent this effect? 

Dogpile effect is referred to the event when cache expires, and websites are hit by the multiple requests made by the client at the same time. This effect can be prevented by using semaphore lock. In this system when value expires, first process acquires the lock and starts generating new value. 

45) Explain 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

Source: Contents are provided by Technicalsymposium Google Group Members. 
Disclaimer: All the above contents are provided by Google Group members. 
Further, this content is not intended to be used for commercial purpose. is not liable/responsible for any copyright issues.

Download Technical Interview Materials PDF-Free Download

Technical Interview Questions and Answers Notes PDF
Placement Materials PDF-Free Download Study Materials PDF-Free Download Live Support-Chat with Our Experts

Official Contact: +91-9245556793 (Whatsapp Message / SMS / Voice Call)

Our Expert team is ready to answer all your questions immediately-Feel free to speak in Tamil/English.

(Example:Events info/Lecture Notes/Off-Campus & All Jobs/Projects & All education information)

Working hrs (IST): (Morning: 10:00AM-3:00 PM) and (Evening:5:00 PM to 10:00 PM)

All Latest Question & Answer Page (FAQ)-Click here