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.
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.
Interview Explanation:
I use Transient when the service is stateless and cheap to create.
I use Scoped for database context and business services to maintain consistency within a single request.
✅ 3. SOLID Principles in Your Project (Simple & Perfect Answer)
S — Single Responsibility Principle
-
Each class had only one responsibility.
-
Example: In my project,
PurchaseOrderServicehandled PO logic, whileEmailServicehandled notifications.
O — Open/Closed Principle
-
Classes open for extension, closed for modification.
-
Example: Added new discount types by extending strategy classes without touching existing logic.
L — Liskov Substitution Principle
-
Derived classes should work anywhere the base class works.
-
Example: Payment classes like
CreditCardPaymentandUPIPaymentreplaced the base classPaymentMethod.
I — Interface Segregation Principle
-
Small, specific interfaces instead of large ones.
-
Example:
IEmailSender,ISmsSenderinstead of one heavyINotificationService.
D — Dependency Inversion Principle
-
Depend on abstractions, not concrete classes.
-
Example: Services injected using interfaces via DI container.
⮞ This is a perfect senior-level answer.
✅ 4. Program: Find Distinct Pairs That Sum to Target
C# Optimized Solution Using HashSet
Example Output
For input:
[8, 7, 1, 6, 5, 3, 2, 2, 4, 5]
Target = 10
Output:
LTI Mind tree interview --Fail ---27-11-2025
1.String and String Builder
2.Extension Method
3.Middleware responsebality
4.CORS and CORS Policy in coding
5.Sequence of Filters
6.Student and Deparment Cross join how you write
7.in function have one Select query and update query how you manage
8.React JS , What is Layout Effect
9.Hooks
✅ 1. String vs StringBuilder
String
-
Immutable (value cannot change once created).
-
Every modification creates a new object → more memory + slow for repeated operations.
-
Use when values are small and rarely changed.
StringBuilder
-
Mutable (can modify without creating new objects).
-
Best for loops, concatenations, dynamic strings.
-
Faster & more memory-efficient for heavy string operations.
✅ 2. Extension Methods
-
Extension methods allow adding new methods to an existing class without modifying the class.
-
Defined inside a static class and must have static methods.
-
First parameter uses
thiskeyword.
Example:
Usage:
✅ 3. Middleware Responsibilities
Middleware in ASP.NET Core:
-
Processes HTTP requests and responses.
-
Executes in a pipeline sequence.
-
Can perform logging, authentication, routing, exception handling, caching, CORS, compression, etc.
-
Each middleware can pass the request to the next middleware or short-circuit the pipeline.
✅ 4. CORS and CORS Policy
CORS (Cross-Origin Resource Sharing)
Allows or blocks cross-domain API calls from browsers.
Example: Frontend on http://localhost:3000 calling API on http://localhost:5000.
CORS Policy Setup (ASP.NET Core)
Program.cs
Enable:
✅ 5. ASP.NET Core Filters Sequence
Order of execution (outer → inner → return):
-
Authorization Filter
-
Resource Filter
-
Action Filter
-
Exception Filter
-
Result Filter
Memory trick: AR AER
Authorization → Resource → Action → Exception → Result
✅ 6. Student and Department Cross Join Query
No ON condition in CROSS JOIN → returns all combinations.
✅ 7. In a function if you have SELECT and UPDATE query, how to manage?
Answer:
-
Use Transaction to maintain data consistency.
-
If SELECT result is required for UPDATE, use
BEGIN TRANSACTION. -
If any failure occurs, rollback.
Example:
Or in SQL:
✅ 8. In React JS, what is useLayoutEffect?
-
Similar to
useEffectbut runs synchronously after DOM updates and before the browser paints. -
Used when:
-
You need to measure DOM elements (width/height).
-
You need to adjust UI before the screen is visible.
-
-
Prevents flickering.
Example:
✅ 9. Hooks in React
Hooks are functions that let you use React features in functional components.
Common Hooks:
-
useState → State management
-
useEffect → Side effects (API calls, timers)
-
useContext → Global state
-
useRef → Access DOM elements
-
useMemo → Performance optimization (memoized values)
-
useCallback → Memoized functions
-
useReducer → Complex state logic
-
useLayoutEffect → DOM measurements before paint
Comments
Post a Comment