Top 10 Basic Interview Questions on Python
1. What is Python? What are the benefits ?
Ans. Python is a high-level and interpreted programming language. It supports Object oriented Programming approach to develop applications. It also support module, threads,exception handling, automatic memory management.
The benefits of Python : it is simple,easy to learn, extensible,cross-platform language, GUI programming support.
2. How Python is interpreted?
Ans. Python is interpreted language i.e. interpreter interpret the source code line by line. Python program run directly and convert the source code into intermediate language, then it is again translate to machine language (i.e. binary language) which is machine readable language and has to be executable.
3. What are the difference between tuple and list?
Ans. The difference between list and tuple are:- list is mutable in nature i.e. it can change or modified and tuple is immutable i.e. not change or modified. Tuple is faster than list, take less space than list and tuple is static in nature.
4. What are the built-in data types in Python?
Ans. The built-in data types are:
Ans. Python is a high-level and interpreted programming language. It supports Object oriented Programming approach to develop applications. It also support module, threads,exception handling, automatic memory management.
The benefits of Python : it is simple,easy to learn, extensible,cross-platform language, GUI programming support.
2. How Python is interpreted?
Ans. Python is interpreted language i.e. interpreter interpret the source code line by line. Python program run directly and convert the source code into intermediate language, then it is again translate to machine language (i.e. binary language) which is machine readable language and has to be executable.
3. What are the difference between tuple and list?
Ans. The difference between list and tuple are:- list is mutable in nature i.e. it can change or modified and tuple is immutable i.e. not change or modified. Tuple is faster than list, take less space than list and tuple is static in nature.
4. What are the built-in data types in Python?
Ans. The built-in data types are:
- Number
- String
- List
- Tuple
- Dictionary
5. What are the difference between Python and Java?
Ans. Java is complied language where Python is interpreted language. Java does not support multiple inheritance instead of that it support interface, Python support multiple inheritance. In Java to execute the source code, Java Virtual Machine create an run time environment and convert byte code into machine language , In Python the interpreter convert source into machine language.
6. What is module and package in Python?
6. What is module and package in Python?
Ans. In Python, module is the way to structure program. Each Python program file is a module, which imports other modules like objects and attributes.
The folder of Python program is a package of modules. A package can have modules or sub-folders.
7. What is pep 8?
Ans: PEP stands for Python Enhancement Proposal. It is a set of rules that specify how to format Python code for maximum readability.
8. What is namespace in Python?
Ans: A namespace is a naming system used to make sure that names are unique to avoid naming conflicts.
9.What is the difference between Python Arrays and lists?
Ans: Arrays and lists, in Python, have the same way of storing data. But, arrays can hold only a single data type elements whereas lists can hold any data type elements.
10. What are local variables and global variables in Python?
Global Variables:
Variables declared outside a function or in global space are called global variables. These variables can be accessed by any function in the program.
Local Variables:
Any variable declared inside a function is known as a local variable. This variable is present in the local space and not in the global space.
Comments
Post a Comment
If you have any doubt, Please let me know..