Posts

Showing posts from May, 2025

GATE EXAM

## 🧠 What is GATE? The **GATE exam** is a national-level test conducted to evaluate the **understanding of various engineering and science subjects**. It is primarily used for: * **Postgraduate admissions** (M.Tech/M.E./Ph.D.) in IITs, NITs, IIITs, and other top institutes. * **Recruitment to PSUs** (Public Sector Undertakings) like IOCL, NTPC, ONGC, etc. * **Higher studies abroad** in some countries (like Germany and Singapore). * **Fellowships and scholarships** (like in CSIR labs and research institutes). --- ## 📌 GATE 2025 Highlights | Feature | Details | | -------------------- | ---------------------------------------------------- | | **Conducting Body** | IISc Bangalore or one of the IITs (rotational basis) | | **Eligibility** | Bachelor's degree in Engineering/Technology/Science | | **Exam Mode** | Online (Computer-Based Test) | | **Duration** | 3 Hours ...

Consume API in MVC Application

Image
 To map the response from API ( https://localhost:7264/api/Product ) to a .NET MVC Web App , you need to call the API from your controller and deserialize the response into a model, which you can then pass to a view. 1: Create the Product Model 2: Call API from MVC Controller 3: Register HttpClient in Program.cs (or Startup.cs ) 4: Create the Razor View ( Views/Product/Index.cshtml ) 5: Route to Controller Step 1: Create the Product Model public class Product {     public int Id { get; set; }     public string Name { get; set; }     public decimal Price { get; set; } } Step 2: Call API from MVC Controller using Microsoft.AspNetCore.Mvc; using ProductManagementMVC.Models; using System.Net.Http.Headers; using System.Text.Json; namespace ProductManagementMVC.Controllers {     public class ProductController : Controller     {         private readonly HttpClient _httpClient;         public Pro...

API development using .NET Core - ProductManagmentCRUD

Image
 1) Create Database and Table as mentioned below queries create table products(ProdId int Primary key, ProductName varchar(20), Price int ) insert into products (ProdId, ProductName, Price ) values (1,'Laptop','45000'); insert into products (ProdId, ProductName, Price ) values (2,'Mouse','500'); insert into products (ProdId, ProductName, Price ) values (3,'Router','1800'); select * from products; 2) Create ASP.NET Core API Project Install NuGet Packages  3)  AppSettings.json {   "Logging": {     "LogLevel": {       "Default": "Information",       "Microsoft.AspNetCore": "Warning"     }   },   "ConnectionStrings": {     "DbConnection": "Server=Server_name; Database=ProductManagementCrud; User Id=sa; password=oj#$kdfn; TrustServerCertificate=True;"   },   "AllowedHosts": "*" } 4) Model -  Product.cs namespace ProductManagmentCRUD.Mo...

Reverse String using C#

 using System; //Input- My name is Sachin //Expected output- yM eman si nihcaS public class HelloWorld {     public static void Main(string[] args)     {         string input = " My name is Sachin ";         string[] words = input.Split(' ');         string result = "";         foreach (string word in words)         {             char[] chars = word.ToCharArray();             Array.Reverse(chars);             result += new string(chars) + " ";         }         // Trim the extra space at the end         result = result.TrimEnd();         Console.WriteLine(result);     } }

Singleton Design Pattern Realtime Example of banking

Image
Logger Utility in a Banking System using Singleton In a banking application, you might have a logger that logs important events like transactions, errors, and user activities. You want to ensure that only one instance of the logger exists throughout the application to maintain a consistent log format and avoid file access conflicts. 1) Why Singleton? A logging class doesn't need multiple instances. One instance is sufficient and more efficient. 2) Consistency: All log messages are centralized through one instance. 4) Resource Management: Avoids file access conflicts and redundant memory usage. using System; public sealed class Logger {     private static Logger instance;     // Private constructor to prevent instantiation from outside     private Logger()    {         Console.WriteLine(" Logger Initialized. ");     }     // Public method to get the single instance     public static Logger ...

Coding Round

 using System; using System.Linq; using static System.Runtime.InteropServices.JavaScript.JSType; class Program {     public static void Main()     {         ProblemStatementOne.ArrayHeights();         ProblemStatementTwo.RearrangeArray();                     } } public static class ProblemStatementOne {     public static void ArrayHeights()     {         int[] heights = { 10, 6, 8, 5, 11, 9 }; //exp op [3,1,2,1,0]         List<int> result = new List<int>();         for (int i = 0; i < heights.Length; i++)         {             int count = 0;             for (int j = 0; j < i; j++) // look only to the left             {             ...

Angular Questions and Answers

List of commonly asked Angular interview questions along with clear, concise answers.  Core Angular Concepts 1. What is Angular? Angular is a TypeScript-based front-end web framework developed by Google for building single-page applications (SPAs) with MVC architecture. 2. What is a Component in Angular? A component controls a part of the UI. It consists of: A class ( .ts ) for logic An HTML template Optional CSS styles 3. What is a Module? An Angular module ( NgModule ) is a container for a set of related components, services, and other modules. Example: AppModule , SharedModule 4. What are Directives? Directives modify DOM behavior or structure. Structural: *ngIf , *ngFor Attribute: ngClass , ngStyle 5. What is Data Binding? Mechanism to bind data between component and view. Types: One-way (Interpolation, Property binding) Two-way ( [(ngModel)] ) Advanced Angular Features 6. What is Dependency Injection (DI)? A design pattern in Angular for injecting ...

React Interview Questions and answers

React + JavaScript Technical Interview Questions and Answers 1. What is Callback Hell? Callback Hell is a pattern of deeply nested callbacks that make asynchronous code hard to read and maintain. Solutions: Promises, async/await , and modularizing logic. 2. What is React Fiber? React Fiber is the internal engine that enables React to handle rendering more efficiently with incremental rendering , prioritization , and pausing/resuming work . 3. What is the render() function? In class components, render() returns JSX that describes what the UI should look like. It’s a pure function based on props and state. 4. What are Higher-Order Components (HOCs)? Functions that take a component and return a new one, used to add reusable logic (e.g., logging, data fetching). Example: withAuth(Component) . 5. What is a React Portal? A way to render children into a DOM node outside the main component hierarchy (e.g., modals). Use: ReactDOM.createPortal(child, container) . 6. What is memo in React?...

.NET Interview Questions and Answers for .NET, Web API, and SQL:

1. What is the use of Startup.cs and Program.cs in .NET? Program.cs : Entry point of the application. Builds and runs the host. Startup.cs : Configures services (via ConfigureServices ) and the HTTP request pipeline (via Configure ). 2. What is middleware in .NET Core? Middleware is software that handles requests and responses in the HTTP pipeline. Examples: authentication, routing, exception handling. 3. What is the difference between Authentication and Authorization? Authentication : Verifies who the user is. Authorization : Determines what the user can access. 4. How to authenticate Web API? Common methods include: JWT (JSON Web Token) OAuth2 API Keys Cookie-based (less common for APIs) Use [Authorize] attribute with appropriate schemes. 5. What are HTTP verbs in Web API? GET : Retrieve data POST : Create data PUT : Update/replace data PATCH : Update part of data DELETE : Remove data 6. How to make Web API accept onl...