• +91 9971497814
  • info@interviewmaterial.com

PYTHON Interview Questions Answers

Question 1 : What is Python? State some programming language features of Python?

Answer 1 : Python is a modern powerful interpreted language with objects, modules, threads, exceptions, and automatic memory managements. Python was introduced to the world in the year 1991 by Guido van Rossum. Salient features of Python are -Simple & Easy: Python is simple language & easy to learn. -Free/open source: it means everybody can use python without purchasing license. -High level language: when coding in Python one need not worry about low-level details. -Portable: Python codes are Machine & platform independent. -Extensible: Python program supports usage of C/ C++ codes. -Embedded Language: Python code can be embedded within C/C++ codes & can be used a scripting language. -Standard Library: Python standard library contains prewritten tools for programming. -Build-in Data Structure: contains lots of data structure like lists, numbers & dictionaries.

Question 2 : Explain the dictionary in Python.

Answer 2 : • Python's built-in data type is dictionary, which defines one-to-one relationships between keys and values. • Dictionaries consist of pairs of keys and their corresponding values. • Dictionaries are indexed by keys. • Dictionary is similar to associative array or hash table of other languages. • As following example explains further- India, Angel & Cartoon are keys & their corresponding values are Bharat, Mother Teresa & Mickey respectively. >>> dict = {'India': 'Bharat', 'Angel': ‘Mother Teresa’, 'Cartoon': 'Mickey'} >>>print dict[India] Bharat >>>print dict[Angel] Mother Teresa

Question 3 : What is Python?

Answer 3 : Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.

Question 4 : Name some of the features of Python.

Answer 4 : 1. It supports functional and structured programming methods as well as OOP. 2. It can be used as a scripting language or can be compiled to byte-code for building large applications. 3. It provides very high-level dynamic data types and supports dynamic type checking. 4.It supports automatic garbage collection. 5. It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

Question 5 : What is the purpose of PYTHONPATH environment variables?

Answer 5 : PYTHONPATH - It has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.

Question 6 : What is the purpose of PYTHONSTARTUP environment variable?

Answer 6 : PYTHONSTARTUP - It contains the path of an initialization file containing Python source code. It is executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains commands that load utilities or modify PYTHONPATH.

Question 7 : What is the purpose of PYTHONCASEOK environment variable?

Answer 7 : PYTHONCASEOK − It is used in Windows to instruct Python to find the first case-insensitive match in an import statement. Set this variable to any value to activate it.

Question 8 : What is the purpose of PYTHONHOME environment variable?

Answer 8 : PYTHONHOME − It is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.

Question 9 : Is python a case sensitive language?

Answer 9 : Yes! Python is a case sensitive programming language.

Question 10 : What are the supported data types in Python?

Answer 10 : Python has five standard data types −1.Numbers, 2.String,3.List,4.Tuple,5.Dictionary

PYTHON Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners