SlideShare uma empresa Scribd logo
1 de 5
Python Interview Questions
A list of top frequently asked Python interview questions
and answers are given below.
1) What is Python?
Python is a high level object-oriented programming language
with objects, modules, threads, exceptions and automatic
memory management. It is a simple yet powerful
programming language. It can run equally on different
platforms such as Windows, Linux, UNIX, Macintosh etc. Thus,
Python is a portable language.
2) What are the advantages of Python?
Following are the main advantages of using Python.
◦ Free and open source
◦ Portable
◦ Extensible
◦ Object oriented
◦ Built-in data structure
3)What is PEP 8?
PEP 8 is a coding convention which specifies a set of
guidelines, about how to write your Python code more
readable.
4) What is used to create Unicode string in
Python?
You should use "Unicode" before the string. For example:
Unicode (text).
5) Explain how Python is interpreted?
Python is an interpreted language. The Python language
program runs directly from the source code. It converts the
source code into an intermediate language, which is again
translated into machine language that has to be executed.
6) How memory is managed in Python?
Memory is managed in Python in following way:
◦ Memory is managed in Python by private heap space. All
Python objects and data structures are located in a
private heap. The programmer does not have an access
to this private heap and interpreter takes care of this
Python private heap.
◦ Python memory manager is responsible for allocating Python
heap space for Python objects.
◦ Python also have an inbuilt garbage collector, which recycle
all the unused memory and frees the memory and makes
it available to the heap space.
7) What is Python decorator?
A Python decorator is a specific change made within Python
syntax to alter functions easily.
8) What are the rules for local and global
variable in Python?
In Python, variables that are only referenced inside a function
are called implicitly global. If a variable is assigned a new
value anywhere within the function's body, it's assumed to be
a local. If a variable is ever assigned a new value inside the
function, the variable is implicitly local, and you need to
explicitly declare it as 'global'.
9) What is namespace in Python?
In Python, every name 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.
10) What are iterators in Python?
In Python, iterators are used to iterate a group of elements,
containers like list.
11) What is generator in Python?
In Python, generator is a way that specifies how to implement
iterators. It is a normal function except that it yields
expression in the function.
12) What is slicing in Python?
Slicing is a mechanism used to select a range of items from
sequence type like list, tuple, string etc.
13) What is dictionary in Python?
The built-in datatypes in Python is called dictionary. It defines
one-to-one relationship between keys and values. Dictionaries
contain pair of keys and their corresponding values.
Dictionaries are indexed by keys.
Let's take an example
The following example contains some keys ? Country Hero &
Cartoon. Their corresponding values are India, Modi and Rahul
respectively.
1 >>> dict = {'Country': 'India', 'Hero': 'Modi', 'Cartoon': 'Rah
ul'}
2 >>>print dict[Country]
3 India
4 >>>print dict[Hero]
5 Modi
6 >>>print dict[Cartoon]
7 Rahul
14) What is Pass in Python?
Pass specifies a Python statement without operations. It is a
place holder in a compound statement, where there should be
a blank left and nothing has to be written there.
15) Explain docstring in Python?
A Python documentation string is called docstring. It is used
for documenting Python functions, modules and classes.
16) What is negative index in Python?
Python sequences are indexed in positive and negative
numbers. For example: 0 is the first positive index, 1 is the
second positive index and so on. For negative indexes -1 is the
last negative index, -2 is the second last negative index and so
on.
17) What is pickling and unpickling in
Python?
Pickling is a process in which a pickle module accepts any
Python object, converts it into a string representation and
dumps it into a file by using dump() function.
Unpickling is a process of retrieving original Python object
from the stored string representation for use.
Pickleis a standard modulewhich serializes and de-serializes
a Python objectstructure.
18) How can you make forms in Python?
You have to import cgi module to access form fields using
FieldStorage class.
Attributes of class FieldStorage for form:
form.name: The name of the field, if specified.
form.filename: If an FTP transaction, the client-side
filename.
form.value: The value of the field as a string.
form.file: file object from which data can be read.
form.type: The content type, if applicable.
form.type_options: The options of the 'content-type' line of
the HTTP request, returned as a dictionary.
form.disposition: The field 'content-disposition'; None, if
unspecified.
form.disposition_options: The options for 'content-
disposition'.
form.headers: All of the HTTP headers returned as a
dictionary.
Example
1 import cgi
2 form = cgi.FieldStorage()
3 if not (form.has_key("name") and form.has_key("age")):
4 print "<H1>Name & Age not Entered</H1>"
5 print "Fill the Name & Age accurately."
6 return
7 print "<p>name:", form["name"].value
8 print "<p>Age:", form["age"].value
19)What are the differences between
Python 2.x and Python 3.x?
Python 2.x is an older version of Python. It is a legacy now.
Python 3.x is newer. It is the present and future of this
language.
The most visible difference between them is in print
statement. In Python 2 it is print ?Hello? and in Python 3, it is
print (?Hello?).
20)How can you organize your code to
make it easier to change the base class?
You have to define an alias for the base class, assign the real
base class to it before your class definition, and use the alias
throughout your class. you can also use this method if you
want to decide dynamically (e.g. depending on availability of
resources) which base class to use.
Example
1 BaseAlias = <real base class>
2 class Derived(BaseAlias):
3 def meth(self):
4 BaseAlias.meth(self)

Mais conteúdo relacionado

Mais procurados

Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++Nilesh Dalvi
 
File Handling Python
File Handling PythonFile Handling Python
File Handling PythonAkhil Kaushik
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in pythonTMARAGATHAM
 
Introduction to django framework
Introduction to django frameworkIntroduction to django framework
Introduction to django frameworkKnoldus Inc.
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHPVibrant Technologies & Computers
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming languageMd.Al-imran Roton
 
File handling in Python
File handling in PythonFile handling in Python
File handling in PythonMegha V
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiersNilimesh Halder
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONvikram mahendra
 
Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programmingsambitmandal
 

Mais procurados (20)

Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
Encapsulation C++
Encapsulation C++Encapsulation C++
Encapsulation C++
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Introduction to django framework
Introduction to django frameworkIntroduction to django framework
Introduction to django framework
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Python : Functions
Python : FunctionsPython : Functions
Python : Functions
 
File Handling in Python
File Handling in PythonFile Handling in Python
File Handling in Python
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programming
 

Destaque

CMP 2-13-16
CMP 2-13-16CMP 2-13-16
CMP 2-13-16rastapup
 
CompTIA Network+ N10-006
CompTIA Network+ N10-006CompTIA Network+ N10-006
CompTIA Network+ N10-006Tertius Stander
 
DALICC (Data Licenses Clearance Centre)
DALICC (Data Licenses Clearance Centre)DALICC (Data Licenses Clearance Centre)
DALICC (Data Licenses Clearance Centre)Stadt Wien
 
Deployment and distribution- iOS
Deployment and distribution- iOSDeployment and distribution- iOS
Deployment and distribution- iOSSuraj B
 
Jude Cosgrove - Early child health and cognitive outcomes: secondary analysi...
Jude Cosgrove  - Early child health and cognitive outcomes: secondary analysi...Jude Cosgrove  - Early child health and cognitive outcomes: secondary analysi...
Jude Cosgrove - Early child health and cognitive outcomes: secondary analysi...Institute of Public Health in Ireland
 
Numeracy Information Evening KS1
Numeracy Information Evening KS1Numeracy Information Evening KS1
Numeracy Information Evening KS1rpalmerratcliffe
 
Agile ncr agile coaching-v1
Agile ncr agile coaching-v1Agile ncr agile coaching-v1
Agile ncr agile coaching-v1AgileNCR2016
 
ECM Pre-Numeracy for Kindergarten
ECM Pre-Numeracy for KindergartenECM Pre-Numeracy for Kindergarten
ECM Pre-Numeracy for KindergartenJimmy Keng
 
Literacy & Numeracy Week 2013 Reading With Our Buddies
Literacy & Numeracy Week 2013  Reading With Our BuddiesLiteracy & Numeracy Week 2013  Reading With Our Buddies
Literacy & Numeracy Week 2013 Reading With Our BuddiesStuart Meachem
 
01 июля 2016 года на базе мбдоу
01 июля 2016 года на базе мбдоу01 июля 2016 года на базе мбдоу
01 июля 2016 года на базе мбдоуvirtualtaganrog
 

Destaque (13)

CMP 2-13-16
CMP 2-13-16CMP 2-13-16
CMP 2-13-16
 
BET TRADERS WIN
BET TRADERS WINBET TRADERS WIN
BET TRADERS WIN
 
CompTIA Network+ N10-006
CompTIA Network+ N10-006CompTIA Network+ N10-006
CompTIA Network+ N10-006
 
DALICC (Data Licenses Clearance Centre)
DALICC (Data Licenses Clearance Centre)DALICC (Data Licenses Clearance Centre)
DALICC (Data Licenses Clearance Centre)
 
Deployment and distribution- iOS
Deployment and distribution- iOSDeployment and distribution- iOS
Deployment and distribution- iOS
 
Literacy and numeracy
Literacy and numeracyLiteracy and numeracy
Literacy and numeracy
 
Jude Cosgrove - Early child health and cognitive outcomes: secondary analysi...
Jude Cosgrove  - Early child health and cognitive outcomes: secondary analysi...Jude Cosgrove  - Early child health and cognitive outcomes: secondary analysi...
Jude Cosgrove - Early child health and cognitive outcomes: secondary analysi...
 
Numeracy Information Evening KS1
Numeracy Information Evening KS1Numeracy Information Evening KS1
Numeracy Information Evening KS1
 
Agile ncr agile coaching-v1
Agile ncr agile coaching-v1Agile ncr agile coaching-v1
Agile ncr agile coaching-v1
 
CONSTRUCT YOUR DREAM HOME
  CONSTRUCT YOUR DREAM HOME  CONSTRUCT YOUR DREAM HOME
CONSTRUCT YOUR DREAM HOME
 
ECM Pre-Numeracy for Kindergarten
ECM Pre-Numeracy for KindergartenECM Pre-Numeracy for Kindergarten
ECM Pre-Numeracy for Kindergarten
 
Literacy & Numeracy Week 2013 Reading With Our Buddies
Literacy & Numeracy Week 2013  Reading With Our BuddiesLiteracy & Numeracy Week 2013  Reading With Our Buddies
Literacy & Numeracy Week 2013 Reading With Our Buddies
 
01 июля 2016 года на базе мбдоу
01 июля 2016 года на базе мбдоу01 июля 2016 года на базе мбдоу
01 июля 2016 года на базе мбдоу
 

Semelhante a Top 20 Pyth Interview Q&A

Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answersRojaPriya
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answerskavinilavuG
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdfalaparthi
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning ParrotAI
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Chariza Pladin
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharUttamKumar617567
 
Top Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdfTop Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdfDatacademy.ai
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdfShivamKS4
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.pptjaba kumar
 
Top 20 Python Interview Questions And Answers 2023.pdf
Top 20 Python Interview Questions And Answers 2023.pdfTop 20 Python Interview Questions And Answers 2023.pdf
Top 20 Python Interview Questions And Answers 2023.pdfAnanthReddy38
 

Semelhante a Top 20 Pyth Interview Q&A (20)

Python Course In Chandigarh
Python Course In ChandigarhPython Course In Chandigarh
Python Course In Chandigarh
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdf
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
Python intro
Python introPython intro
Python intro
 
Python unit1
Python unit1Python unit1
Python unit1
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
Python presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, BiharPython presentation of Government Engineering College Aurangabad, Bihar
Python presentation of Government Engineering College Aurangabad, Bihar
 
Intro to python
Intro to pythonIntro to python
Intro to python
 
Top Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdfTop Most Python Interview Questions.pdf
Top Most Python Interview Questions.pdf
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
prakash ppt (2).pdf
prakash ppt (2).pdfprakash ppt (2).pdf
prakash ppt (2).pdf
 
Python - Module 1.ppt
Python - Module 1.pptPython - Module 1.ppt
Python - Module 1.ppt
 
About python
About pythonAbout python
About python
 
Top 20 Python Interview Questions And Answers 2023.pdf
Top 20 Python Interview Questions And Answers 2023.pdfTop 20 Python Interview Questions And Answers 2023.pdf
Top 20 Python Interview Questions And Answers 2023.pdf
 

Mais de Pragati Singh

Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Pragati Singh
 
Tenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfTenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfPragati Singh
 
Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Pragati Singh
 
Pragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh
 
Ios record of achievement
Ios  record of achievementIos  record of achievement
Ios record of achievementPragati Singh
 
Ios2 confirmation ofparticipation
Ios2 confirmation ofparticipationIos2 confirmation ofparticipation
Ios2 confirmation ofparticipationPragati Singh
 
Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Pragati Singh
 
Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Pragati Singh
 
Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Pragati Singh
 
Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Pragati Singh
 
Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Pragati Singh
 
Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Pragati Singh
 
Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Pragati Singh
 
Certificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userCertificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userPragati Singh
 
Certificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiCertificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiPragati Singh
 
Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Pragati Singh
 
Certificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidCertificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidPragati Singh
 
Certificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingCertificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingPragati Singh
 
Certificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesCertificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesPragati Singh
 
Certificate of completion android app development restful web services
Certificate of completion android app development restful web servicesCertificate of completion android app development restful web services
Certificate of completion android app development restful web servicesPragati Singh
 

Mais de Pragati Singh (20)

Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced! Nessus Scanner: Network Scanning from Beginner to Advanced!
Nessus Scanner: Network Scanning from Beginner to Advanced!
 
Tenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdfTenable Certified Sales Associate - CS.pdf
Tenable Certified Sales Associate - CS.pdf
 
Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)Analyzing risk (pmbok® guide sixth edition)
Analyzing risk (pmbok® guide sixth edition)
 
Pragati Singh | Sap Badge
Pragati Singh | Sap BadgePragati Singh | Sap Badge
Pragati Singh | Sap Badge
 
Ios record of achievement
Ios  record of achievementIos  record of achievement
Ios record of achievement
 
Ios2 confirmation ofparticipation
Ios2 confirmation ofparticipationIos2 confirmation ofparticipation
Ios2 confirmation ofparticipation
 
Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016Certificate of completion android studio essential training 2016
Certificate of completion android studio essential training 2016
 
Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...Certificate of completion android development essential training create your ...
Certificate of completion android development essential training create your ...
 
Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...Certificate of completion android development essential training design a use...
Certificate of completion android development essential training design a use...
 
Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...Certificate of completion android development essential training support mult...
Certificate of completion android development essential training support mult...
 
Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...Certificate of completion android development essential training manage navig...
Certificate of completion android development essential training manage navig...
 
Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...Certificate of completion android development essential training local data s...
Certificate of completion android development essential training local data s...
 
Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...Certificate of completion android development essential training distributing...
Certificate of completion android development essential training distributing...
 
Certificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the userCertificate of completion android app development communicating with the user
Certificate of completion android app development communicating with the user
 
Certificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments apiCertificate of completion building flexible android apps with the fragments api
Certificate of completion building flexible android apps with the fragments api
 
Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...Certificate of completion android app development design patterns for mobile ...
Certificate of completion android app development design patterns for mobile ...
 
Certificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for androidCertificate of completion java design patterns and apis for android
Certificate of completion java design patterns and apis for android
 
Certificate of completion android development concurrent programming
Certificate of completion android development concurrent programmingCertificate of completion android development concurrent programming
Certificate of completion android development concurrent programming
 
Certificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence librariesCertificate of completion android app development data persistence libraries
Certificate of completion android app development data persistence libraries
 
Certificate of completion android app development restful web services
Certificate of completion android app development restful web servicesCertificate of completion android app development restful web services
Certificate of completion android app development restful web services
 

Último

Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Último (20)

Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Top 20 Pyth Interview Q&A

  • 1. Python Interview Questions A list of top frequently asked Python interview questions and answers are given below. 1) What is Python? Python is a high level object-oriented programming language with objects, modules, threads, exceptions and automatic memory management. It is a simple yet powerful programming language. It can run equally on different platforms such as Windows, Linux, UNIX, Macintosh etc. Thus, Python is a portable language. 2) What are the advantages of Python? Following are the main advantages of using Python. ◦ Free and open source ◦ Portable ◦ Extensible ◦ Object oriented ◦ Built-in data structure 3)What is PEP 8? PEP 8 is a coding convention which specifies a set of guidelines, about how to write your Python code more readable. 4) What is used to create Unicode string in Python? You should use "Unicode" before the string. For example: Unicode (text). 5) Explain how Python is interpreted? Python is an interpreted language. The Python language program runs directly from the source code. It converts the source code into an intermediate language, which is again translated into machine language that has to be executed. 6) How memory is managed in Python? Memory is managed in Python in following way: ◦ Memory is managed in Python by private heap space. All
  • 2. Python objects and data structures are located in a private heap. The programmer does not have an access to this private heap and interpreter takes care of this Python private heap. ◦ Python memory manager is responsible for allocating Python heap space for Python objects. ◦ Python also have an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space. 7) What is Python decorator? A Python decorator is a specific change made within Python syntax to alter functions easily. 8) What are the rules for local and global variable in Python? In Python, variables that are only referenced inside a function are called implicitly global. If a variable is assigned a new value anywhere within the function's body, it's assumed to be a local. If a variable is ever assigned a new value inside the function, the variable is implicitly local, and you need to explicitly declare it as 'global'. 9) What is namespace in Python? In Python, every name 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. 10) What are iterators in Python? In Python, iterators are used to iterate a group of elements, containers like list. 11) What is generator in Python? In Python, generator is a way that specifies how to implement iterators. It is a normal function except that it yields expression in the function. 12) What is slicing in Python?
  • 3. Slicing is a mechanism used to select a range of items from sequence type like list, tuple, string etc. 13) What is dictionary in Python? The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys. Let's take an example The following example contains some keys ? Country Hero & Cartoon. Their corresponding values are India, Modi and Rahul respectively. 1 >>> dict = {'Country': 'India', 'Hero': 'Modi', 'Cartoon': 'Rah ul'} 2 >>>print dict[Country] 3 India 4 >>>print dict[Hero] 5 Modi 6 >>>print dict[Cartoon] 7 Rahul 14) What is Pass in Python? Pass specifies a Python statement without operations. It is a place holder in a compound statement, where there should be a blank left and nothing has to be written there. 15) Explain docstring in Python? A Python documentation string is called docstring. It is used for documenting Python functions, modules and classes. 16) What is negative index in Python? Python sequences are indexed in positive and negative numbers. For example: 0 is the first positive index, 1 is the second positive index and so on. For negative indexes -1 is the last negative index, -2 is the second last negative index and so on. 17) What is pickling and unpickling in Python? Pickling is a process in which a pickle module accepts any
  • 4. Python object, converts it into a string representation and dumps it into a file by using dump() function. Unpickling is a process of retrieving original Python object from the stored string representation for use. Pickleis a standard modulewhich serializes and de-serializes a Python objectstructure. 18) How can you make forms in Python? You have to import cgi module to access form fields using FieldStorage class. Attributes of class FieldStorage for form: form.name: The name of the field, if specified. form.filename: If an FTP transaction, the client-side filename. form.value: The value of the field as a string. form.file: file object from which data can be read. form.type: The content type, if applicable. form.type_options: The options of the 'content-type' line of the HTTP request, returned as a dictionary. form.disposition: The field 'content-disposition'; None, if unspecified. form.disposition_options: The options for 'content- disposition'. form.headers: All of the HTTP headers returned as a dictionary. Example 1 import cgi 2 form = cgi.FieldStorage() 3 if not (form.has_key("name") and form.has_key("age")): 4 print "<H1>Name & Age not Entered</H1>" 5 print "Fill the Name & Age accurately." 6 return 7 print "<p>name:", form["name"].value 8 print "<p>Age:", form["age"].value 19)What are the differences between Python 2.x and Python 3.x? Python 2.x is an older version of Python. It is a legacy now. Python 3.x is newer. It is the present and future of this language. The most visible difference between them is in print statement. In Python 2 it is print ?Hello? and in Python 3, it is
  • 5. print (?Hello?). 20)How can you organize your code to make it easier to change the base class? You have to define an alias for the base class, assign the real base class to it before your class definition, and use the alias throughout your class. you can also use this method if you want to decide dynamically (e.g. depending on availability of resources) which base class to use. Example 1 BaseAlias = <real base class> 2 class Derived(BaseAlias): 3 def meth(self): 4 BaseAlias.meth(self)