This is one of the confusing question asked during interviews. Many people believe that values in textbox get cleared after postback when EnableViewState property of page is set to false. There are some controls like Textbox (which inherit interface called IPostBackDataHandler) has the capability to restore their values from the posted back.
If we take a look at the sequence in which asp.net life cycle events executes we will find that, there is an event called LoadPostBackData which get raised between LoadViewState and Load event. This one is responsible for retaining values in the controls between postbacks.
So the conclusion is textbox values (in fact values of all control which inherit IPostBackDataHandler) are not dependent on page viewstate and thus values will be retained even after postback regardless of what value EnableViewState property contains.
FileContentResult – Represents a downloadable file (with the binary content).
FilePathResult – Represents a downloadable file (with a path).
FileStreamResult – Represents a downloadable file (with a file stream).
PartialViewResult – Represents HTML and markup rendered by a partial view.
RedirectResult – Represents a redirection to a new URL.
RedirectToRouteResult – Represents a result that performs a redirection by using the specified route values dictionary.
ViewResult – Represents HTML and markup rendered by a view
Now, in order to create the instance of one of the above classes it’s not required to explicitly create the object of ActionResult or any of the above classes. Your controller base class has some helper methods which you can call and simply return. Some of these methods are
Money data type is the most suited data type for storing financial values as they are accurate ten-thousandth of the unit they represent. In financial figures accuracy matters. Small cents add up to millions later.
Further money data type has two variations “money” and “smallmoney”. Money has 8 bytes of storage while small money has 4 bytes of storage.
This in awesome SQL Server interview question video: - Can SQL Server views be updated?
How does JSON format looks like?
The format of JSON is as shown in the below code. It starts with a simple curly brackets, followed with comma separated value and pair and finally ending with a curly bracket.
When you are attending programming interviews you will always see a specific pattern in which the interviewer asks questions. It’s always good to know about this pattern so that you can perform well during interviews. I term this pattern as “What”, “Why “and “How” pattern .
“What” :- Do you really know the topic.
99% times a logical interviewer starts with “What” first. He tries to get a sense that do you at least have an idea of the topic. For instance let’s say the topic is “Delegate”. So the first question he would spin is “What is a delegate ?”.
In “What” kind of questions the interviewer is expecting sweet and to the point one liners which communicates that yes you know the topic. For example:-
Interviewer :- What is a delegate ?
Jobseeker :- Delegate is a pointer to a function.
“How”:- Are you hands on?
Once the interviewer is confident with the “What” part he can then ask questions of type “How” and “Why”. The “how” part tells the interviewer, Are your really hands-on the topic?. Below is a simple example for the same:-
Interviewer: - How do you do forms authentication in ASP.NET?
JobSeeker :- For forms authentication we need to do the following things :-
Step 1:- Set the mode=”Forms” in web.config file.
Step 2:- In the code behind of the login page we need to call
In the “How” part the interviewer is expecting you to provide overall important steps of you will execute that task.
“Why”:- Do you really know the depth of the topic?
The “Why” part of questions are tough ones. In this the interviewer tries to probe how much do you know the topic. In this section he will probe in to real time scenarios and will try to probe do you know the topic in-depth.
Interviewer: - Why is MVVM pattern for WPF and SL?
Candidate: - Because WPF and SL have rich bindings.
A simple example of questions around delegate
What is a delegate?
Delegate is a pointer to a function.
How do you code a delegate?
We first declare the delegate by using the “Delegate” keyword and point method to that delegate and then invoke the method by calling the “Invoke” method.
Why do you need a delegate?
Delegate is needed to provide callbacks. For instance you have a UI from which a long running routine is called. If your UI wants updates from that long running routine, then the UI can provide a delegate to the routine and the routine can send message via that delegate back to UI.
Many times we would like to store hierarchal data in database. For example you can see in the image we can have manager, supervisors who work below managers, workers who work under supervisor and so on. This kind of data can be stored by using “hierarchyid” datatype in SQL Server. It’s also called “Hid” data type. By using this data type we no more need those recursive logic to get the parent and also we do not need to get involved with complex self reference parent child kind of database design.
Also have a look at the below SQL Server interview question videos
Increase SQL Server performance using SQL Server profiler: -