Skip to content

Instantly share code, notes, and snippets.

@vikas-git
Last active September 27, 2023 14:34
Show Gist options
  • Save vikas-git/d4b60b122ced6582f6d257ca581c3dcd to your computer and use it in GitHub Desktop.
Save vikas-git/d4b60b122ced6582f6d257ca581c3dcd to your computer and use it in GitHub Desktop.
My Interview experience on Python
======= Interviews ==========
# Duration July - August 2021
## Django:
* Flow of Django
* Django Middlewares
* Django request/response cycle
* API security(auth based token and others)
* Avoid deadloak in django ( F() )
* django-admin differs commands (inspectdb, and other commands)
## Python:
* how to call child class function in parent class
* match a string that has the letter a followed by 4 to 8 b's
* add two dict, if same key in both dict add values
Input:
d1 = {'key1': 50, 'key2': 100, 'key3':200}
d2 = {'key1': 200, 'key2': 100, 'key4':300}
Output:
{'key1': 250, 'key2': 200, 'key3':200, 'key4':300}
* local vs non-local vs global variables
* class vs static vs instance methods
* kind of data structure in python
* what kind of key we use in dict
* can we use tuple of list as dict keys
* write text into file and get uniques words string text from file
* decorators with Example (single/ multiple), which decortor function we used(@apiview, @property etc), generators
* Lambda function
* Closuer function
* sorted() vs sort()
* deepcopy() vs shallowcopy()
* xrange() vs range()
* Package vs module
* map(), filter(), reduce()
* Given a string and a dictionary of character -> numeric(0-9),
you need to implement a function which returns the decimal value of string.
Example: string = 'A10', and dictionary {'A': 9} the output should be 910
## DSA:
* Round Robin Program
* count of each words in certain list
* Find longest palindrom string
* Add two singly linked list
Linked list1: 0142
Linked list2: 2021
Linked list3 (output): 2163
* Find height of BST
* create common function for add/multiple/subtract/divide for any kind of data structure, take input on runtime
* https://leetcode.com/problems/spiral-matrix/
* https://leetcode.com/problems/linked-list-cycle/
## Others:
* why we use gunicorn
* how to deploy django applictation
* API gateways of AWS
* Lambda function
* System design of LIFT
## Linux:
softcopy v/s hardcopy
modes of vi
zoombie process
netstat
env
sed vs grep
## Mysql:
Why we use views, operation on views
Store procedures
Get number of employee in each department
combine firstname and lastname, count number of character in name except space (' ')
==============================
Company : Cognizant (Gurgaon)
Post : Python + AWS developer
Date : 20-Aug-2021
Video call
- What is VPC
- AWS security groups and diff types
- Monkey Patching
- Cython, python use which complier default
- GIL
- Pickiling vs Unpickling
- Numpy vs list
- Does python support multithreding
- What is use of self keyword in class
- what is use of egg and wheels file (both are packaging formats)
- How to debug error which occur for certain user only
==============================
Company : indroe based company
Date : July-2021
Interview Mode: Gmeet video call
- Diff b/w PHP and python
- Diff b/w py2 and py3
- Decorators with example
- Lambda function with example
- map(), reduce(), filter()
- Diff types of methods (class, instance, static)
- Genertors with example
- Iterators with example
- pickle vs unpickle
- sort data by certain dict key from list of dict
x = [{'root': 1000, 'fruit': 'apple'}, {'root': 800, 'fruit': 'orange'}, {'root': 950, 'fruit': 'grapes'}]
sort by root
solution: sorted(x, key=lambda r: r['root'])
- put vs post vs patch
- How can send cookies data in rest api
- how can overwrite a tuple
- how many types of views in django
- how to create custom managers for django models
- Django signals
- Working flow of django application
- How to create custom Middlewares
- create customs command with the help of django
- what is your role in project
==============================
Company : ORahi (Gurgaon)
Date : 27-Nov-2019
Written:
Programming:
* WAP to find the angle between hour and minute hand.
* WAP to sort element based on frequency.
* WAP to find the largest sum in contigious subarray.
for example: Input : -2,-3,4,-1,-2,1,5,-3
Output : 7
OOPS :
* overloading vs overridding ?
* exception handling and their uses ?
* Interface and abstruct classes and difference between them ?
DSA :
* Implement a stack using 2 Queue ?
* LCA in BST ?
* How to delete an element from a linked list which has a pointer pointing only to the element that has to be
deleted? there is no pointer pointer at the beginning of the list ?
==============================
Company : Fusions (http://www.fusionss.com/ based in banglore but Job location in Gurgaon)
Date : 22-Nov-2019 (TI)
* Which version of django are you working ?
* Django1 vs Django2 ?
* how can we use regular expression string in url (django2) ? I want only 4 digits number in url ?
* How do you define any url (url()/path()) ?
* Have you worked on row queries ?
* suppose i have a function in my python code and i want to use that function in django tempalte ?
* I want to clone particular branch in my system ?
* what is range() in python3.6 ?
* what is namespace in python/django ? how we define namespace on particular url ?
* what does iterators ?
* Request/Response cycle in django ?
* What are the common function for create middlewares ?
* List comparihension ?
* DB schema ?
* you have some emp and managers and some unit heads an employer can have a manager and unit heads ? how can we use this into db structure ?
==============================
Company : Webex- Persistent System (Pune)
Date : 21-Nov-2019 (TI)
* Deep discussion about projects (about db structure, appliction flow, how to define modals, manytomanyfield)
* Generators
* Deploying application on server
* code question:
def extendList(value, list1=[]):
list1.append(value)
return list1
extendList(10, list1=[]) // [10]
extendList(123, []) // [123]
extendList('a') // ['a']
==============================
Company : Careers360 (Gurgaon sec-44)
Date : 20-Nov-2019
Written test
Section 1
* Which python version used ?
* Which django version used ?
* What is PEP8 ?
* What is Pickling and Unpickling in Python?
* what is difference between range() and xrange() ?
* What is generators functions and how it differ from iterator ?
* What is a closures ? and what are they useful for ? How Python implements closures ?
* How would you intregrate an appication from ne db to another For example from Mysql to PSQL? If you had to manage that project which issues would you expect to face ?
* How Does Django ORM (Queryset) handles database tables with large amount of data ?
* What is rebase how it differs from merge in git ?
* How would you sort a 10GB file? How would your approach change with a 10TB one ?
* Design a web crawler: we need to create a creawler which crawls naukri.com get all the jobs listing(only Title and Job description needs to be crawled) and crawl on daily basis for new posted ?
F2F
meta class,
deploy app on server,
deamons,
celery
=============================
Company : Harman (Pune)
Date : 31-oct-2019 (TI)
Tell me about your professional career
Python2.x vs Python3.x
ANy MRO related chanages in 2.x vs 3.x
MRO and which algo it uses
Different types of methods
Different type of decortor
i want to use list as a key in dict
how dict works internally
difference b/w __init__() vs __new__()
dict is ordered or unordered
Sort binary values inside a list
is polymorphism supported by python
=============================
Company : Grubox (gurgaon)
Date : 31-oct-2019 (TI)
Aggregate vs annotate
what is signals
how to submit form data in django
put vs post request
selected_related vs prefetch_related
=============================
Company : Jiffyship Cargo Technology Pvt. Ltd.
Date: 5-Oct-2019
* About Currently project
* Which django inbulit classes we used
* How much you will rate yourself in python ?
* What is decorators and generators ?
* type of inheritance in python (multiple and multilevel)
* which type of datatypes/vartype use in python with there functionality
* how do we add value in list(append()) and set (add() in set)
* Basic struture of django framework
* How many types of response in django
* difference between get() and filter() in django ORM
=============================
Company : Doctor Insta(Gurgaon)
Date: 3-may-19
Assignment Link :: https://www.dropbox.com/s/w8qxyv9ypokdz7e/screening_python.pdf?dl=0
=============================
Company : Ecom Express (telephonic)
Date: 23-Apr-19
Serializers
json.dumps and json.loads
__str__
What is lambda? have u ever used
dateutils, how to change date format
how can we use private function
what is static
defination of decorator and why do we use decorator
yield keyword
Put vs post
stack inline vs tabular inline
=============================
Company : Ecom Express (F2F)
Date: 2-May-19
string slicing question
what datatypes we used in dict keys
list vs tuple, How can we change tuple Value
extend vs append
del vs remove
pop vs pop_item
print key, values from dict (items(), iteritems())
we have two list, create dict using first list val as key and second list val as value (zip())
Generators
Decorators
Class MRO example
type of Inheritance
Encapulation
memory management
print reverse string using string slicing
* str = 'vikash'
str[0:]
str[:5]
str[::-2]
Reverse index
Can we use reverse index in range function
how can we create our iterator class (using __iter__() and __next__())
valueerrors vs keyerrors
Lambda function
render() vs HttpResponse()
about the process of migration how it works
which template engine we used in Django
create project, app command how to register our new app
Structure of Project
what does manage.py file?
=============================
Company : Tata Technologies (Pune)
Date: 13-Apr-19
serializer
Django User table
Django Permission
models
how oauth2 works ?
map()
Discuss about projects and my role
================================
Company : umbrella infocare
Date : 3-April (telephonic interview)
Discuss about Projects
how can i add custom field in serializer
why we use as_view() in urls
method overloading
how join query perform in Django (select_related())
=============================
Company : umbrella infocare
Date : 5-April (F2F)
** a = b = [1,2,3,4,5]
id(a) == id (b)
a.append(6)
id(a) == id (b)
** a = b = 5
id(a) == id (b)
a = 6
id(a) == id (b)
** a = b = {'a': 'val', 2="val2"}
id(a) == id (b)
a.update({'c': 'value3'})
id(a) == id (b)
** About Project
** whatsapp db structure
==============================
Company : edge canvas
Date: 2-April (skype call)
Factorial
find maximum number from add two conservative number of list
deepcopy vs shallow copy
type of http methods
what are restful Api
=============================
Company : Tyroo (Udyog vihar Phase 1)
Date : 29-Mar-2019
D.S. :
sort list without function
find missing number from list ( input: [1,2,3,4,5,7] output: 6)
find lowest and second lowest number without functions
Factorial
Python :
list vs tuple
datatypes in Python
Mysql :
Index, Innodb vs myisam (http://www.expertphp.in/article/what-are-the-main-differences-between-innodb-and-myisam)
, Normalization forms, tranactions, mongo vs mysql
============================
Company :: Renewbuy
Date :: 27-mar-2019
Dependency injection
overloading in python
update/append in tuple
queryset and their uses/ benefits
select_related()
ORM
type of http method and diff b/w put and post/patch
what is static methods
lazy queryset
Decorators with parameter
why we use lambda function
how to restrict user to hit only 100 request/min
====================================
Date: 26-March
-- From Chandigarh (telephonic)
- why you change from php to python ?
- what is rest ful api ?
- what is serialization ?
- Lets suppose i have user model there is only one password field in model and i want to check password and confirm password
should be same ?
- what is Serializer fields, Serializer method fields ?
- how can you use oauth on DRF ?
- middleware and decorator with parameters
- class based views and function based views
- how to implement custom user model
====================================
Company : Entrance360 (product of career360, Hauz khas Delhi)
Date : 8-Jan-2019
Saket Agarwal <saket.agarwal@entrance360.com>
Tue, Jan 8, 2:28 PM
to me, Subhajeet
TaskMan: A Django based task manager app
Develop a small to-do app called TaskMan using Django framework. The purpose of the app is to allow users to easily track and manage tasks assigned to them. It should have the following features:
1. User signup by providing his username, email address and password.
2. Login to his account be providing email address and password.
3. A logged in user should be able to perform the following tasks:
a. See all tasks created by him
b. Add a new task by providing Task Name & Deadline date.
c. Mark one or more tasks as complete
d. Mark one or more completed tasks as incomplete
e. Delete existing tasks
f. Sort tasks either by name, complete by date or added on date
4. All task activities by a user are to be tracked and can be viewed in form of an activity feed. For. e.g if a user deletes a task the activity feed should have "You deleted task XYZ".
5. All dates should be in DD MON, YYYY format (eg. 24 Jan, 2014)
6. Make sure that you use core django components like templates, forms to develop this app.
Your project must provide simple web pages to perform all the CRUD operations. All CRUD operations are necessary. Take care of all the endpoints naming conventions.
You can host the app on http://heroku.com/ or any other django-python hosting website, if you cant provide the demo, then you can send the project in a .zip file with instructions on how to run the app.
F2F
celery
pickling, unpickling
ficade
closure
select_related vs prefetch_related
cross join vs inner join
==========================================================
= OTHER PEOPLE EXPERIENCE =
==========================================================
=============== Kamal Arora (Data engineer at Accenture, Gurgaon) =======================
1. What all data structure you have used in python ?
2. Difference between list and tuple ?
3. map, dict, filter, zip
4. list manipulation queries (sort,remove,add elements)
5. dict manipulation queries (sort,remove,add elements)
6. dict sort by keys
7. dict sort by values
8. append and extend in list (difference)
9. Decorator with example
8. Generator with example
9. Difference between iterator and generator
10. Difference between range and xrange
11. Difference between python 2.7 and python 3.* what all has been changed in that?
12. How generator works?
13. Class initialization functions (init,new and repr)?
14. init and new functions which will called first?
15. Difference between functions and methods?
16. what does it means python is dynamically typed?
17. what is lambda function with example?
18.  What does this mean: *args, **kwargs? And why would we use it?
19. How is memory managed in Python?
20. Why should we use flask?
21. What are benefits of django?
22. what is drf? have you used that?
23. what is middleware?
24. Django lifecycle?
25. Django project structure?
26. Why manage.py is used?
27. List comprehension how and why we use?
28. How to debug the code?
29. Pycharm debugger?
30. How can you randomize the items of a list in place in Python?
40. OS library for delete file?(os.remove("file"))
41. What is set? why we use it?
42. combine two lists into dictionary python.
43. Reverse the dict.
44. Sort list of dict.
45. What is pickling and unpickling?
46. Reverse a string with using loop?  Ans - [::-1]
47. Sub string programs.
48. Split list into chunks (range(0,1000,10) then split into list)
49. Difference btw open and with open file.
50. How can you get dict elements in given/declared order.(OrderedDict)
51. count lines in a file.
52. count words in a file.
53. add column in a file.
54. change value of column in a file.
55. file handling operations
56. what is the use of index in database.
57. where we create it.
58. how can we make a query on database index.
59. if you have created a index on 2 columns can you make a query on 1 column
60. joins in data base.types of joins.
61. get all values of dept.
62. can you delete a column from database if its id is available in other table as foreign key.
63. split and join in python.
65. can you run multiple processes/threading in python? how to do that?
66. how can you change the value of a column in file using pandas?
67. how will you read a file in python?
68. how will you write a file in python?
69. change a value of 5th column 5th row in file (full process first read then change then write)
70. how will you run a python process backround in unix (python abc.pr &. it means & is used to run the process backend on unix.)
71. awk in shell scripting.
71. grep in shell scripting.
72. find in shell scripting.
73. tell 5 commands you use in linux/unix on daily basis.
74. Assign list value to other varible and then append value in 2nd variable? is 1st variable will reflect that value.
75. can we change the the list value into tuple? how?
76. Dessign patterns (Factory and singleton)
77. Difference between sorted or sort in python?
78. Prototyping in JS.
79. Promises in JS.
80. CDN in JS.
81. Is js works syncronous or async?
========================================= FROM Yogesh (TCS) =========================================
mutable vs immutable
list vs set
change tuple Value
deepcopy vs shallow copy
self and __init__
print * patterns
Palindrome
string reversal
oops concepts
Different types of methods and variables
how to define instance variable outside class
how to access private variable outside class
pass multiple arguments to a method
lambda/anonymous functions
access command line arguments
switch statement in python
WAP to compare two files
os, sys module
validate mobile number(10 digit, no alphabets, no special char)
Inheritance, overloading
SQL:
Trancate vs delete
2nd highest salary
Database migration
========================================= FROM Quora =========================================
What is Python , Explain features of Python.
How Python is interpreted.
Explain dict.
How to pass optional or keyword arguments.
Explain indexing and slicing.
What is lambda.
Difference between str() and repr().
Explain serialization and deserialization / Pickling and unpicking.
What is list / dict compression.
What are higher ordered functions.
How to copy object in Python. Diff between shallow copy and deep copy.
How to make array in python.
How to generate random numbers.
How to handle exceptions.
When to use list/tuple/set.
Disadvantageous of python.
Diff range() and xrannge()
What is PEP8
What is virtualenv
Diff between Python 2.* and 3.*
What is decorator, usage ?
With statement and its usage.
What is class and what is self.
Explain isinstance()
What is static method, class method and instance method
Treading in python
What are iterators and generators
Explain map, filter,reduce and lambda.
Difference between new styled classed and old styled classes.
What is diff between Python and Java
What is context processor.
What is exec() and eval ()
How to pass command line argument.
What is yield ?
What is ord() and chr()
What are Metaclasses.
What is descriptor ?
Any 10 python packages you have used.
What is namespace in Python? namespace vs scope ?
What is MRO ?
== vs is ?
mutable vs immutable
What are tuples ?
What is difference between tuple and list ? Where will you use tuple and where will you use list ?
What is Dynamic Typing ?
Justify this statement : Everything is object in Python ?
Python is Call by Value or Call by Reference ?
How do you create a dictionary which can preserve the order of pairs?
Can you use mutable Data Structure as key in Dictionaries ?
What is the use of enumerate() in Python?
What are *args, **kwargs ?
How instance variables are different from class variables?
Differentiate between “*.py” file and “*.pyc” file?
Explain difference between Map vs Reduce Vs Filter ?
What are Lamda Functions ?
What is List comprehension ?
What is __init__ functions ?
What are Generators ?
What are Iterators ?
Can generator be used to create Iterators ? Give example
Can iterators be used to create generator ?
Differentiate between Range and Xrange ?
What is Method Resolution Order ?
Python supports Multi-Level Inheritance or Multiple Inheritance or Both ?
Does Python supports multi-threading ?
What is multi-threading? What is GIL(Global interpreter lock) issue ?
What are decorator ? How to create custom decorator ?
How memory is managed in Python ?
How does Python's garbage collection work?
What are Regular Expressions ?
Differentiate between append() and extend() methods ?
What is Web Scraping? How do you achieve it in Python?
Explain the use “with” statement in python?
What are Middlewares ?
What is Monkey patching ? Give example ?
What's the difference between py2.x and py3.x ?
Give examples of Python Framework ?
Django
What is django , why django
Features of django
MVC vs MTV ?
render vs render_to_response
flow of django
what is django-admin and manage.py
django signals
What is middleware and use of it. Custum middleware
Sessions in django
What are template tags
order_by , group_by
How django manage many to many relationships ?
django with multiple database
What are Q objects in django
Detail overview of request and response objects
What are the class based views ?
How to use sessions in django ? Different ways of storing sessions in django?
Model forms ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment