5 Python Technical Interview Questions

Python is the most widely used programming language nowadays and it is one of the favorite languages among developers. Also, with the latest growth in Big data, Data Science, and Machine Learning, python is most popular in the Big Data community. So, companies working with Big Data expect knowledge of python, and concepts of python are frequently asked in interviews. 

In this post, I will share the technical questions interview experience and top 5 basic python technical questions which are frequently asked in many technical interview.

1. Describe Memory Management in Python

It is one of the most common IT interview questions. Memory management in Python involves a private heap containing objects and data structures. The management of this private heap is handled by the Python memory manager. Python memory management also deals with various dynamic storage aspects like sharing, segmentation, and pre-allocation.

The programmer doesn't have access to private heap storage and the interpreter handles this private heap. The allocation of heap objects for Python objects is done on demand by the Python memory manager through the python/C APIs.


2. What is the difference between List and Tuples?

Again one of the most common technical interview questions


-    A list is Mutable whereas Tuples are non-mutable i.e tuples cannot be changed or modified once it is created.

-   Tuples operation has smaller size as compared to List, which makes it a bit faster.

-   A list has more built-in functions as compared to Tuples.


3. What is a dictionary in python?

Dictionaries are built-in data types in python. Dictionaries have a set of key and values pairs indexed by keys.

dictexample = {

"Name" : "Jerry",
"Age" : 12,
"School" : "Holycross"

}

You can get the value of key "Age" using


x = dictexample.get("Age")

for i in dictexample :
     print(i)                                      
     print(dictexample[i])            


4. What is the Lambda function in python?

Lambda functions are small anonymous functions and they can take any number of arguments but only have one expression

lambda arguments: expression

multi = lambda x : x*5
print(multi(5))


Output: 25



5. What are the Iterators in Python?

An Iterator is an object that can be iterated upon. You can traverse through all the values in an iterator.

animalstuple = ("zebra", "Cat", "Dog")
myiter = iter(animalstuple)

print(next(myiter))
print(next(myiter))


Output: zebra & Cat


Strings are also iterable objects and return an iterator

string = "Cat"

myiter = iter(string)

print(next(myiter))
print(next(myiter))
print(next(myiter))

Output: C a t


Check out more posts in Python below:

How to Setup Django for Python

How to compare data in CSV using Python

How to remove duplicate elements from List in Python


Comments

Popular posts from this blog

Tricky Questions or Puzzles in C

Program to uncompress a string ie a2b3c4 to aabbbcccc

Number series arrangement puzzles