Skip to main content

Posts

Showing posts with the label Interview Questions

Encapsulation VS Abstraction in Object-Oriented Programming

Encapsulation  binds together the data and functions that manipulate the data, keeping it safe from interference and misuse. Real-World Example:   Every time you log into your email account( Gmail, Yahoo, Hotmail or official mail), you have a whole lot of processes taking place in the backend, that you have no control over. So your password, would probably be retrieved in an encrypted form, verified and only then you are given access. You do not have any control, over how the password is verified, and this keeps it safe from misuse. Abstraction  is a process of hiding the implementation from the user, only the functionality is exposed here. So you are aware only of what the application does, not how it does it. Real-World Example:   When you log into your email, compose and send a mail. Again there is a whole lot of background processing involved, verifying the recipient, sending a request to the email server, sending your email. Here you are only interested in compo...

Differences between MVC and MVT framework

MVC (Model-View-Controller) is a software design pattern for developing web applications. It consists of the following parts: Model : It is responsible for managing data of the application. It can be a database, a single object, or some structure of objects etc. It can also have logic to update controller if its data changes. View : View represents the visualization of the data that a model contains. It is responsible for which data should be displayed for a particular request.  Controller : It connects the View with the Model. It controls the data flow and keeps Model and View separate. It is responsible for responding to the user input and perform interactions on the data model objects.  Django - MVT (Model-View-Template ) pattern is slightly different from MVC pattern. The main difference is Django itself take care of the Controller part. In the Template, it's just HTML file mixed with DTL - Django Template Language. 

Python's Web Framework - Django Fundamentals

image source: djangoproject What is  middleware in Django? A middleware is a class with methods that are globally executed  during the request or response phase. For example, Django includes a middleware component called AuthenticationMiddleware which associates users with requests using sessions. See Doc .  What are the models added by the Django authentication framework? Django authentication framework includes the following models: User : A user model with basic fields; the main fields of this model are username , password , email , first_name , last_name , and is_active. Group : A group model to categorize users. Permission : Flags for users or groups to perform certain actions. Which parameters is accepted by the render method? (django.shortcuts -> render)? Render accepts three parameter. (request, template_name, context) For example: return render(request, 'account/login.html', {'form': form}) What is SMTP  and why do we use i...

Interview Questions for Data Scientist Position

What is Machine Learning?  Machine learning is the practice of using algorithms to analyze data, learn from that data and make a determination or prediction about new data. What is Deep Learning? Deep learning (DL) is a sub field of Machine Learning (ML) that uses algorithms inspired by the structure and function of the human brain's neural network called artificial neural network. As a sub field of ML, DL also uses algorithms to analyze data, learn from that data and make a determination or prediction about new data. What is Supervised Learning and Unsupervised Learning?  That learning from data mentioned earlier can happen in two ways: Supervised and Unsupervised. Supervised: Model learns and makes inferences from the data that has been already labeled. Unsupervised: Model learns and makes inferences from unlabeled data. What is Artificial Neural Network (ANN)? ANN are computing systems that are inspired by the human brain's neural network. These networ...

Concurrency, Thread

Definition: Concurrency is when two tasks  overlap  in execution. In programming, these situations are encountered: When two processes are assigned to different cores on a machine by the kernel, and both cores execute the process instructions at the same time. When more connections arrive before earlier connections are finished, and need to be handled immediately. More generally, it’s when we need to handle multiple tasks at about the same time. That’s it. That’s all concurrency is.  Parallel  execution is when two tasks  start  at the same time, making it a special case of concurrent execution. 4 levels of  Concurrency: -- Machine Instruction level -- HLL(High-level language) statement level. -- Unit level -- Program level.  There are two types of Concurrency: 1. Physical Concurrency 2. Logical Concurrency Physical Concurrency :   Several program units from the same program literally execute simultaneously on dif...