how to ace your .net technical interview :: .net technical check tuneup

31
.NET Technical Check & Tuneup Senthil Kandasamy [email protected]

Upload: bala-subra

Post on 25-May-2015

4.970 views

Category:

Documents


1 download

DESCRIPTION

This session is just not a brain dump of a technical interview on Microsoft technologies. It will be refresher on various pieces of the .NET, Database, OO, Process world. It will serve as a caution for interviewers to red flag their questions which are circulated on the webdom. For all the inquisitive and MCP certified brains, this will serve as a ‘whodunnit’ challenge. It will be a useful reference for the rest of us. The talk is divided into four sections. We will cover the typical BrainBench type questions to start with. Then we will attack the common problems encountered on the field and ideal solution paths to each of them. Third part will be about architectural trade-offs and ‘it depends’ scenarios. Finally, there will be discussion on best practices, books needed for interview preparation and open Q&A among the participants.

TRANSCRIPT

Page 1: How to ace your .NET technical interview :: .Net Technical Check Tuneup

.NET Technical Check & Tuneup

Senthil [email protected]

Page 2: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Today's Topics

Standard Technical vetting

Uncommon Problems & common answers

'it' Depends: Real Life Issues

What do you read is what you are!

Page 3: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Warm Up Questions

Is “string” value or reference type? It is a reference type. string is an alias of String

Is int[] counter is a value or reference type? Arrays are intrincically derived from System.Array.

Is Nullable types are value or reference type? All nullable types are of Type System.Nullable<T> struct

Is it possibe to define a variable of type Nullable<Nullable<int>> number; int ?? number;

Page 4: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Rapid Fire Round

Why Generics? Allows to design class or method that defer the specification of one or more

types until used by client.

Avoids Boxing and Unboxing (Performance)

Avoids Runtime exceptions (type safety)

Better programming (Code reuse)

What type would return if “is” operator is used on List<int> counterList = null;

Underlying type will be returned not the Nullable type.

Page 5: How to ace your .NET technical interview :: .Net Technical Check Tuneup

The very Basics (Not Visual Basic)

Can delegates added to invocation list be changed?o NO

Does delegates are invoked once for each time they appear in the invocation list?

o Yes it does.

Can multiple catch blocks be executed? o No.

Can return statement in try block make finally block called?o Yes.

Page 6: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Dot Net Framework

• What is the difference between private and shared assembly• Accessibility by applications.• Shared assembly has to be Strong Named, have version

and culture.• Installed in GAC. 

• What does Reflection do?• Runtime type discovery• Load Assemblies• Dynamic Invocation

• What is an "IS" operator?• Equiv of Type

Page 7: How to ace your .NET technical interview :: .Net Technical Check Tuneup

I PC

Which one of the following correctly initializes the ThreadStart object myStart?

   1    ThreadStart myStart = new ThreadStart();2    ThreadStart myStart = new ThreadStart(myThread);

     3    ThreadStart myStart = new ThreadStart(DoSomething());4    ThreadStart myStart = new ThreadStart(DoSomething);

    5    ThreadStart myStart = new ThreadStart(this);

How to achive synchronization in .NET? Using lock(object) statement for the critical section.

What is Thread Pool? Collection of threads

Page 8: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Why\how to do multithreading?o To compute operations in parellel.

o  By acquiring threads from ThreadPool class. 

When you call the Thread.Start method on a thread, will it start immediately?

That thread does not start executing until the current thread yields or is preempted by the operating system.

Page 9: How to ace your .NET technical interview :: .Net Technical Check Tuneup

What happens when an Object is serialized?o Name of class, assembly and data members

What are the two format types that XMLSerializer generates in Web Service?o Litteral (RPC style) and encoded (SOAP)

o Both can be handled in by applying attributes like SoapElementAttribute and XMLElementAttribute

Can SqlConnection object be serialized?o NO.

Page 10: How to ace your .NET technical interview :: .Net Technical Check Tuneup

What are different formatter that can be used in Serialization?BinaryFormatter, XmlFormatter, SoapFormatter

What is the new tool that is introduced in .Net 2.0 for creating an XML serialization assembly?XML Schema Definition Tool (Xsd.exe)

What is an Object Graph? An object model that is neither cyclic nor a tree.

How to: Catch a non-CLS Exception?Within a catch block type the exception as RuntimeWrapperException

Page 11: How to ace your .NET technical interview :: .Net Technical Check Tuneup

  How Do I Serialize Generic Types?

Presently, .NET does not provide a mechanism for constraining a generic type parameter to be serializable.

What happens when an invoked method throws exception in Multicast Delegate? If an invoked method throws an exception, the method stops

executing, the exception is passed back to the caller of the delegate, and remaining methods in the invocation list are not invoked. Catching the exception in the caller does not alter this behavior.

Page 12: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Where forwarding event happens in ASP.NET?A GridView control can contain one or more buttons created

dynamically by templates.

How can an ASP.NET application deployed in server farm?Externalize the Session State

We know ViewState what is ControlState?Property that allows you to persist property information that is specific to

a control and cannot be turned off

Page 13: How to ace your .NET technical interview :: .Net Technical Check Tuneup

It Depends

• What happens when we add an assembly to a client?It depends, private assembly local copy gets created.

Shared assembly with public key do not.

Page 14: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Do static constructor need in a class?It depends, Performing the constraint verification in the

static constructor is a technique applicable to any constraint that you cannot enforce at compile time.

Can this custom object public class Employee{ private String _name;} stored in  ASP.NET Session?

It-depends, if in-process  yes. if out-of-Process the objects has to be serializble

Page 15: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Which parser is best for reading XML Document It depends, XMLReader, XMLTextReader, XMLValidatingReader,

XPATH, XMLDocument 

Will setting AutoPostBack property to true - do postback?

It depends, if client side script is turned on.

How to do cross-page posting in ASP.NET?This can be done by configuring individual controls

Page 16: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Cross-Page versus Server.Transfer Cross-Page posting

Posts current page information to the target page. Makes post information available in the target page. Requires user initiation. Redirects to any page, not just pages in the same Web application. Enables the target page to read public properties of the source page if the

pages are in the same Web application Server.Transfer

Transfers control to a new page that renders in place of the source page. Redirects only to target pages that are in the same Web application as the

source page. Enables you to read values and public properties from source page. Does not update browser information with information about the target page.

Pressing the refresh or back buttons in the browser can result in unexpected behavior.

Page 17: How to ace your .NET technical interview :: .Net Technical Check Tuneup

How to: Determine How ASP.NET Web Pages Were InvokedExamine the values of the following Page class properties IsPostBack PreviousPage IsCrosssPagePostBack IsCallBack

What is adaptive Rendering?

Page 18: How to ace your .NET technical interview :: .Net Technical Check Tuneup

OleDbParameter param = new OleDbParameter();param.SourceVersion = DataRowVersion.Proposed;

Under what circumstances does specifying the SourceVersion affect the behavior of a parameter attached to a command?

1 Only when bound to a data adapter as an DeleteCommand2 Only when bound to a data adapter as an InsertCommand3 Only when bound to a data reader4 Only when bound to a data adapter as an SelectCommand5 Only when bound to a data adapter as an UpdateCommand

Page 19: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Things to Avoid When Throwing Exceptions

o Should not change the flow of the process

o Should not be returned as return value or passed in as parameter instead of being thrown

o Do not create exceptions that can be thrown in debug mode but not release mode. To idventify run-time errors during the development phase, use Debug Assert instead

o Do not throw System.Exception, System.SystemException, System.NullReferenceException, System.IndexOutOfRangeException intentionally from your own source code.

Page 20: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Threading

o Static state must be thread safe. Avoid syncronization for instance variables.

o Don't use Thread.Abort to terminate other threads. 

o Use Mutex

o Don't control the execution of worker threads from your main program 

o Avoid Deadlock\ Race Condition

o Performance consideration

Page 21: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Version behavior in Serialization

o Never remove a serialized field.

o Never apply the NonSerializedAttribute attribute to a field if the attribute was not applied to the field in the previous version

o Never change the name or the type of a serialized field.

o When adding a new serialized field, apply the OptionalFieldAttribute attribute.

o When removing a NonSerializedAttribute attribute from a field (that was not serializable in a previous version), apply the OptionalFieldAttribute attribute.

o For all optional fields, set meaningful defaults using the serialization callbacks unless 0 or nullas defaults are acceptable

Page 22: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Software Design Principles

Page 23: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Open - Closed Principle

Object should be open for extension but closed for modifications

Page 24: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Single Responsibility Principle

Object should have only one reason to change

Page 25: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Dependancy Inversion Principle

Both high and low level modules should depend on abstractions, not on each other

Details should depend on abstractions not the other way

Page 26: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Liskov's Substitution Principle

Derived types must be completely substitutable for their base types

Page 27: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Interface Segregate Principle

Clients should not be forced to depend upon interfaces that they don't use

Page 28: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Books I Read

 

Page 29: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Boston User Groups

(...I Attend)Boston .NET Certification Group http://tech.groups.yahoo.com/group/bostondotnetcertification/  Boston .NET Architecture Study Group http://tech.groups.yahoo.com/group/boston_dotnetarchitecture/

New England ASP.NET Professionals User Group http://neasp.net/  New England SQL Server User Group http://www.nesql.org/default.aspx  Beantown.NET User Group http://beantowndotnet.org  Boston .NET User Group http://www.bostondotnet.org/

Page 30: How to ace your .NET technical interview :: .Net Technical Check Tuneup

10 Commandments - Summary

1. Join LinkedIn2. Participate in community activities3. Answer questions in user groups4. Attend Monthly meetings5. Get Certified - Brainbench; MCPD/MCTS; OCA/OCP6. Blog - Book Reviews; Knowledge dumps; Obscure

Bugs 7. Twit Regularly on all of the above 8. Commit to a Passion9. Play some games - Get an Avatar10. Don't do any of the above - Just Relax & do a

codeplex project!

Page 31: How to ace your .NET technical interview :: .Net Technical Check Tuneup

Questions for me?