0% found this document useful (0 votes)
5 views2 pages

Python Interview Prep: Questions & Concepts

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Interview Prep: Questions & Concepts

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

All-in-One Python Interview Preparation

1. Python Interview Questions

• What is Python?
Python is a high-level, interpreted programming language.

• Python Data Types:


int, float, str, bool, list, tuple, set, dict, NoneType

• Difference Between List and Tuple:


List = mutable
Tuple = immutable

• What is PEP 8?
Python’s official style guide.

• What is the difference between == and is?


== compares values
is compares identity

• What are *args and **kwargs?


Used for dynamic arguments.

• What is a lambda function?


Small anonymous function.

• What is a generator?
Function using yield.

• What is exception handling?


Using try, except, finally.

2. OOP Concepts

Class: Blueprint for objects.


Object: Instance of a class.
Encapsulation: Protecting data.
Inheritance: Reusing parent class properties.
Polymorphism: Same function, different behavior.
Abstraction: Hiding implementation.

3. Python String Reverse Programs


■ Using Slicing:
s = "Hello"
print(s[::-1])

■ Using Loop:
s = "Python"
rev = ""
for c in s:
rev = c + rev
print(rev)

■ Using reversed():
s = "ChatGPT"
print("".join(reversed(s)))

■ Using Recursion:
def reverse(s):
if len(s) == 0:
return s
return reverse(s[1:]) + s[0]

print(reverse("India"))

You might also like