0% found this document useful (0 votes)
19 views10 pages

Interview Question For Python Interview - Mid Role

This document contains summaries of common Python interview questions. It discusses how Python handles memory management, what pickling and unpickling are, how arguments are passed in Python, how Python is a dynamically typed language, what lambda functions, generators and iterators are in Python, and whether a parent class can be called without instantiating it. Each topic is covered in 1-2 paragraphs with examples provided for some concepts like lambda functions.

Uploaded by

Nyakundi Omurwa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
19 views10 pages

Interview Question For Python Interview - Mid Role

This document contains summaries of common Python interview questions. It discusses how Python handles memory management, what pickling and unpickling are, how arguments are passed in Python, how Python is a dynamically typed language, what lambda functions, generators and iterators are in Python, and whether a parent class can be called without instantiating it. Each topic is covered in 1-2 paragraphs with examples provided for some concepts like lambda functions.

Uploaded by

Nyakundi Omurwa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

Part - 01 Python

Job Interview
Questions
Python

ByteBite
1
How does memory management
works in Python?

Python's memory management is controlled by


the Python Memory Manager, which allocates and
manages memory in a private heap inaccessible
to programmers.

Python objects reside in this heap. The language


provides core API functions for managing it.

@bytebite101 02
2
What is pickling and unpickling?

In Python, pickling is the process of serializing


objects into a byte stream for storage or
transmission, facilitated by the pickle module's
pickle.dump() function.

Unpickling is the reverse process, where byte streams


are deserialized back into objects using pickle.load(),
allowing for retrieval of the original data stored

@bytebite101 02
3
How are arguments passed by
value or by reference in python?

In Python, arguments are passed by reference,


meaning a reference to the actual object is
passed, allowing changes to the value of the
object to affect the original object.

@bytebite101 03
4
How is python a a dynamically
typed language?

A dynamically typed language performs type


checking during runtime rather than at compile time,
enabling flexibility in variable types and values.

Python is an interpreted language, executes


each statement line by line and thus type-checking
is done on the fly, during execution which makes
Python a Dynamically Typed Language.

@bytebite101 04
5
What is lambda in Python?

Lambda in Python is an anonymous function used


for short-term operations.

It can accept any number of arguments but only


has a single expression. For example, a lambda
function to add two numbers

add = lambda x,y:x+y

@bytebite101 05
6
What are generators in Python?

Generators are functions that return an iterable


collection of items, one at a time, in a set manner.

Generators, in general, are used to create iterators


with a different approach. They employ the use of
yield keyword rather than return to return a
generator object.

@bytebite101 06
7
What are Iterators in Python?

Iterators are objects that remember their state


during iteration, allowing them to traverse through
iterable objects like lists and strings.

They are initialized with the __iter__() method and


utilize __next__() to return the next item in the
iteration while pointing to the subsequent element.

@bytebite101 06
8
Is it possible to call parent class
without its instance creation?

Yes, it's possible for a base class to be instantiated


by other child classes or as a static method.

This occurs because child classes inherit from the


base class, allowing them to access its attributes
and methods, while static methods can be called
directly without instantiation.

@bytebite101 07
8

ByteBite
Follow to Learn More..

Consider a Repost
if this is useful

@bytebite101

You might also like