Interview Tips Interview Tips, Interview Questions and Answers

13Apr/100

asp.net interview: How to pass values between pages?

Every interviewer will expect this from you. There are several methods to pass values from one page to another page. Described below are few methods to pass values between pages:
QueryString - The QueryString method of passing values between web pages is one of the oldest methods of passing values between pages. A variable value is properly encoded before it is placed on a querystring. This is to make sure that characters that cause problems (like symbols and spaces) are encoded correctly. See the code below to see how QueryString functionality works.

//Code in InitialPage.aspx
String sString;
sString = Server.UrlEncode("string in InitialPage.aspx");
Response.Redirect("DestinationPage.aspx?Value=" & sString);
//Code in DestinationPage.aspx reads the QueryString
String sString;
sString = Request.QueryString("Value");
Response.Write("Your name is " & sString);
The data in the DestinationPage.aspx in the URL looks like this...
http://www.dotnetuncle.com/DestinationPage.aspx?Value=dotnetUncle

Context - The context object is used to send values between pages. Its similar to the session object, the difference being that, the Context object goes out of scope when the page is sent to a browser. Example code below shows how to use Context object.

'InitialPage.aspx stores value in context before sending it
Context.Items("MyData") = "dotnetuncle";
Server.Transfer("DestinationPage.aspx");
'DestinationPage.aspx retrieves the value from InitialPage.aspx's context
String sString;
sString = Context.Items("MyDate").ToString;
Response.Write("The data is as follows: " & sString);

Session - The session object is used to persist data across a user session during the user's visit to a website. It is almost same as the Context object. When we use Response.Redirect, it causes the Context object to go away, so rather the Session object is used in such a scenario. Session object uses more of server memory than a context object. Example code below shows how to use Session object.

'InitialPage.aspx stores value in session before sending it
Session.Items("MyData") = "dotnetuncle";
Response.Redirect("DestinationPage.aspx");
'DestinationPage.aspx retrieves the value from InitialPage.aspx's session
String sString;
sString = Session.Items("MyDate").ToString;
Response.Write("The data is as follows: " & sString);

12Apr/100

asp.net interview questions on cookie

The cookie object is the essence of any interview, be it ASP NET interview or Java interview or PHP interview.
Cookie - A cookie is a piece of data that is stored on a user's browser. Thus, a cookie does not use any server memory. It is actually a small text file which is created by the broswer on the hard disk of the user. It is actually a piece of information in the form of text strings. A web server sends a cookie to a user (client browser) and then the browser stores it.
A cookie is used to store information of a user & information about a user's preferences. How does the cookie works? - When a user visits a site, say www.amazon.com, and creates a profile out there, the server sends an ID (basically an ID to track this user) and saves the ID through the user's browser in the form of a cookie on the user's system. When the user revisits this site, the website tracks the user's system for the existence of any cookie, and in case it finds a cookie, it customizes the site based on the user's settings and preferences.
Now lets talk about how to create a cookie in ASP.NET. It is pretty simple. There is a class in the System.Web namespace by the name HttpCookie. This class may be used to easily create a cookie on the user's system. Below is a code sample on how to use a cookie in ASP.NET ...

//Creating a cookie HttpCookie sampleCookie = new HttpCookie("UserColorSetting");
sampleCookie.Values.Add("Background", txtBackgroundColor.Text);
sampleCookie.Expires = #12/31/2010#; Response.Cookies.Add(sampleCookie);
//Getting a cookie value from the user's computer
String sGetCookie;
sGetCookie = Request.Cookies("UserColorSetting")("Background").ToString();

Limitations of Cookies - Cookies are meant for infrequent storage of small pieces of information. They are not meant as a normal communication or mechanism. Note that web browsers are not required to save more than 300 cookies total, nor more than 20 cookies per web server (for the entire server, not just for the page or site on the server), nor to retain more than 4 kilobytes of data per cookie (both name and value count towards this 4 kilobyte limit). The biggest limitation of these is the 20 cookies per server limit, and so it is not a good idea to use a different cookie for each variable that has to be saved. Rather save a single cookie containing a lot of information.

11Apr/100

asp.net interview: How to redirect a page to another page?

A common question asked in interviews. The Response object has a famous Redirect method that is used most widely to transfer a web page visitor from one page to another page.

Syntax of Response.Redirect ...
Response.Redirect("DestinationPage.aspx")

There is another famous method called Transfer method of the Server object.

Syntax of Server.Transfer ...
Server.Transfer("DestinationPage.aspx")

11Apr/100

asp.net interview: creating a cookie from source using c#

 

protected void Page_Load(object sender, EventArgs e)
{
    HttpCookie cookie = Request.Cookies["maid"];  
    if (cookie == null)  
    {  
        cookie = new HttpCookie("maid");  
    }

    cookie["id"] = "123";  
    cookie.Expires = DateTime.Now.AddMinutes(10);  
    Response.Cookies.Add(cookie);  
}

2Apr/100

3 Ways to Negotiate a Better Job Offer

1. Get a potential employer to "fall in love" with you before you talk about money.
The time to be asking for things is after an employer has decided to hire you. Focus on what is important to the employer and what you can do for them. In tough times, making or saving money is always important. So is your ability to make your prospective boss look good.

Employers want to hire people who bring value, and they are willing to pay what is necessary to hire them. Once the employer has decided to make you an offer, then, and only then, should you start discussing the terms of employment. Until that time, whenever the subject of money comes up, talk about the job. Be enthusiastic about wanting the job. Show that you really want to work there. Ask for the job. No one wants to hire a person who is only looking for a paycheck.

If asked what you are looking for in terms of compensation, say something like "I am sure that if I am the right person for the job and the job is right for me, something that is fair will be readily worked out." Then ask some questions about the job. You will look good to the employer and defer the conversation until a time that is more appropriate.

2. The only difference between being employed and being unemployed is your self-confidence. 
You are same person when you are unemployed as you were when you were working. You have the same skills and same experience. The value you can bring to an employer doesn't change just because you don't have a job. The only difference is your confidence. If you exhibit confidence you not only can negotiate effectively, you probably can land the job you want.

Competition for your services will also make you seem more valuable in the eyes of a prospective employer. Talking with several prospective employers at the same time will not only increase your confidence but will enhance your bargaining leverage.

3. Don't act like you are negotiating.
While you want to arrange the best possible deal, you should do so in a way that doesn't look like you are negotiating. Remember, once the employer has decided to offer you a job, they are trying to recruit you. Let them. Tell them what your concerns are. Ask for the things you want without ever suggesting that you won't accept the job if you don't get them. "Would it be possible..." or "Could you..." or 'Other companies I have been talking to have offered, is it possible...." are non-threatening ways for you to ask. Don't make "demands." Throughout the process, and especially when you are asking for something, let the employer know how excited you are about the opportunity and how much you want the job.

27Mar/100

Database Interview Question: What is Index Tuning?

One of the hardest tasks facing database administrators is the
selection of appropriate columns for non-clustered indexes. You should
consider creating non-clustered indexes on any columns that are
frequently referenced in the WHERE clauses of SQL statements. Other
good candidates are columns referenced by JOIN and GROUP BY operations.
You may wish to also consider creating non-clustered indexes that
cover all of the columns used by certain frequently issued queries.
These queries are referred to as "covered queries" and experience
excellent performance gains.
Index Tuning is the process of finding appropriate column for
non-clustered indexes.
SQL Server provides a wonderful facility known as the Index Tuning
Wizard which greatly enhances the index selection process.

23Mar/100

Lie in an Interview? Right or Wrong? Part 2

Continue my last post, http://tipsinterview.com/2010/03/22/lie-in-an-interview-right-or-wrong-part-1/

4. I don't have any experience in the field or industry?
It will be clear in the interview that the experience you have from one position may not be in line with your needs working in a new position, Guinn says. "There is nothing in that which is inappropriate or in which any fact is being misrepresented." Stress your interest and what you can provide in the position and discuss what specific training you will be offered to create competency in your role.

5. I know my boss will give me a bad reference?
"Many bosses today refuse to discuss past employees with potential ones and turn these questions over to the HR department," Guinn says. "If you know your boss will give you a bad reference, tell the interviewer that you have concerns your reputation may be tarnished by working for the past employer, and you'd appreciate knowing if there was anything improper said about you during the reference checks."

6. I made much less in my last job, but think I deserve a significant raise?
It's tempting to want to inflate your past salary to earn more in your next role, but with more employers doing credit checks, you'll probably get caught. You're better advised to share the range of salary you received and ask about opportunities for improvement of salary, Guinn says.

7. I intend only to stay for a few months and/or don't want this to be my career?
"Employers invest large sums [of money] in finding the right candidate for a position. What's to say this can't be a great, long-term job for you?" Guinn says. "Many of us started out in a role with no plans to stay, but found that the job we took was meaningful, satisfied our personal and professional needs and paid us a worthy salary. You don't know what is going to happen in six months; always leave your options open."

8. I already have a vacation, wedding or getaway planned?
If you're hired, the employer is obviously going to find out sooner or later that you need some time off. If you offer to follow the appropriate measures, most employers will find a way to work around any previously planned events

9. I am overqualified for the job and want to leave some credentials off my résumé?
You've worked hard for those credentials and you should be proud of them. Guinn suggests having multiple résumés that differ based on the level of position for which you are applying. "List the qualifications you truly hold that would be of benefit in securing the job you want to have," he says.

10. I have an injury or illness that prevents me from doing necessary work for the job?
Many applicants are hesitant to address an injury or illness for fear that the employer will see them as a potential insurance liability. But Guinn says most employers will make accommodations for great applicants with a handicap. He suggests asking if any accommodations can be made and if not, seeking out an employer that is willing to make the adjustment.

22Mar/100

Lie in an Interview? Right or Wrong? Part 1

You're not supposed to lie, so how do you explain away all these things and remain in the running for a job? Or, the better question is, can you?

"The honesty police may arrest me, but I'd have to say that everyone has probably shaded the truth in an interview," says Alan Guinn, managing director of The Guinn Consultancy Group. "It's not that as applicants we're inherently dishonest. It's that society places such a critical importance on success achievement that we look for ways to present ourselves in the best light possible."

Guinn says that honesty is generally the best policy when it comes to your interview, but in some cases, it can be hard to explain actions in which you have been peripherally involved or caught up. While you shouldn't flat-out lie about anything, you should position your answers so that you are the responsible party, rather than the one to blame, Guinn says.

Some situations are more tempting to fudge the truth in than others. Here are 10 of those situations and how you can be honest with a potential employer and stay in the running for a job:

What if ...

1. I am one credit short of graduating?
Some employers ask for proof of a diploma -- some don't. It's not worth risking that you won't be asked to show a certificate or diploma and have it blow up in your face.

"Be totally upfront and ask the employer if they have a tuition reimbursement program which would help you finish that last course you need to graduate. I've actually been asked that several times and have gone to the employer to secure assistance for an applicant if a formal policy was not in place," Guinn says. "This makes the employer look good ... they are supporting the personal and professional growth of their employees."

2. I was fired?
Being fired today doesn't hold a lot of the social stigma it once did, Guinn says. If you're asked why you left a previous position, tell the interviewer what really happened.

"Lots of people get fired for lots of reasons. You may be a totally innocent party in a financial scandal. You may be a qualified, competent employee working for a company which must shave head count. There are many reasons you could have been fired, or let go, or made redundant," he says.

3.  I have a misdemeanor or felony on my record from a long time ago?
The employer will most likely do a background check and this will come up on the search. If you're asked to elaborate, be upfront about what happened.

"My guess is that you have more than 'served your time' or 'done your punishment,'" Guinn says. "If the employer asks, be honest, and tell them that it was a long time ago, you made a mistake and you paid the piper." Share what you learned from the situation.