Wednesday 13 January 2016

C# .NET - Interview A4 Cheat Sheet

I sarcastically title this as a  C# .NET - Interview A4 Cheat Sheet simply because of the scope of questions in the .NET framework and C# arena. Looking at the summary it shows how extensive the .NET framework has become and how developers are now more than ever retaining large amounts of technical information. I remember doing most of my exams in open book or an A4 sheet of paper. Maybe I should create one for .NET and bring it in the interview.

I should call Interview A4 Cheat Sheet. Might be a good idea :-) Comments\.

Anyway
I am writing this because I recently did an 2 hour phone interview whereby the questions touched on all different aspects of development.

For a phone interview I was amazed at the number of questions asked and the time it took to convey all the answers. I normally feel they can get you off guard. Interviews in IT are sometimes a hit or miss. So I decided to write my experiences on this one. Especially as to what happened at the beginning.

In summary for those who like to experience an indepth preliminary interview here are some of the questions which were asked included.

Reflection allows a .Net developer to inspect public/private objects, methods and properties.
Dynamic only allows access to public objects, methods and properties.

There is a type called dynamic similar to var but its value is not defined in declaration.

Interesting to see how there named the same but there is a difference. Hmmmm.

WeakBinding  - Object properties and methods etc not know until runtime. Typical var or dynamic variable
StrongBinding - Object properties and methods known at runtime.

Array is slower than collection for inserting/deleting records. Array is faster for index and iteration.
IEnumerable Forward only List with iterator. Has Functions like Where SelectFirstOrDefault Count Union Join Min Max Last First to name a few
IQueryable has LINQ to SQL.

Mapping Table is need to correlate a many to many relationship.

SQL Clustered Index Primary Key Flat structure. Slow to create fast to lookup
SQL Non Clustered Index B - Tree structure faster to create than clustered but slower lookup.

CTE - Common Table Expression - Self Referencing Recursive Query.

WITH Sales_CTE (SalesPersonID, SalesOrderID, SalesYear)
AS
-- Define the CTE query.
(
    SELECT SalesPersonID, SalesOrderID, YEAR(OrderDate) AS SalesYear
    FROM Sales.SalesOrderHeader
    WHERE SalesPersonID IS NOT NULL
)

Multithreading
Threads in a process and a seperate process all together.
In a single process a single thread can crash all the app while a process allows independently other threads. (Never saw it that way).

Serialisation
Binary
Xml
SOAP --> I thought that was XML.

HTML5 New Features Introduce Include
Audio
Video
2D
3D
CANVASS

Unmanaged Code
Including unsafe accessed via pointer variables.

Why unmanaged
Avoid Serialisation
API calls
Performance

Generics
Any type safe data structure. Collections are using generics
Others include Queue, Array, SortList, SortedArray.

Always dont like the left/outer join sql questions get left and right muddled up verbally.
Basically the join correlate link 2 or more tables together.
Left Join returns all rows on the left.
But only return rows matching on the right. Where the rows dont match on the right the returns are null.

WCF
The ABC of WCF.
Never saw it as
Address        URL
Binding        Encoding
Contract    Contract

The contract can be further split to
OperationContract
ServiceContract
DataContract

Message - Data without serialisation to class
Stream - Data without serialisation to class
ChannelFactory - Allows retrieval of parts of a data contract without the data contract.

SVCUTIL able to get datacontract C# for wsdl or class or xml etc.

Attributes

Provides metadata (not!!! properties) on class or method.

Entity Framework.

Abstracts SQL and C#
edmx - scripting/xml based file describing the
conceptual model C#
storage model SQL
mapping between them

Lazy, Eager, and Explicit Loading (JOINED READS)

Lazy does not load all related records until you access data.
Eager loads all related records the first go.
Explicit you will need to call load every iteration to read related records.

MVC Filters
Authorisation
Action
Result
Exception
Service Filter
Type Filter
Model - Data Representation  @Model Employees
View - Cshtml (Razor) @Html. @Model.Value
Controller - HTTP Directs To Method and Data Model and View.
return View(employeeModel);
return RedirectToAction("Index");

WEBAPI
[HttpPost]
[HttpGet]
[HttpPut ("{id}")]
[HttpDelete("{id}")]
 
[Route('/Employee/Details/{id}')]

[Route("api/[controller]")] public class TodoController : Controller 

[HttpGet] public IEnumerable<TodoItem> GetAll()  
{ 
    return TodoItems.GetAll();  
}  

[HttpGet("{id}", Name = "GetTodo")] 
public IActionResult GetById(string id)  
{  
    var item = TodoItems.Find(id);  
    if (item == null) { return HttpNotFound(); }  
    return new ObjectResult(item); 
}

JSON / XML application/json


LINQ

SELECT
 
from cust in customers
select cust;

WHERE

from cust in customers
where cust.Name = 'ABC'
select cust;

JOIN

from cust in customers
join dist in distributors on cust.distributorID = dist.distributorID
where cust.Name = 'ABC'
select cust = customers.name, dist = distributors.name;

I hope I have provided a good summary of C# architecturally. From there you can explore the details of each area.





No comments:

Post a Comment