0% found this document useful (0 votes)
4 views

Interview Questions

Uploaded by

msaikiaalt555
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)
4 views

Interview Questions

Uploaded by

msaikiaalt555
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
You are on page 1/ 11

Interview Questions

PYTHON
1. What is Python? What are the benefits of using Python
Python is a high-level, interpreted, general-purpose programming language.
Being a general-purpose language, it can be used to build almost any type of
application with the right tools/libraries. Is a very popular language for
machine learning as well.

2. What is a dynamically typed language?


Dynamic - Data Types are checked during execution

name can be both string and number.

3. What is an Interpreted language?


An Interpreted language executes its statements line by line. No compilation is
needed.

4. What is Scope in Python?


A scope is a block of code where an object in Python remains relevant.

A local scope refers to the local objects available in the current function.

Interview Questions 1
A global scope refers to the objects available throughout the code
execution since their inception.

A module-level scope refers to the global objects of the current module


accessible in the program.

example :

fruit is defined in a function which his local scope. it cannot be accessed


outside its scope.

5. What is the difference between Python Arrays and lists?


-
Arrays in python can only contain elements of same data types

Interview Questions 2
- Lists in python can contain elements of different data types

6. What are lists and tuples? What is the key difference between the two?
Lists and Tuples are both sequence data types that can store a collection of
objects in Python.

List = ['abc', 1, 0.3, true] # list uses square brackets


tuple = ('abc', 1, 0.3, true) # tuple uses parantheses

MAIN DIFFERENCE : List is mutable ( changeable ) Tuple is immutable (


unchangeable ).

7. What is pass in Python?

Interview Questions 3
The pass keyword represents a null operation in Python. We use pass to write
empty functions.

8. What are modules and packages in Python?


Modules and packages are used for
modular programming in python.

Modules, in general, are simply Python files with a .py extension and can have
a set of functions, classes, or variables defined and implemented.

Packages are collection of module with hierarchical structuring.

9. What is the use of self in Python?


Self is used to represent the instance of the class. With this keyword, you can
access the attributes and methods of the class in python.

class Student:
def __init__(self, name):
self.studentName = name

stu1 = Student("Manish")

10. What is __init__?

__init__ is a constructor.

It is used to allocate memory when an object is created.

Interview Questions 4
class Student:
def __init__(self, name):
self.studentName = name

stu1 = Student("Manish") # stu1 will be allocated memory i


n the RAM because of __init__.

11. What is break, continue and pass in Python?

Break The break statement terminates the loop immediately.

The continue statement skips the current code in the loop and go to
Continue
the next iteration.

Pass The pass keyword in Python is generally used to fill up empty blocks.

12. What is docstring in Python?

Multiple line comments are called doctsring. Used to explain the code.

13. What is slicing in Python?

’slicing’ is taking parts of in python.

Syntax for slicing is [start : stop : step]

Interview Questions 5
14. What is lambda in Python? Why is it used?

One line function or Anonymous functions = lambda functions.


They are used when we want to use a function only once or short period of
time.

15. What does *args and **kwargs mean?

*args = multiple arguments ( * is the arguments )

Interview Questions 6
**kwargs = keyword arguments ( ** is the keyword arguments )

OOPS
1. Why do we need to use OOPs?

Object oriented programming helps use to write clear and concise code for
problem solving. Like we can write a function and reuse it with the help of
inheritance. Dividing problems into sub problems. etc.

Interview Questions 7
2. What are the four pillars of OOP?

Inheritance : Sharing of information ( Example of car blueprint and how it can


be used to create multiple cars )
Encapsulation : Data security ( Example how variables inside a function can’t
be accessed outside the function )
Abstraction : Hides complexity ( Example Modules like numpy are hidden and
only the required functions are called )

Polymorphism : Redefining information ( example :


https://www.youtube.com/watch?v=pii3hAksya0 )

3. Different Type of inheritance

4. What is method overriding and overloading

Interview Questions 8
DSA ( WATCH YOUTUBE VIDEOS )
1. How queue works. Real life application. Operation performed in stack.

2. How stack works. Real life application. Operation performed in stack.

3. How linked list works. Different type of linked list. ( I was asked: what is the
difference between singly LL and doubly LL ).

NOTE : JUST NEED TO EXPLAIN HOW IT WORKS. No need to go deep. just


explain this is how it works.

SQL
1. What is Database?

A database is an organized collection of data, stored and retrieved digitally


from a remote or local computer system.

2. What is DBMS?

DBMS = Database management system, which is a software to perform


operations in DB.

3. What is RDBMS?
RDBMS = Relational database management system, It is similar as DBMS but
stores data in the form of tables. These tables have relations defined by
common fields.

Interview Questions 9
4. What is SQL?

SQL = Structured Query Language. It is the standard language for RDBMS. It is


used to handle organized data.

5. What NoSQL?

6. What is MySQL?

MySQL is nothing but RDBMS like SQL server that are used to manage SQL
databse.

7. What are Tables and Fields?

A table is an organized collection of data stored in the form of rows and


columns.
Columns can be categorized as vertical and rows as horizontal.
The columns in a table are called fields while the rows can be referred to as
records.

8. What are Constraints in SQL?

Interview Questions 10
Constraints are used to specify the rules concerning data in the table.

PRIMARY KEY - Uniquely identifies each record in a table.

FOREIGN KEY - Ensures referential integrity for a record in another table.

UNIQUE - Ensures unique values to be inserted into the field.

NOT NULL - Restricts NULL value from being inserted into a column.

9. What is a Primary Key?

The PRIMARY KEY constraint uniquely identifies each row in a table. It must
contain UNIQUE values and has an implicit NOT NULL constraint.

10. What is a Foreign Key?

A FOREIGN KEY comprises of single or collection of fields in a table that


essentially refers to the PRIMARY KEY in another table.

11. What is a Join? List its different types.

https://www.interviewbit.com/sql-interview-questions/ Check this link or


watch a video. Not that important but good to know. Might ask about LEFT
JOIN / RIGHT JOIN / INNER JOIN

Interview Questions 11

You might also like