C# Interview Questions

 Question 1: What is CQRS design pattern?

Answer: CQRS is Command Query Responsibility Segregation Pattern. It helps in separating the concerns such as Reads from Writes. Hence you have more flexibility to scale your specific concerns such as if you have lot of users visiting you portal but very few posting contents then you need scaled read a low profile write.

Question 2: How to implement SPA using angular-UI route?

Answer: AngularJS provides a great way to make single page applications. When creating single page applications, routing will be very important. We want our navigation to feel like a normal site and still not have our site refresh. We’ve already gone through Angular routing using the normal ngRoute method.

Question 3 :In which scenarios you will go for NoSQL over SQL?

Answer: In scenario where you have catalogue data. Least relationships in data and more of listing or catalogue. Example -: Product listings, Surveys or Q &A websites, blogs etc. If I have this requirement can go for NoSQL. — For complex relation data, Banking, insurance and trading etc applications. Customer-account-orders etc relations , financial transactions. In these scenarios SQL is recommended.

OR

When we have to deal with unstructured data,and low functionality is there.And we don’t need for join operation then we can go for NOSQL. Eg:- Twitter posts (growing list of data)In case of structured data with high functionality where more transactions are required then go for SQL. Eg:- Banking transactions.

Question 4: Difference between FirstOrDefault and First in LINQ?

Answer: First() – There is at least one result, an exception is thrown if no result is returned.FirstOrDefault() – Same as First(), but not thrown any exception or return null when there is no result.

Question 5: Difference between IEnumerable and Enumerable

Answer: Every type that implements the IEnumerable interface should implement a method GetEnumeratorwhich returns a type that implements the IEnumerator interface. Then having an enumerator you can use the foreach statement, which in its essence implements the iterator pattern, to traverse the elements of a collection of your custom type.

For further clarification please take a look to the following links:

  1. IEnumerable
  2. IEnumerator
  3. Iterator Pattern

So in order to answer to your question, I have to say that we shouldn’t try to compare the IEnumerable and IEnumerator. They both are used together, when we want to use the iterator pattern for a custom type

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *