Interview Docs
Interview Docs
Interview Docs
- Answer: C++ is a general-purpose programming language that extends the C programming language. It
supports object-oriented programming and is widely used for developing a wide range of software
applications.
Advantages of C++:
1. C++ is an OOPs language that means the data is considered as objects.
2. C++ is a multi-paradigm language; In simple terms, it means that we can program the
logic, structure, and procedure of the program.
3. Memory management is a key feature in C++ as it enables dynamic memory allocation
4. It is a Mid-Level programming language which means it can develop games, desktop
applications, drivers, and kernels
3. Define ‘std’?
‘std’ is also known as Standard or it can be interpreted as a namespace. The command
“using namespace std” informs the compiler to add everything under the std
namespace and inculcate them in the global namespace. This all inculcation of global
namespace benefits us to use “cout” and “cin” without using “std::_operator_”.
5. What do you mean by Call by Value and Call by Reference?
In this programming language to call a function we have 2 methods: Call by Value and Call
by Reference
Calling a function by sending the values by Calling a function by sending the address of the
copying variables. passed variable.
The changes made in the function are never The changes made in the functions can be seen
reflected outside the function on the variable. In outside the function on the passed function. In
short, the original value is never altered in Call short, the original value is altered in Call by
by Value. reference.
Passed actual and formal parameters are stored Passed actual and formal parameters are stored in
in different memory locations. Therefore, the same memory location. Therefore, making Call
making Call by Value a little memory insufficient by Reference a little more memory efficient.
Calling a function by sending the values by Calling a function by sending the address of the
copying variables. passed variable.
The changes made in the function are never The changes made in the functions can be seen
reflected outside the function on the variable. In outside the function on the passed function. In
short, the original value is never altered in Call short, the original value is altered in Call by
by Value. reference.
Passed actual and formal parameters are stored Passed actual and formal parameters are stored in
in different memory locations. Therefore, the same memory location. Therefore, making Call
Call by Value Call by Reference
making Call by Value a little memory insufficient by Reference a little more memory efficient.
It does not support Function and Operator It supports Function and Operator Overloading
Overloading respectively
Members of the struct are always by default Members of the class can be in private, protected,
public mode and public modes.
Structures are of the value type. They only hold Classes are of reference type. It holds a reference of
value in memory. an object in memory.
The memory in structures is stored as stacks The memory in classes is stored as heaps.
Reference Pointer
The value of a reference cannot be reassigned The value of a pointer can be reassigned
It can never hold a null value as it needs an It can hold or point at a null value and be termed as
existing value to become an alias of a nullptr or null pointer
Reference Pointer
To access the members of class/struct it uses a To access the members of class/struct it uses a ‘ -
‘.‘ >‘
Array are contiguous memory locations of Lists are classic individual elements that are linked or
homogenous data types stored in a fixed connected to each other with the help of pointers and
location or size. do not have a fixed size.
12. What is the difference between a while loop and a do-while loop?
While Loop do-while Loop
It simply means putting the operator before the It simply means putting the operator after the
operand operand
new malloc()
new is an operator which performs an operation malloc is a function that returns and accepts values
new is faster than malloc as it is an operator malloc is slower than new as it is a function
HTML
6. What are HTML entities, and when should you use them?
- Answer: HTML entities are special characters represented using their entity names or
codes (e.g., < for < and & for &). You should use them to display characters that
have a special meaning in HTML, like <, >, and &.
8. What is the difference between the <script> and <link> elements in HTML?
- Answer: The <script> element is used to include JavaScript code within the HTML
document, while the <link> element is used to link external resources such as stylesheets.
10. What is an HTML form, and what are some common form elements?
- Answer: An HTML form is used to collect and submit user input. Common form
elements include <input>, <textarea>, <select>, <button>, and form controls like
checkboxes and radio buttons.
12. What is HTML5, and what are some of its new features?
- Answer: HTML5 is the latest version of HTML. Some of its new features include the
<video> and <audio> elements, the <canvas> element for drawing graphics, and improved
support for web forms.
15. What are HTML5 semantic elements, and why are they important?
- Answer: HTML5 introduced semantic elements like <header>, <nav>, <main>, and
<footer. They help improve the structure and accessibility of web pages by providing a
clearer hierarchy and meaning to content.
CSS
Certainly! Here are some common CSS (Cascading Style Sheets) interview questions:
3. What is the "cascading" in Cascading Style Sheets, and how does it work?
- Answer: Cascading refers to the order of priority when multiple CSS rules conflict. The order of
importance is inline styles, internal styles, and external styles. Specificity and source order within the same
type of rule also play a role in determining which style is applied.
6. What are pseudo-classes in CSS, and can you provide some examples?
- Answer: Pseudo-classes are used to define a special state of an HTML element. Examples include
`:hover`, `:active`, `:focus`, and `:nth-child`.
7. How can you center an element horizontally and vertically using CSS?
- Answer: To center an element horizontally, you can use `margin: 0 auto;`. To center an element
vertically, you can use `display: flex;` or other techniques, depending on the context.
8. What is the purpose of the `float` property in CSS, and how does it work?
- Answer: The `float` property is used to position elements to the left or right within their containing
element. It is often used for creating multi-column layouts, wrapping text around images, and more.
9. What is the difference between `display: block`, `display: inline`, and `display: inline-block` in CSS?
- Answer: `display: block` makes an element a block-level element, `display: inline` makes it an inline-level
element, and `display: inline-block` combines characteristics of both block and inline elements.
10. What is a CSS selector, and can you provide examples of different types of selectors?
- Answer: A CSS selector is used to target HTML elements for styling. Examples include element selectors
(e.g., `p`), class selectors (e.g., `.my-class`), ID selectors (e.g., `#my-id`), descendant selectors (e.g., `div p`), and
more.
DJANGO
Django follows the MVT (Model View Template) pattern which is based on the Model View Controller
architecture. It’s slightly different from the MVC pattern as it maintains its own conventions, so, the controller
is handled by the framework itself. The template is a presentation layer. It is an HTML file mixed with Django
Template Language (DTL). The developer provides the model, the view, and the template then maps it to a
URL, and finally, Django serves it to the user.
manage.py - A command-line utility that allows you to interact with your Django project
__init__.py - An empty file that tells Python that the current directory should be considered as a Python package
settings.py - Comprises the configurations of the current project like DB connections.
urls.py - All the URLs of the project are present here
wsgi.py - This is an entry point for your application which is used by the web servers to serve the project you have
created.
A model in Django refers to a class that maps to a database table or database collection. Each attribute of the
Django model class represents a database field. They are defined in app/models.py
Example:
4. What are templates in Django or Django template language?
Templates are an integral part of the Django MVT architecture. They generally comprise HTML, CSS, and js in
which dynamic variables and information are embedded with the help of views. Some constructs are recognized
and interpreted by the template engine. The main ones are variables and tags.
A template is rendered with a context. Rendering just replaces variables with their values, present in the
context, and processes tags. Everything else remains as it is.
The syntax of the Django template language includes the following four constructs :
Variables
Tags
Filters
Comments
A view function, or “view” for short, is simply a Python function that takes a web request and returns a web
response. This response can be HTML contents of a web page, or a redirect, or a 404 error, or an XML
document, or an image, etc.
Example:
This ORM (an acronym for Object Relational Mapper) enables us to interact with databases in a more pythonic
way like we can avoid writing raw queries, it is possible to retrieve, save, delete and perform other operations
over the database without ever writing any SQL query. It works as an abstraction layer between the models and
the database.
Websites generally need to serve additional files such as images. Javascript or CSS. In Django, these files are
referred to as “static files”, Apart from that Django provides django.contrib.staticfiles to manage these
static files.
django-admin is Django’s command-line utility for administrative tasks. In addition to this, a manage.py file is
also automatically created in each Django project. Not only does it perform the same purpose as the django-
admin but it also sets the DJANGO_SETTINGS_MODULE environment variable to point to the project's settings.py
file.
django-admin help - used to display usage information and a list of the commands provided by each application.
django-admin version - used to check your Django version.
django-admin check - used to inspect the entire Django project for common problems.
django-admin compilemessages - Compiles .po files created by makemessages to .mo files for use with the help of built-
in gettext support.
django-admin createcachetable - Creates the cache tables for use in the database cache backend.
django-admin dbshell - Runs the command-line client for the database engine specified in your ENGINE setting(s), with
the connection parameters (USER, PASSWORD, DB_NAME, USER etc.) specified settings file.
django-admin diffsettings - Shows the difference between the existing settings file and Django’s default settings.
django-admin dumpdata - Used to the dumpdata from the database.
django-admin flush - Flush all values from the database and also re-executes any post-synchronization handlers
specified in the code.
django-admin inspectdb - It generates django models from the existing database tables.
django-admin loaddata - loads the data into the database from the fixture file.
django-admin makemessages - Used for translation purpose and it generates a message file too.
django-admin makemigrations - Generates new migrations as per the changes detected to your models.
django-admin migrate - Executes SQL commands after which the database state with the current set of models and
migrations are synchronized.
django-admin runserver - Starts a light-weight Web server on the local machine for development. The default server
runs on port 8000 on the IP address 127.0.0.1. You can pass a custom IP address and port number explicitly if you want.
django-admin sendtestemail - This is used to confirm email sending through Django is working by sending a test email to
the recipient(s) specified.
django-admin shell - Starts the Python interactive interpreter.
django-admin showmigrations - Shows all migrations present in the project.
django-admin sqlflush - Prints the SQL statements that would be executed for the flush command mentioned above.
django-admin sqlmigrate - Prints the SQL statement for the named migration.
django-admin sqlsequencereset - output the SQL queries for resetting sequences for the given app name(s).
django-admin squashmigrations - Squashes a range of migrations for a particular app_label.
django-admin startapp - Creates a new Django app for the given app name within the current directory or at the given
destination.
django-admin startproject - Creates a new Django project directory structure for the given project name within the
current directory or at the given destination.
django-admin test - Runs tests for all installed apps.
django-admin testserver - Runs a Django development server (which is also executed via the runserver command) using
data from the given fixture(s).
django-admin changepassword - offers a method to change the user's password.
django-admin createsuperuser - Creates a user account with all permissions(also known as superuser account).
django-admin remove_stale_contenttypes - removes stale content types (from deleted models) in your database.
django-admin clearsessions - Can be used to clean out expired sessions or as a cron job.
URLs are one of the most important parts of a web application and Django provides you with an elegant way to
design your own custom URLs with help of its module known as URLconf (URL Configuration). The basic
functionality of this python module is to
You can design your own URLs in Django in the way you like and then map them to the python function (View
function). These URLs can be static as well as dynamic. These URLs as present in the urls.py where they are
matched with the equivalent view function.
Basic Syntax:
In simple words Project is the entire Django application and an app is a module inside the project that deals
with one specific use case.
For eg, payment system(app) in the eCommerce app(Project).
Certainly! Here are some basic Python interview questions with answers:
Answer: Python is a high-level, interpreted programming language known for its simplicity and readability.
It's popular for its versatility, as it can be used for web development, data analysis, machine learning, and more.
Python's extensive standard library and a large community of developers contribute to its popularity.
Answer: In Python, you can use the `#` symbol to create single-line comments. Anything following `#` on the
same line is considered a comment and is ignored by the Python interpreter.
Answer: Python 2 and Python 3 are different versions of Python. Python 3 was introduced to fix
inconsistencies and improve the language. Some key differences include:
- Print Statement: In Python 2, you use `print` as a statement, while in Python 3, it is a function (`print()`).
- Division: In Python 2, division of integers truncates the result, while in Python 3, it returns a float.
- Unicode: Python 3 handles text as Unicode by default, whereas Python 2 uses ASCII.
Answer: In Python, you can declare a variable by assigning a value to it. For example:
```python
my_variable = 42
```
Answer: Lists and tuples are both used to store collections of items, but the key difference is that lists are
mutable (can be modified), while tuples are immutable (cannot be changed after creation).
Answer: You can define a function in Python using the `def` keyword. For example:
```python
return result
```
Answer: PEP 8 (Python Enhancement Proposal 8) is a style guide for writing clean and consistent Python
code. It covers naming conventions, indentation, code structure, and other guidelines to make Python code
more readable and maintainable.
Answer: In Python, you can handle exceptions using `try` and `except` blocks. For example:
```python
try:
except SomeException as e:
```
9. What is the purpose of the `if __name__ == "__main__":` statement in Python scripts?
Answer: This statement is used to check whether the Python script is being run as the main program or if it's
being imported as a module into another script. Code within the `if __name__ == "__main__":` block will only
execute if the script is the main program, not when it's imported as a module.
10. What is a Python dictionary, and how do you access values in it?
Answer: A Python dictionary is an unordered collection of key-value pairs. You can access values in a
dictionary by using the key as the index. For example:
```python
```
These are some basic Python interview questions with answers to help you prepare. Depending on the job
position and the level of expertise required, interview questions can vary in complexity.
a. Encapsulation: It is the bundling of data (attributes) and methods (functions) that operate on that
data into a single unit called a class. This helps in data hiding and protecting data from unauthorized
access.
b. Inheritance: Inheritance allows you to create a new class based on an existing class, inheriting its
attributes and methods. This promotes code reuse and establishes an "is-a" relationship between
classes.
d. Abstraction: Abstraction is the process of simplifying complex reality by modeling classes based
on their essential characteristics. It hides the unnecessary details and shows only the relevant
attributes and behaviors.
MapmyIndia's cloud mapping services are also used by many developers and
tech companies in India such
as PhonePe, Paytm, Amazon, Alexa voice, Flipkart, Uber, Ola Cabs, Blinkit, etc.
for planning, operations and customer experience.
MapmyIndia was founded by Rakesh and Rashmi Verma in 1995.[4] The couple
launched a startup called CE Info Systems in 1995 at New Delhi, India.[5][6] The
company started working upon developing a web mapping technology and
provide products and services required for enhancing marketing and logistics
efficiency in existing organizations in the country.
MapmyIndia
Type Public
NSE: MAPMYINDIA
Traded as
BSE: 543425
Industry Technology
Mapping data
GPS navigation software
Web mapping