Interview Tips Interview Tips, Interview Questions and Answers

19Feb/100

ASP.NET Interview Questions: ViewState

(1) Does the performance for view state vary according to User controls?

Performance of view state varies depending on the type of server control to which it is applied. Label, Text Box, Check Box, Radio Button, and Hyper Link are server controls that perform well with View State. Drop Down List, List Box, Data Grid, and Data List suffer from poor performance because of their size and the large amounts of data making roundtrips to the server.

(2) What is View State?

View state is a built-in structure for automatically retaining values amongst the multiple requests for the same page. The view state is internally maintained as a hidden field on the page but is hashed, providing greater security than developer-implemented hidden fields do.

(3) What are benefits and Limitation of using View state for state management?

Following are the benefits of using View state:-
. No server resources are required because state is in a structure in the page code.
. Simplicity.
. States are retained automatically.
. The values in view state are hashed, compressed, and encoded, thus representing a higher state of security than hidden fields.
. View state is good for caching data in Web frame configurations because the data is cached on the client.
Following are limitation of using View state:-
. Page loading and posting performance decreases when large values are stored because view state is stored in the page.
. Although view state stores data in a hashed format, it can still be tampered because it is stored in a hidden field on the page. The information in

the hidden field can also be seen if the page output source is viewed directly, creating a potential security risk.
Below is sample of storing values in view state.

this. ViewState ["Enter Time"] = Date Time. Now. To String();

18Feb/100

C# Interview Questions and Answers

1) The C# keyword ?int? maps to which .NET type?

  1. System.Int16

  2. System.Int32

  3. System.Int64

  4. System.Int128

2) Which of these string definitions will prevent escaping on backslashes in C#?

  1. string s = #?n Test string?;

  2. string s = ??n Test string?;

  3. string s = @?n Test string?;

  4. string s = ?n Test string?;

3) Which of these statements correctly declares a two-dimensional array in C#?

  1. int[,] myArray;

  2. int[][] myArray;

  3. int[2] myArray;

  4. System.Array[2] myArray;

4) If a method is marked as protected internal who can access it?

  1. Classes that are both in the same assembly and derived from the declaring class.

  2. Only methods that are in the same class as the method in question.

  3. Internal methods can be only be called using reflection.

  4. Classes within the same assembly, and classes derived from the declaring class.

5) What is boxing?

a) Encapsulating an object in a value type.

b) Encapsulating a copy of an object in a value type.

c) Encapsulating a value type in an object.

d) Encapsulating a copy of a value type in an object.

6) What compiler switch creates an xml file from the xml comments in the files in an assembly?

  1. /text

  2. /doc

  3. /xml

  4. /help

7) What is a satellite Assembly?

  1. A peripheral assembly designed to monitor permissions requests from an application.

  2. Any DLL file used by an EXE file.

  3. An assembly containing localized resources for another assembly.

  4. An assembly designed to alter the appearance or ?skin? of an application.

8) What is a delegate?

  1. A strongly typed function pointer.

  2. A light weight thread or process that can call a single method.

  3. A reference to an object in a different process.

  4. An inter-process message channel.

9) How does assembly versioning in .NET prevent DLL Hell?

  1. The runtime checks to see that only one version of an assembly is on the machine at any one time.

  2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.

  3. The compiler offers compile time checking for backward compatibility.

  4. It doesn?t.

10) Which ?Gang of Four? design pattern is shown below?

public class A {

    private A instance;

    private A() {

    }

    public
static A Instance {

        get

        {

            if ( A == null )

                A = new A();

            return instance;

        }

    }

}

  1. Factory

  2. Abstract Factory

  3. Singleton

  4. Builder

18Feb/100

asp.net interview questions: cache

(1) what is the difference between Cache object and application object?

The main difference between the Cache and Application objects is that the Cache object provides cache-specific features, such as dependencies and expiration policies.

(2) What are dependencies in cache and types of dependencies?

When you add an item to the cache, you can define dependency relationships that can force that item to be removed from the cache under specific activities of dependencies. Example if the cache object is dependent on file and when the file data changes you want the cache object to be update. Following are the supported dependency:-
. File dependency: - Allows you to invalidate a specific cache item when a disk based file or files change.
. Time-based expiration: - Allows you to invalidate a specific cache item depending on predefined time.
. Key dependency:- Allows you to invalidate a specific cache item depending when another cached item changes.

(3) How can get access to cache object?

The Cache object is defined in the 'System.Web.Caching' namespace. You can get a reference to the Cache object by using the Cache property of the Http Context class in the 'System.Web' namespace or by using the Cache property of the Page object.

17Feb/100

ASP.NET Interview Questions: Different States in ASP.NET

You can see that a browser on the client side requests a page from the web server. After processing the request and returning the page, the server drops the connection. Then. if the browser makes another request the server has no way to associate the browser with the previous request. So HTTP is called as a stateless protocol. But ASP.NET provides several ways to maintain the state.

View State

View state is used to maintain the values of server control properties. AS ASP.NET implements view state by default you need not to write any special code to use it.

Session State

Session state is used to maintain data between execution of an application. For this, ASP.NET creates a session state object that is kept on the server whenever a user starts a new session. The session state object contain unique session ID, and this ID is sent back and forth between the server and browser each time the user request a page. Then when the server receives a new request from the user, it can retrive the right session state object for that user. You can add data items to the session object in your code, so there previous values are available each time a web form is executed.

Application State

ASP.NET provides an application state object to save application state data, which applies to all the users of an application. You can use application state object to manage global counters to maintain a list of users who are currently logged on to an application.

Profile

ASP.NET also provides profile feature to keep track of user data. Although a profile is similar to session state object, it persists between user session as it is stored in a database. For example we can use profiles we can keep track of the products ordered by an user in an shopping application and when the user starts a new session, you can display those products in a "ordered items" listbox. 

17Feb/100

Top 5 Ways to Wreck Your Job Interview

1. Being rude to the receptionist or assistant
Some candidates don't think it matters if they're dismissive of the hiring manager's assistant when arranging the interview or get upset at the receptionist because he or she mispronounced their name by mistake. After all, this person isn't the one making the hiring decision. But you may be surprised to learn that six out of 10 executives polled by Robert Half said they consider their assistant's opinion important when evaluating potential new hires. So remember to be polite and respectful to everyone you interact with during the hiring process.

2. Acting like you're the only person there

Consider this scenario: After you've checked in for the interview, you make a quick phone call to give your friend a blow-by-blow description of last night's party, speaking so loudly that everyone in the office can't help but hear you. That's the wrong approach. It's better to sit patiently and peruse any company literature in the lobby. Doing so demonstrates common courtesy and can help you learn more about the firm and its needs.

3. Arriving late

Getting to an interview on time or, for that matter, a few minutes early is an easy way to impress a prospective employer. Arriving late is not only unprofessional, it also shows the hiring manager that you have little regard for his or her schedule. It also calls into question your ability to show up to work on time, one of the most basic aspects of any job. Plus, arriving late could cause you to miss the meeting altogether if the interviewer has another appointment.

4. Going into the interview unprepared

Far too many candidates fail to properly prepare for the interview, believing that they can "wing it" and still make a strong impression. The savviest job seekers spend time considering questions the hiring manager will likely ask, so they can answer confidently during the meeting. They also research the employer ahead of time so they can explain how their skills match the open position, and also highlight their true interest in the company and position.

5. Not asking questions
As the interview winds down, the hiring manager will likely ask if you have any questions. Your answer should be yes. But your questions should go beyond "How much does the position pay?" and "How many days of vacation can I expect?" Although compensation and benefits are important components of any job, broach these subjects only if the prospective employer has expressed serious interest in hiring you -- usually not until the second or third interview. More appropriate questions for a first interview include "What will my specific duties be?" "What are your top priorities for this position?" and "What does a typical day in this position look like?"

17Feb/100

ASP.NET Interview Questions: Query Strings

A query string is information sent to the server appended to the end of a page URL.
Following are the benefits of using query string for state management:-
. No server resources are required. The query string containing in the HTTP requests for a specific URL.
. All browsers support query strings.
Following are limitations of query string:-
. Query string data is directly visible to user thus leading to security problems.-
. Most browsers and client devices impose a 255-character limit on URL length.
Below is a sample "Login" query string passed in URL http://www.jack-fx.com.com/login.asp?login=testing.
This query string data can then be requested later by using Request.QueryString("login").

(I) What is Absolute and Sliding expiration?

Absolute Expiration allows you to specify the duration of the cache, starting from the time the cache is activated. The following example shows that the cache has a cache dependency specified, as well as an expiration time of one minute.

Cache. Insert ("announcement", announcement, depends, _
DateTime.Now.AddMinutes(1), Nothing)

Sliding Expiration specifies that the cache will expire if a request is not made within a specified duration. Sliding expiration policy is useful whenever you have a large number of items that need to be cached, because this policy enables you to keep only the most frequently accessed items in memory. For example, the following code specifies that the cache will have a sliding duration of one minute. If a request is made 59 seconds after the cache is accessed, the validity of the cache would be reset to another minute:

Cache.Insert("announcement", announcement, depends, _
Date Time. Max Value, _
TimeSpan.FromMinutes(1))

17Feb/100

asp.net interview questions: state management

  1. What is the lifespan for items stored in ViewState?
    Item stored in ViewState exist for the life of the current page.  This includes postbacks (to the same page).
  2. What is ViewState?
    ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.  ViewState is used the retain the state of server-side objects between postabacks.
  3. What are the different types of Session state management options available with ASP.NET?
    ASP.NET provides In-Process and Out-of-Process state management.  In-Process stores the session in memory on the web server.  This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server.  Out-of-Process Session state management stores data in an external data source.  The external data source may be either a SQL Server or a State Server service.  Out-of-Process state management requires that all objects stored in session are serializable.
  4. What does the "EnableViewState" property do?  Why would I want it on or off?
    It allows the page to save the users input on a form across postbacks.  It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser.  When the page is posted back to the server the server control is recreated with the state stored in viewstate.
15Feb/100

5 Types of Interviewers

To give you a little extra help, here is a list of 5 types of interviewers you might encounter and how to deal with them.

1. The interrogator
What to expect:
Question after question after question. The interrogator doesn't come to the interview ready for conversation. He has a list of questions to fire off and you had better be ready to answer them. Don't expect to receive a lot of helpful feedback to gauge how you're doing. Just expect more questions.
What to do: Watch episodes of "Law & Order" to prepare. You're going to feel defensive the entire time and might walk away from the interview feeling as if you did something wrong. Once you realize that your interviewer is going to lambaste you with questions, just focus on answering them and don't obsess over reading his reaction. You can try to initiate conversation with a few of your answers, but don't be surprised if those efforts fail. This interviewer wants to hear your answers and see how you handle yourself, so staying calm is the best approach you can take.

2. The one who has better things to do
What to expect:
An interviewer checking her e-mail, looking at you but not paying any attention to what you say. Some people are forced to participate in the interview process even if they have no interest in doing it, so don't take it personally.
What to do: Answer the questions and be friendly. Try to hold conversations with this distracted interviewer and hope you can win her over -- hey, it can't hurt to have someone who likes you. But this interviewer either made up her mind before she walked into the room or doesn't intend to give much feedback about you, so do your best but don't take her disinterest personally.

3. The rule follower
What to expect:
Every interviewing tip you've ever been told. Just like some students never imagine skipping a day of school or not doing homework, some interviewers can't imagine going outside of traditional business interviewing protocol. Boring questions and a stoic demeanor are this interviewer's best friend.
What to do: Be the best interviewee you can be. Do you know what your biggest weakness is? Do you know how to give the perfect handshake? Do you plan on wearing a conservative shirt under your jacket? You had better, because these by-the-book practices will earn you high marks.

4. The inappropriate one

What to expect: Cold sweats because you don't know what to do or say. Every once in awhile you will encounter an interviewer who doesn't understand limits. You might hear an inappropriate joke, a personal story that should be reserved for a therapist or a question that delves too deeply into your life. This interviewer probably isn't trying to be inappropriate; he just has no concept of boundaries.

What to do: Stay in your comfort zone. Just because this interviewer is ready to cry on your shoulder, don't feel pressured into doing the same. Answer what you want to answer and try to steer the conversation back to pertinent topics, such as the job requirements or your qualifications. The interviewer probably won't realize how off track he is and will follow your lead. Of course, if you think the questions cross a line, then you want to get out of there ASAP.

5. The no-nonsense one
What to expect:
Tough love. This interviewer doesn't believe in sparing your feelings. He's honest and will waste neither his nor your time.
What to do: Brace yourself. This interviewer will say that he's not sure you're qualified or that he fears you won't fit in with everyone. Prove him wrong with evidence that you are perfect for the job. He won't respect someone who cowers, so be just as firm with him.