Software Engineer concepts Flashcards

1
Q

Encapsulation in OOP

A
  • Encapsulation is the bundling of data (attributes) and methods (functions) that operate on the data into a single unit called a class. It also involves restricting access to some components, protecting the integrity of the object’s data by using access modifiers such as private, public, and protected.
  • Example: A Car class with private data like speed and public methods like accelerate() and brake().
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Abstraction in OOP

A
  • Abstraction hides the complex implementation details of a system and shows only the essential features to the user. The idea is to reduce complexity and allow the programmer to focus on interactions at a high level.
  • Example: You use a method startEngine() in a Car class without needing to know the internal workings of how the engine starts.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Inheritance in OOP

A
  • Inheritance allows one class (child or subclass) to inherit properties and methods from another class (parent or superclass). This promotes code reuse and establishes a natural hierarchy between classes.
  • Example: A Sedan class can inherit from a general Car class, thus inheriting properties like speed and methods like drive().
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Polymorphism in OOP

A
  • Polymorphism means “many forms” and allows objects of different classes to be treated as objects of a common superclass. There are two types of polymorphism:
  • Compile-time (method overloading): Multiple methods can have the same name but different parameters.
  • Run-time (method overriding): A subclass can provide its own implementation of a method that is already defined in its superclass.
  • Example: A Vehicle class has a method move(). Both Car and Bike inherit move(), but each has its own implementation (overriding it) depending on the type of vehicle.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the SOLID principles?

A
  1. Single Responsibility Principle (SRP): A class should have only one reason to change. It states that a class should have only one responsibility or purpose. This helps keep classes focused and makes them easier to understand, test, and maintain.
  2. Open-Closed Principle (OCP): Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification. This principle encourages designing modules that can be extended with new functionality without modifying their existing code. This promotes code reuse and minimizes the risk of introducing bugs when making changes.
  3. Liskov Substitution Principle (LSP): Objects of a superclass should be replaceable with objects of their subclasses without affecting the correctness of the program. It ensures that derived classes can be used as substitutes for their base classes without causing unexpected behavior. This principle defines a behavioral contract that derived classes must uphold.
  4. Interface Segregation Principle (ISP): Clients should not be forced to depend on interfaces they do not use. It promotes the idea of segregating interfaces into smaller and more focused ones, tailored to specific client needs. This prevents clients from being burdened with unnecessary dependencies and provides better flexibility and maintainability.
  5. Dependency Inversion Principle (DIP): High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details; details should depend on abstractions. It encourages decoupling and dependency injection, where dependencies are defined through interfaces or abstractions instead of concrete implementations. This improves flexibility, testability, and modularity.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what is asynchronous programming

A

Asynchronous programming is a programming paradigm that allows tasks or operations to run independently of the main program flow, without blocking the execution of other tasks. It is particularly useful for operations that can take a long time to complete, such as file I/O, network requests, or database access, enabling the application to remain responsive while those tasks are running in the background.

In asynchronous programming, instead of waiting for a long-running task to finish before proceeding, the program can continue executing other code, and the result of the task is handled when it eventually completes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is IoC - Inversion of Control?

A

Inversion of Control (IoC) is a design principle in software engineering where the flow of control of a program is inverted compared to traditional programming. Instead of the program controlling how objects and services are created and managed, control is “inverted” to a framework or external component. The key idea is that components don’t directly instantiate or manage their dependencies. Instead, those dependencies are provided or “injected” by an external mechanism.

IoC helps in loosely coupling components, making the system more modular, testable, and easier to maintain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Dependency Injection?

A

Dependency Injection (DI) is a specific implementation of the IoC principle. It refers to the practice of injecting the dependencies (such as services or objects) that a class needs from the outside rather than the class instantiating them itself. The dependencies are injected via one of three common methods:
* Constructor Injection (most common)
* Property Injection
* Method Injection

DI is a way to implement IoC, where an external component (typically an IoC container) provides the dependencies for a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Docker file, and what does it define?

A

A Docker file is a blueprint that defines the steps to create a Docker image, specifying the base image, dependencies, file transfers, and default commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are Docker images, and how are they created?

A

Docker images are read-only snapshots of environments, created using docker build from Docker files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do containers relate to Docker images?

A

Containers are runtime instances of Docker images, running in isolation with their own filesystem, network, and processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Docker’s primary purpose?

A

To simplify the creation of consistent environments and isolate applications from host dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is one of Docker’s most significant advantages for software development?

A

Fast, lightweight, and portable container environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What Is OpenAPI?

A

OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:
* Available endpoints (/users) and operations on each endpoint (GET /users, POST /users)
* Operation parameters Input and output for each operation
* Authentication methods
* Contact information, license, terms of use, and other information.

API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What Is Swagger?

A

Swagger is a set of open-source tools built around the OpenAPI Specification that can help you design, build, document, and consume REST APIs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is TCP?

A

TCP stands for Transmission Control Protocol, a communications standard that enables devices and applications to exchange data over a network. TCP is a fundamental part of the internet’s rules and is one of the most commonly used protocols in digital network communications.

TCP works with the Internet Protocol (IP) to ensure that data is delivered reliably.

TCP (Transmission Control Protocol) is an important network protocol that lets two hosts connect and exchange data streams. TCP guarantees the delivery of data and packets in the same order as they were sent.

17
Q

What is HTTP?

A

Hypertext Transfer Protocol (HTTP) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers, but it can also be used for other purposes, such as machine-to-machine communication, programmatic access to APIs, and more.

HTTP is a protocol for fetching resources such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is typically constructed from resources such as text content, layout instructions, images, videos, scripts, and more.

18
Q

What is TLS?

A

Transport Layer Security (TLS), formerly known as Secure Sockets Layer (SSL), is a protocol used by applications to communicate securely across a network, preventing tampering with and eavesdropping on email, web browsing, messaging, and other protocols. Both TLS and SSL are client / server protocols that ensure communication privacy by using cryptographic protocols to provide security over a network. When a server and client communicate using TLS, it ensures that no third party can eavesdrop or tamper with any message.

All modern browsers support the TLS protocol, requiring the server to provide a valid digital certificate confirming its identity in order to establish a secure connection. It is possible for both the client and server to mutually authenticate each other, if both parties provide their own individual digital certificates.

19
Q

What is Cache?

A

A cache (web cache or HTTP cache) is a component that stores HTTP responses temporarily so that it can be used for subsequent HTTP requests as long as it meets certain conditions.

20
Q

What is a host (network)?

A

A host is a device that can access a network and communicate with other devices on that network.

21
Q

What is the difference between TCP and TLS?

A

The main difference between TCP and TLS is that TCP is responsible for reliable data delivery, while TLS is responsible for encrypting and securing data:

TCP (Transmission Control Protocol)
Responsible for establishing reliable connections and ensuring data is sent and received accurately between devices over a network. TCP is the backbone of internet communication.

TLS (Transport Layer Security)
Responsible for encrypting data during transmission to ensure privacy and security. TLS adds a layer of security on top of TCP, using symmetric and public key encryption, authentication, and message tampering detection.

TLS is an updated, more secure version of SSL, and the terms are often used interchangeably. TLS handshakes occur after a TCP connection has been opened.

22
Q

What is the application layer in the OSI model?

A

The Application Layer of OSI (Open System Interconnection) model, is the top layer in this model and takes care of network communication. The application layer provides the functionality to send and receive data from users. It acts as the interface between the user and the application. The application provides services like file transmission, mail service, and many more.

23
Q

How does PKCE work for SPA?

A

Sure! Here’s a quick and simple summary of PKCE for SPAs:

  1. Generate a Secret: Your SPA creates a random string (code verifier) and a hashed version of it (code challenge).
  2. Start Login: Your SPA sends the code challenge (hashed secret) to the login server when redirecting the user to log in.
  3. Get Authorization Code: After the user logs in, the login server sends an authorization code back to your SPA.
  4. Prove It’s Your App: Your SPA sends the authorization code and the original code verifier (the random secret) back to the login server to get the access token.
  5. Verification: The login server hashes the code verifier and checks if it matches the original code challenge. If they match, it gives your SPA the access token.

Why? It ensures only your app can finish the login process, even if someone steals the authorization code.

24
Q

How does Client Credentials Grant flow work?

A

Sure! Here’s a concise summary of the Client Credentials Grant flow:

  1. Purpose: Used for machine-to-machine (M2M) communication where a client app (not a user) needs to access resources.
  2. Setup: The app registers with the authorization server and gets a client ID and client secret.
  3. Request Access Token:
    • The app sends a POST request to the token endpoint with:
      • grant_type=client_credentials
      • client_id and client_secret (usually in the Authorization header, Base64-encoded).
      • Optionally, requested scopes.
  4. Token Response:
    • If the credentials are valid, the server returns an access token.
  5. Access Resources:
    • The app uses the token (in the Authorization: Bearer header) to access protected APIs.

Why? It allows secure authentication and authorization for applications that act on their own behalf without user involvement.

25
Q

What is a WebHook?

A

A webhook is a lightweight, event-driven communication that automatically sends data between applications via HTTP. Triggered by specific events, webhooks automate communication between application programming interfaces (APIs) and can be used to activate workflows, such as in GitOps environments.

Because webhooks can connect event sources to automation solutions, they are 1 way to launch event-driven automation to perform IT actions when a specified event occurs.

26
Q

What is an API Key?

A

An API key is a unique identifier used to authenticate and authorize requests made to an Application Programming Interface (API). It acts as a passcode that allows applications, users, or systems to access specific features or data offered by the API. API keys are widely used in software development to ensure secure and controlled access to services.

27
Q

when does the project use appsettings.Development.json, appsettings.local.json and the default appsettings.json?

A

In an ASP.NET Core project, the configuration files appsettings.json, appsettings.Development.json, and appsettings.local.json are used to manage different settings for various environments. Here’s when each file is used:
1. appsettings.json: This is the default configuration file that is always loaded, regardless of the environment. It contains the base configuration settings for the application.
2. appsettings.Development.json: This file is used when the application is running in the Development environment. It overrides the settings in appsettings.json with development-specific settings. The environment is typically set to Development when running the application locally for development purposes.
3. appsettings.local.json: This file is not a standard file used by default in ASP.NET Core. However, it can be used for local overrides. If you want to use this file, you need to explicitly add it to the configuration in your Program.cs or Startup.cs file.

28
Q

Basic Authentication

A

Basic Authentication is a method for an HTTP user agent (e.g., a web browser) to provide a username and password when making a request.

29
Q

HTTP vs HTTPS

A

/

30
Q

Why does a HTTP request need an Authorization header?

A

/

31
Q
A