Wednesday, May 23, 2018

Interview Question Helm

Draw the architectural diagram of your current project
Event loop in javascript
Ans:

JavaScript has a concurrency model based on an event loop. JavaScript runtime contains a message queue, which is a list of messages to be processed. Messages are taken out of the queue and processed by the browser UI thread. So, the browser basically works in a loop, picking up and processing messages to do things.

CQRS

Onion architecture

Hexagonal architecture

call() apply() and bind() in javascript
Ans : used to bind this.

setinterval() vs settimeout() javascript

how to stop settimeout() in javascript
Ans : use Cleartimeout method

scope in javascript

closures in javascript

IIFE (Immediately Invoked Function Expression) is a JavaScript

Lexical Scoping

What is benifit of => fat arrow

What is new in ES 6

Write the UML diagram of any pattern you have used

Write the code for Singleton pattern


Diff between let and var

Explain prototype why and when

Explain Nocnflict

Why we use use strict

If this keyword used globally in js file than which object it will refer.
Ans  Window

UML diagram of singleton/Factory

Agile methodology  which approach we use top down and bottom up


Friday, May 18, 2018

Settimeout Tricky Question

// interviewer: what will the following code output?
const arr = [10, 12, 15, 21];
for (var i = 0; i < arr.length; i++) {
  setTimeout(function() {
    console.log('Index: ' + i + ', element: ' + arr[i]);
  }, 3000);
}

Output

Index: 4, element: undefined(printed 4 times)

The reason for this is because the setTimeout function creates a function (the closure)
that has access to its outer scope, which is the loop that contains the index i.
After 3 seconds go by, the function is executed and it prints out the value of i,
which at the end of the loop is at 4 because it cycles through 0, 1, 2, 3, 4 and
the loop finally stops at 4.arr[4] does not exist, which is why you get undefined.


Solution

const arr = [10, 12, 15, 21];
for (var i = 0; i < arr.length; i++) {
  // pass in the variable i so that each function
  // has access to the correct index
  setTimeout(function(i_local) {
    return function() {
      console.log('The index of this number is: ' + i_local);
    }
  }(i), 3000);
}

Thursday, May 3, 2018

Deferred Execution or Delayed Execution in LINQ Query

Deferred execution means that the evaluation of an expression is delayed until it is required. It improves performance.
Deferred execution is applicaion to any in memory collection like LINQ-to-SQL, LINQ-to-Entities,LINQ-to-XML, etc.

Example :-

1. IList studenlist = new List(){new Student(){Id=1,Name="Abdul",new Student(){Id=2,Name="Ahad"}

2. var teenAgerStudens = from s in studentlist
       where id>0
select s;

3.foreach(Student teenStudent in teenAgerStudens)
Console.WriteLine("Student Name {0}", teenStudent.Name)

The will not execute at line 2 where it is delared but will execute at line 3 where
it is used.

EC Info System 2

What is use of CTE

In which view we can not use DML statement
Ans : Complex View Contains Multiple Tables Data hence it is not possible to perform DML command on this view.

What is delayed execution

Where we have to create control in ASP .net so that it's view state would maintain

How to initiate printing action in ASP .net asynchronously

How to update database from data set?
Ans using Update method

What is other use of data adoptor other than fill data set.
Ans you can run queries with data adaptor.

What design pattern you see in ATM?
Ans. Abstract Factory while selecting account and chain responsibility while withdrawing money for selecting the note.

What is materialized view ?

What is index view?

How to extract date part from datetime string?
Ans cast the string in date type
Convert(date, getdate()).

What is the use of GetDate()?
Ans gives the current date time

What is lambda expression how to use it?

Followers

Link