Home Interview Questions and Answers Python Interview Questions and Answers For Graduates Part-1

python1.What is Python?
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.

2.Name some of the features of Python.
Following are some of the salient features of python −

It supports functional and structured programming methods as well as OOP.

It can be used as a scripting language or can be compiled to byte-code for building large applications.

It provides very high-level dynamic data types and supports dynamic type checking.

It supports automatic garbage collection.

It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.

3.What is the purpose of PYTHONPATH environment variable?
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.

4.What is the purpose of PYTHONSTARTUP environment variable?
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.

5.What is the purpose of PYTHONCASEOK environment variable?
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.

6.What is the purpose of PYTHONHOME environment variable?
PYTHONHOME − It is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.

7.Is python a case sensitive language?
Yes! Python is a case sensitive programming language.

8.What are the supported data types in Python?
Python has five standard data types −






9.What is the output of print str if str = ‘Hello World!’?
It will print complete string. Output would be Hello World!.

10.What is the output of print str[0] if str = ‘Hello World!’?
It will print first character of the string. Output would be H.

You may also like

Leave a Comment