What are different types of directives in .NET?
@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>
@Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>
@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %>
@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>
@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>
@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %>
@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %>
@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.
How the SQL Server Session state entry is in the Web Config ??
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Why Should I Hire You? Thought it as an interviewer
In today's job market, where many seasoned workers have found themselves out of a job and plenty of young but inexperienced graduates are entering the work force, do you have the right answer to beat out the competition?
Here are three common scenarios job seekers find themselves in and how they might handle each one:
The employer thinks ... you don't have relevant experience.
So you ... explain how all experience is relevant.
Simpson's tips for workers whose experience is seemingly irrelevant are similar to her advice for seeming unqualified workers: Make your past an asset, not a drawback.
"Give specific examples of how your experience is relevant to the job," Simpson explains. "Customer service experience gained while waiting tables is often negated. Waiters deal with all kinds of people and situations while multitasking, working under pressure of short-term deadlines while keeping customers happy."
Don't expect employers to connect the dots -- they're busy and have a wealth of candidates from which to choose. Do the work for them. In this economy, plenty of laid-off workers are looking for jobs in new industries, which means you're not the only one experiencing this dilemma. Get an edge over other job seekers by turning your varied experience into proof that you're the right candidate.
To be continued……
Microsoft – C# Interview Questionsv
1. How do you inherit from a class in C#?
2. What is .NET Framework?
3. How we handle sql exceptions? What is the class that handles SqlServer exceptions?
4. What is the advantage of serialization?
5. how to fill datalist usinf XML file and how to bind it,code behind language is c#
6. What is the difference between const and static read-only?
7. Is it mandatory to implement all the methods which are there in abstract class if we inherit that abstract
8. Why do I get a "CS5001: does not have an entry point defined" error when compiling?
9. What's the implicit name of the parameter that gets passed into the class' set method?
10. What is indexer? Where it is used explain
11. Does C# support multiple inheritance?
12. When you inherit a protected class-level variable, who is it available to?
13. Are private class-level variables inherited?
14. Describe the accessibility modifier protected internal.
15. What is the implicit name of the parameter that gets passed into the class set method?
16. What's the top .NET class that everything is derived from?
17. How's method overriding different from overloading?
18. What does the keyword virtual mean in the method definition?
19. What is an abstract class?
20. What is the data provider name to connect to Access database?
C# interview questions and answers
I need to restrict a class by creating only one object throughout the application. How can I achieve this?
We can declare the constructor of the class as either protected or as private
int? d = 1; Type testType = d.GetType(); will result…
NOTE: This is objective type question, Please click question title for correct answer.
How can you make your machine shutdown from your program?
Process.Start("shutdown", "-s -f -t 0");
What is the use of unsafe keyword in C#?
In C# the value can be directly referenced to a variable, so there is no need of pointer. Use of pointer sometime crashes the application. But C# supports pointer, that means we can use pointer in C#.
The use of pointer in C# is defined as a unsafe code. So if we want to use pointer in C# the pointer must be present in the body of unsafe declaration. But pointer does not come under garbage collection.
Example:-
unsafe
{
int a, *b;
a = 25;
b = &a;
Console.WriteLine("b= {0}",b);//returns b= 25
}
What is difference between var and Dynamic ?
Var word was introduced with C#3.5(specifically for LINQ) while dynamic is introduced in C#4.0. variables declared with var keyword will get compiled and you can have all its related methods by intellisense while variables declared with dynamic keyword will never get compiled. All the exceptions related to dynamic type variables can only be caught at runtime.
What is dynamic keyword ?
Its newly introduced keyword of C#4.0. To indicate that all operations will be performed runtime.
What will happen if you declare a variable named "checked" with any data type?
Compiler will throw an error as checked is a keyword in C# So It cannot be used as variable name. Checked keyword is used to check the overflow arithmetic checking.
What are anonymous methods?
Anonymous methods are another way to declare delegates with inline code except named methods.
Restrictions of yield in try-catch.
While using yield keyword, mainly two restrictions are observed.
First is , we can’t use yield in finally.
Second is , we can’t place yield keyword in the catch block if try contains more than one catch blocks.
With yield break statement, control gets …
NOTE: This is objective type question, Please click question title for correct answer.
What first action compiler will take on detection of iterator ?
As soon as compiler will detect iterator, it will automatically generate current, MoveNext and Disposemethods of the IEnumerator or IEnumerator(T) type.
What are different types of directives in .NET?
@Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>
@Control:Defines control-specific attributes used by the ASP.NET page parser and compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>
@Import: Explicitly imports a namespace into a page or user control. The Import directive cannot have more than one namespace attribute. To import multiple namespaces, use multiple @Import directives. <% @ Import Namespace="System.web" %>
@Implements: Indicates that the current page or user control implements the specified .NET framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>
@Register: Associates aliases with namespaces and class names for concise notation in custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>
@Assembly: Links an assembly to the current page during compilation, making all the assembly's classes and interfaces available for use on the page. <%@ Assembly Name="MyAssembly" %><%@ Assembly Src="MySource.vb" %>
@OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %>
@Reference: Declaratively indicates that another user control or page source file should be dynamically compiled and linked against the page in which this directive is declared.
Worst-Case Interview Scenarios
Here are some suggestions on how to handle unforeseen interview mishaps.
You Forgot Your Résumé Materials.
You grabbed your briefcase, but left your portfolio stuffed with your beautifully printed résumés, letters of recommendation and work examples sitting on your kitchen table.
Solution: "This can be easily handled if you planned ahead properly," Guarneri suggests. "Don't rely on just a paper résumé. Have your résumé available online somewhere, such as a blog, personal Web site or in your e-mail. Then it can be instantly retrieved from the interviewer's office."
You Have a Wardrobe Malfunction.
Somewhere between your house and the interviewer's office your smartly pressed suit ends up looking stupid. This happened to one of Guarneri's clients who was splashed by a passing cab right outside the building of the company with which he was going to interview.
Solution: Guarneri recommends continuing to your interview and briefly explaining what happened. Almost everyone has had a wardrobe malfunction occur at an inopportune time -- your interviewer will likely be empathetic to your mud speckled trousers.
You're Late.
Whether you overslept or your train stalled on the tracks, either way, you know you're going to be late for your interview.
Solution: "If you can see you're going to be late, immediately call ahead and let them know," Guarneri advises. That way you won't keep your interviewer waiting and you give them the chance to call the shots -- squeeze you in for a later appointment or reschedule for another day.
The Interviewer is Distracted.
Another of Guarneri's clients entered an interview only to find the interviewer sitting with his head in his hands and didn't even look up when her client entered the room and sat down.
Solution: If they're not listening when you're talking, are they bored? Are they stressed with other projects?
"Pick up on the emotional cues the interviewer is delivering," Guarneri says. "Then recognize the situation and get their attention." In this case, her client said, "If this is a really bad time, I can come back."
You Forget the Name of the Person You're Interviewing With.
You're nervous during an interview and it's common for your mind to go blank.
Solution: If you didn't write it down on, don't see a nameplate on the desk, or can't read it off of certificates adorning the walls, don't fake it, Guarneri warns. Find an opportune time to ask the interviewer for his or her business card, by saying something like, "Before I forget, could have one of your business cards?"