# LNT Infotech-Python Developer Interview Questions Experienced

Round 1:

1. Write a SQL query to select product and price with an extra column having data as 'Cheap' if price is less than 15, 'Average' if price is less than or equal to 50 and 'Expensive' when price is more than 50.
Write the same query using pandas as well.
2. What is self in Python ?
3. What is static function ?
4. What is class functions ?
5. What is init ? Can init be overloaded
6. How to handle huge file load in python ?
7. What is difference between 'is' and '==' in python ?

Round 2:

1. # Find the number in array with maximum frequency :

#### Solution

```lst1 = [1, 2, 34, 2, 3, 2, 2, 1, 2, 2]
import collections
most_common = collections.Counter(lst1)

max_occ_key = max(most_common, key=most_common.get)
print(f'max_occ_key : {max_occ_key}')
```
2. How Memory management done in Python ? What is GIL ?
3. What is diamond problem in Python and how it is solved ?
4. # Rotate an array of n elements by d elements.

#### Solution

```
from collections import deque
lst = [1, 2, 3, 4, 5, 6, 7]
n = 7
d = 2
d_list = deque(lst)
d_list.rotate(-d)
print(f'Rotated List Using deque : {d_list}')

rotated_list = [lst[(i + d) % len(lst)] for i, x in enumerate(lst)]
print(f'rotated_list using list comprehension :{rotated_list}')

```
5. What is decorator ? Give example .

Praveen on Sep 06, 2020 at 12:09 am

×