client interview on Indi_go In.fy - ShobaKrish/Infoy GitHub Wiki

Naming convention of the project on different layers and its folders

Txt file - > read the data -> import database

TestProj - Indigo.TestProj-> Program.cs -> Main() Web.config

Presentation layer -> Method(parameter) Business layer -> Indigo.TestProj.BL -> BLReadText.cs Interfaces , Model class , Images , Data access layer -> Indigo.TestProj.DAL -> DALReadText.cs . Entity framework /


First interview – About yourself and the previous projects 2. `? What are the different methods we use (Get, post, put, delete) with Use case? 3. Which protocols are supported by webApi and Wcf? 4. String s= aabcbd We want to get the first non-repeated char of this dtring. How do we do that in c#. 5. There are 2 tables. First table product with productId as primary key and price. Second table Order with orderId as primary key, productId as foreign key and quantity. Any user can place order for only one type of product but can order any number of quantity. Now how do we retrieve the top 10 best selling products.

Second Interview – How you were working in agile and grooming sessions takes place. 2. What questions you would ask the product owner during the grooming session. 3.What is a web api. 4. How crud operations takes place in api? 5. What did create method will return in case of web api. Third Interview If new WEB API (manage order) need to create then how you deal with BA and TA Agile practices what is Azure logic app/ function app and in which use case we need to use which one. Azure SQL data factoring Web API create function return type WEB API create function error message type in case of parameter casting error and database layer error Web API Filter attribute Can we apply multiple function app functions on azure Queue. SQL server max item sold query for ites whose price is less then 5. SQL server no lock SQL - Difference between group by and partition by SQL query to find out duplicate records C#- yield c#- Task Vs Thread c#- Linq anonymous object C#- String s= aabcbd , We want to get the first non-repeated char of this string Azure functions - Basic WCF contract types How to deal with issues which are reproducible at QA but not on Dev. How you do Unit testing in last project


Answers:

-------Webapi--------------- 1. What is webapi?

The ASP.NET Web API is an extensible framework for building HTTP based services(RESTful services) that can be accessed in different applications on different platforms such as web, windows, mobile etc. It supports http protocol. It sends data as a response(JSON/XML/Other format)

ASP.NET Web API is a framework that helps you to build services by making it easy to reach a wide range of clients including browsers, mobiles, tablets, etc. Web API receives requests from different types of client devices like mobile, laptop, etc, and then sends those requests to the webserver to process those requests and returns the desired output to the client.

  1. Which protocols are supported by webApi and Wcf? WCF supports HTTP, UDP, and custom transport protocol whereas Web API supports only HTTP protocol.

3.diff between httpput nd httppost? HTTPGet method creates a query string of the name-value pair whereas HTTPPost method passes the name and value pairs in the body of the HTTP request. HTTPGet method is default whereas you need to specify HTTPPost attribute if you are posting data using HTTPPost method.

HTTPPUT- add and update records HTTPPost- add new records HTTPdelete - Deleting records HTTP get- read records HTTPPATCH- update records partially

HTTP PUT- IDempotent (IF request url is same as response url)(ID generated by client Ex:ID=1001, if records already available then update, if no record for that ID then create ) HHTP Post - non idempotent(If req and response url is different)(ID is generatd by server during creation of resoucrce)

Add a new resource -POST Update a new resource - PUT CLient generated ID - PUT

HTTPPUT- Full updates HTTPPATCH- Customised updates

  1. What did create method will return in case of web api. HTTPStatus code: OK: 200(Success) Created: 201(Successful creation of data) BadRequest: 400(This is used for Bad Request. If you enter something wrong or you missed some required parameters, then the request would not be understood by the server, and you will get 400 status code.) 401: This is used for Unauthorized Access. If the request authentication failed or the user does not have permissions for the requested operations NotFound: 404(This will come if the Data Not Found.) InternalServerError: 500

5.Action Method Return Type Void- 204 "No Content" status code as a response when you send HTTP DELETE request Primitive type or Complex type HttpResponseMessage-Convert directly to an HTTP response message. IHttpActionResult - Call ExecuteAsync to create an HttpResponseMessage, then convert to an HTTP response message.

6.Web API Filter attribute

Filter Type Interface Class Description Simple Filter IFilter - Defines the methods that are used in a filter Action Filter IActionFilter ActionFilterAttribute Used to add extra logic before or after action methods execute. Authentication Filter IAuthenticationFilter - Used to force users or clients to be authenticated before action methods execute. Authorization Filter IAuthorizationFilter AuthorizationFilterAttribute Used to restrict access to action methods to specific users or groups. Exception Filter IExceptionFilter ExceptionFilterAttribute Used to handle all unhandled exception in Web API. Override Filter IOverrideFilter - Used to customize the behaviour of other filter for individual action method.

  1. There are 4 common methods of Web API Authentication: HTTP Authentication Schemes (Basic & Bearer) API Keys OAuth (2.0) OpenID Connect

8.WEB API create function error message type in case of parameter casting error and database layer error

-----------------------------C#-yield

What is Thread? A thread is defined as the execution path of a program. Threads are lightweight processes. When a C# program starts execution, the main thread is automatically created. The threads created using the Thread class are called the child threads of the main thread. The Abort() method is used for destroying threads. .NET Framework has thread-associated classes in System.Threading namespace. A Thread is a small set of executable instructions. In .NET Core, the common language runtime (CLR) plays a major role in creating and managing threads lifecycle. In a new .NET Core application, the CLR creates a single foreground thread to execute application code via the Main method. This thread is called primary or main thread.

But in a single processor machine, only one thread can execute at a time. The rest of the threads have to wait until the processor becomes available. Creating more than a few threads on a single processor machine may create a resource bottleneck if not managed properly. Ideally, you want a couple of threads per processor. In the case of dual core processors, having 4 threads is ideal. In the case of a quad core processor, you can create up to 8 threads without noticing any issues.

GET Get() get() GET() GetAllStudent() *any name starting with Get * Retrieves data. POST Post() post() POST() PostNewStudent() any name starting with Post Inserts new record. PUT Put() put() PUT() PutStudent() any name starting with Put Updates existing record. PATCH Patch() patch() PATCH() PatchStudent() any name starting with Patch Updates record partially. DELETE Delete() delete() DELETE() DeleteStudent() any name starting with Delete Deletes record.

*****************************SQL

  1. SQL server nolock The NOLOCK hint allows SQL to read data from tables by ignoring any locks and therefore not being blocked by other processes. This can improve query performance, but also introduces the possibility of dirty reads.

  2. SQL query to find out duplicate records

SELECT OrderID, COUNT(OrderID) FROM Orders GROUP BY OrderID HAVING COUNT(OrderID)>1

  1. how do we retrieve the top 10 best selling products. product - pid, price Order- Oid,Pid , Qty

select top 5 P.ID, sum(Quantity) from customer_invoice group by P.Id Order by sum(Quantity) desc

  1. SQL groupby and partition by: A group by normally reduces the number of rows returned by rolling them up and calculating averages or sums for each row. partition by does not affect the number of rows returned, but it changes how a window function's result is calculated.

2.1 SQL - Difference between group by and partition by 1.We get a limited number of records using the Group By clause We get all records in a table using the PARTITION BY clause.

Student Name, Subjcolumn: Subj1,sub2,sub3

2.2 Group by ex1: List of students and total

select studentname, sum(subj)as total from studenttable groupby studename

output:

John 300 jac 200

Group by ex 2: SELECT Customercity, AVG(Orderamount) AS AvgOrderAmount, MIN(OrderAmount) AS MinOrderAmount, SUM(Orderamount) TotalOrderAmount FROM [dbo].[Orders] GROUP BY Customercity;

2.3 PArtition by:

SELECT Customercity, CustomerName, OrderAmount, AVG(Orderamount) OVER(PARTITION BY Customercity) AS AvgOrderAmount, MIN(OrderAmount) OVER(PARTITION BY Customercity) AS MinOrderAmount, SUM(Orderamount) OVER(PARTITION BY Customercity) TotalOrderAmount FROM [dbo].[Orders];

Chicago Roland 300 Chicago John 280 Austin Edward 250 Austin Ray 200 Austin stella 200

1.---------------How you do Unit testing in last project?

Positive and negative scearios. Changes that I made that doesnt affects the existing functionality.

Search page functionality that fetches list of records same as before

2.---------------How to deal with issues which are reproducible at QA but not on Dev.?

  • Database pointed to QA and Dev are same
  • any recent deployment in QA causes the issue
  • Check for timeline from when the issue has been reporoduced in QA

3---------------What questions you would ask the product owner during the grooming session. About user experience on recently moved tickets/ recently deployed items If there is any performance issues Functionality enhancement can be done for better user experience Are there security aspects we need to take into account? Where do we see dependencies with other user stories or teams?

4.-------------How you were working in agile and grooming sessions takes place. 1.Scrum master , Business analyst, alongwith the team

2.If it any critical incident happened for the day , that will be discussed at first 3. Current spring assigned JIRAS, if any clarifications and demos that will be discussed 4. LAst few mins for grooming the pending ungroomed tickets for the tickets which needs to work on next sprint

5______________Solera--------------------------------- About yourself and the previous projects? Solera Inc, lot of applications, claim for car insurance and repair One maaco vehicle repair category : Retail-> direct customer to bodyshop Trade nd fleet -> through agency' Insurance -> claim for insu Warranty-> 1year warranty

Paint: spot-> One o the parts repain in car GLcode Overall-> car paint materials related to GL code

Vendor supply car parts

weekly status business report: wsbr report saturday-friday List of sale n repair and profit

date in and dateout - vehicle repair completed comppleted-> customer taken

Estimates: Import estimates by body shop for trand n fleet nd insurance


  1. c# yield

https://www.youtube.com/watch?v=4fju3xcm21M control moves from caller to source and source back to caller to and fro. USe of yield keyword is for stateful custom iteration main() { MyList.Add(1); MyList.Add(2) foreach(int i in Filter()) { console.WriteLine(i); } console.REadLine(); IEnumerable Filter() { foreach(int i in MyList) { if(i>3) { yield return i; } } } You use a yield return statement to return each element one at a time.

You can use a yield break statement to end the iteration. Stateful custom iteration

The yield contextual keyword actually does quite a lot here.

The function returns an object that implements the IEnumerable interface. If a calling function starts foreaching over this object, the function is called again until it "yields". This is syntactic sugar introduced in C# 2.0. In earlier versions you had to create your own IEnumerable and IEnumerator objects to do stuff like this.


  1. task vs thread https://www.youtube.com/watch?v=No7QqSc5cl8

Threading:parallel code execution. It helps in execute programming code parallely 1.foreground thread: If the main function quits, foreground Threads run until it completes its task 2.Backgroundthread: If main function quits, background thread also stop executing (obj1.ISBackground= true)

If i have multiple function and to run this logic parallely using thread. Main(){ Thread obj1 - new Thread(Func1); Thread obj2 = new Thread(Func2); obj1.Start(); obj2.Start(); }

Threads : have core affinity: Once the thread runs on one core it always runs on that core.

If am running one million iteration method in for loop of a method. Core processor should get optimally utilized. Performance monitoring tool .If I have 2 core processor. 1/2 million in core 1 and another half million task should run in core2.

TPL: all the core processors are optimally utilized . TPL divides tasks, look for which of the processors currently loaded less and execute logic on those processors. Benefits: TPL encapsulates multicore execution. TPL automatically does Thread pooling.

What is a Task in C# ? .net framework provides System.Threading.Tasks.Task class to let you create threads and run them asynchronously.

Queuing a work item to a thread pool is useful, but there is no way to know when the operation has finished and what the return value is.

So thats the reason Microsoft Introduced the concept of Task.

Task is an object that represents some work that should be done.

The Task can tell you if the work is completed and if the operation returns a result, the Task gives you the result.


3.c#- Linq anonymous object

Linq is a uniforming programming model for any kind of data access. It enables you to query and manipulate data independently of datasources. It is a query language which can query any datasourceand any transform

var myquery = from tempvar in objcountries where tempvar =="India" select tempvar.countrycode;

anonymous linq objects: var result = tickets.GroupBy(t => t.EventName) .Select(g => new { EventName = g.Key, TicketCount = g.Sum(t => t.TicketCount), Price = g.Sum(t => t.Price) });

foreach(var x in result) Console.WriteLine("EventName = {0}, TicketCount = {1}, Price = {2}" , x.EventName , x.TicketCount , x.Price);

4.SOLID Principles is a coding standard that all developers should have a clear concept for developing software properly to avoid a bad design.

S - Single Responsibility Principle (known as SRP) O - Open/Closed Principle L - Liskov’s Substitution Principle I - Interface Segregation Principle D - Dependency Inversion Principle

O — Open/Closed Principle This principle suggests that “classes should be open for extension but closed for modification”. What is means is that if the class A is written by the developer AA, and if the developer BB wants some modification on that then developer BB should be easily do that by extending class A, but not by modifying class A. The easy example would be the RecyclerView.Adapter class. Developers can easily extend this class and create their own custom adapter with custom behaviour without modifying the existing RecyclerView.Adapter class.

_-------------------Code

public static char FirstNonRepeatedCharInString (string str)
{
int i, j;
bool isRepeted = false;
char[] chars = str.ToCharArray();
for (i=0; i<chars.Length;i++)
{
isRepeted = false;
for (j=0;j<chars.Length;j++)
{
if ((i!=j) && (chars[i]==chars[j]))
{
isRepeted = true;
break;
}
}
if (isRepeted ==false)
{
return chars[i];
}
}
return ' ';
}

  1. CTE:

WITH myCTE as ( select statement ) select * from myCTE

Ex2:

With CTE1 as (sql query), CTE2 as (sql query ) select cte1 Union selet CTE2

⚠️ **GitHub.com Fallback** ⚠️