Posts

Showing posts with the label interview

interview

 Capgiminin interview---Fail 1.Introduction  2.In dependency injection : scope and transient 3.Solid Principle in your project 4.write progrmme  Given two inputs:   Input 1: A list of numbers   Input 2: A target number Find all distinct pairs from the list that add up to the target number.   Example: Input 1: [8, 7, 1, 6, 5, 3, 2, 2, 4, 5] Input 2: 10   Output: 8, 2   7, 3   6, 4   5, 5 Below are clear and interview-ready answers for your next round: ✅ 2. Dependency Injection: Scoped vs Transient Transient A new instance is created every time it is requested. Best for lightweight, stateless services . Example: Utility classes, helper services, logging wrappers. services.AddTransient<IEmailService, EmailService>(); Scoped One instance per HTTP request . Shared across all components within the same request . Best for database operations , business logic tied to a single request. services.AddScoped...

Interview question and answers

Image
OOPS, or Object-Oriented Programming System , is a programming paradigm that organizes software design around objects rather than functions or logic. An object is an instance of a class, which can contain data (attributes or properties) and methods (functions or behaviors) that operate on the data.OOP concepts help organize and structure code for better reusability, scalability, and maintenance. Here are the core OOP concepts in C#: 1. Encapsulation Encapsulation is the process of keeping data and methods that operate on that data within a single unit (i.e., a class) and restricting direct access to some of the object's components. This is achieved in C# by defining access modifiers like public , private , and protected . Example : csharp Copy code public class Car { private int speed; // Private field - accessible only within the class public int Speed // Public property with getter and setter { get { return speed; } set { speed = valu...