0% found this document useful (0 votes)
422 views50 pages

Interview Questions

This document provides information about purchasing interview question books written by Shivprasad Koirala on .NET and SQL Server topics. It includes details on how to order the books from various locations in India and other countries. The author provides contact information for career counseling and admissions to his Software Career Path Institute in Mumbai. Sample questions are included to demonstrate the quality and value of the full books.

Uploaded by

RemoMeansRemo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
422 views50 pages

Interview Questions

This document provides information about purchasing interview question books written by Shivprasad Koirala on .NET and SQL Server topics. It includes details on how to order the books from various locations in India and other countries. The author provides contact information for career counseling and admissions to his Software Career Path Institute in Mumbai. Sample questions are included to demonstrate the quality and value of the full books.

Uploaded by

RemoMeansRemo
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 50

This PDF has sample questions which is extracted from my twobooks .

NET Interview
questions and SQL Server interviewquestions.
This PDF is only a small glimpse of the two books its muchmore that what you see
in this PDF. I have ensured that boththe books are really at a very cheap cost
so that every one willbe benefited. Any of my book do not exceed 200 INR. For mo
redetails mail at [email protected]
Second the books also have CD get with this sample PDFwho stops you.....Happy Job
Hunting.
bookincase its not near to your place mail [email protected].
22070989KOLKATA-19HYDERABAD-24756967,24756400BANGALORE-25587923,25584641AHMEDABA
D-26421611BHATINA(28410796,28550491DELHI/CD s with them which you will notget PDF.
...But still if you want to enjoy freewho How to buy the book
BPB has done a great job of making this book reach to places where i can hardly
imagine. But justincase If you are from India you can contact one of the shops b
elow:-
MUMBAI-22078296/97/022-22070989
KOLKATA-22826518/19
HYDERABAD-24756967,24756400
BANGALORE-25587923,25584641
AHMEDABAD-26421611
1
BHATINA(PUNJAB)-2237387,
CHENNAI-28410796,28550491
DELHI/NEW DELHI-23254990/91,23325760,26415092,24691288
Pakistan
M/s. Vanguard Books P Ltd, 45 The Mall, Lahore, Pakistan (Tel: 0092-42-7235767,
7243783 and7243779 and Fax: 7245097)
E-mail: [email protected]
If you are not from india or pakistan :-
Ray McLennan, director,Motilal (UK) Books of India,367 High Street.
London Colney,
St.Albans, Hertfordshire,AL2 1EA, U.K.
Tel. +44 (0)1727 761 677,Fax.+44 (0)1727 761
357,[email protected],www.mlbduk.com
www.questpond.com
Visit www.questpond.com for more downloads
Want to buy from online :-
.NET Interview Questions From Prakash books
http://www.prakashbooks.com/details.php3?id=17875&c=Computer Books
.BooksAmazon.3D1.BooksAmazon.3D1.If you want to buy from Amazon
Amazon.3D1
http://www.amazon.co.uk/exec/obidos/ASIN/8183330770/qid%3D1139594062/026-8105897
-7667603
SQL Server Interview Questions From Prakash books
http://www.prakashbooks.com/details.php3?id=19008&c=Computer BooksIf Amazonhttp:
//3D12263615#detailsbpb@comBooks written by Shivprasad Koirala-- questions-- que
stions-- questions-- you www
Books
If you want to buy from Amazon
http://www.amazon.co.uk/exec/obidos/ASIN/8183331033/qid%3D1136610981/026-1344994
-2263615#product-details
If you want to purchase the book directly through BPB Publication's delhi , Indi
a :-
[email protected] or [email protected]
Books Koirala
-- .NET Interview questions
-- SQL Server Interview questions
-- Java Interview questions
-- How to prepare software quotation?.( This book is on estimationyou can get it
from www.questpond.com as free download)
-- C# Projects
-- Software testing Interview questions
-- Understanding Hackers Mind
You can order any of my books from [email protected]
.NET Interview Questions
Sample book(Including SQL Server,UML,Architecture,PrManagement , ASP.NET 2.0 , S
ample prand General Interview Questions )
bookBy:- Shivprasad koiralaMail:- [email protected]
(ProjectManagement project ,XMLand ASPHappy job hunting.........................
..............
Do not forget that database is also important. Buy my SQLServer Interview questi
ons to crack any database relatedquestions.
From the Author
First thing thanks to all those who have sent me complaints and also appreciatio
n for what ever titlesi have written till today. But interview question series i
s very near to my heart as i can understandthe pain of searching a job. Thanks t
o my publishers (BPB) , readers and reviewers to always excuseall my stupid thin
gs which i always do.
So why is this PDF free ?. Well i always wanted to distribute things for free sp
ecially when its ainterview question book which can fetch a job for a developer.
But i am also bounded with publish-ers rules and regulations. And editor, print
ing guys, designers,distributors, shopkeepers and including me. But again the ot
her aspect, readers should know of whatthey are buying , the quality and is it r
eally useful to buy this book. So here are sample free ques-tions which i am giv
ing out free to the readers to see the worth of the book.
WAnd why not they have a whole team of editor
I can be contacted at [email protected] its bit difficult to answer all ans
wers but as i get timei do it.
We have recently started a career counselling drive absolutely free for new come
rs and experiencedguys. So i have enlisted the following guys on the panel. Than
ks to all these guys to accept the paneljob of consulting. Feel free to shoot th
em questions just put a title in the mail saying Question aboutCareer . I have alwa
ys turned up to them when i had some serious career decision to take.Shivprasad
Koirala :- Not a great guy but as i have done the complete book i have to take u
p one ofthe positions. You can contact me at [email protected] for technica
l career aspect.
YYY
Tapan Das :- If you think you are aiming at becoming a project manager he is the
right person toconsult. He can answer all your questions regarding how to groom
your career as a project [email protected].
Kapil Siddharth :- If you are thinking to grow as architect in a company then he
is a guy. When itcomes to role model as architect i rate this guy at the top. Y
ou can contact him [email protected] if you think you can help
the developers mail me at [email protected] and if i findyou fitting in the
panel i will display your mail address. Please note there are no financial rewa
rds assuch but i am sure you will be proud of the work you are doing and whos kn
ows what can come up.
Lets make Software Industry a better place to work ..... Happy Job Hunting and B
est of Luck
Career Path Institute
Author runs the Software Career Path Institute personally in mumbai. If you are in
terested youcan contact him regarding admissions at [email protected]. Plea
se note i do not have cur-forget it. But yes you will defi-rently any huge setup
. So if you are looking for some cozy institute fornitely get the in-depth knowl
edge which you will not get anywhere.
from nitely So want to join my small institute then call me at 9892966515. Pleas
e note currently its onlyfrom mumbai people.
www.questpond.com
www.questpond.com
Contents
How to buy the book.............................................................
......67
ow book......................................................rom Author.........
...................................................areer Institute..............
.......................................ntroduction..............................
......................................oftware Company hierarchy.................
.......................................................................esume Gui
delines.........................................................................
...........alary Negotiation....................................................
.....................................................oints remember.............
................................................................................
............ Basic .NET Framework.............................................ha
t is a IL?......................................................................
...........................................wist :- What is MSIL or CIL , What is
JIT?................................................................y book.....
..................................Author........................................
.....th Institute......................................ion......................
...............................any hierarchy....................................
.............................ation Guidelines...................................
..........................ion...................................................
...............................ber..............................................
...................................ET Framework.................................
................................................................................
..... JIT?.........................................
From the Author.................................................................
........70
Career Path Institute...........................................................
.......71
Institute......................n.....................................y hierarchy
.........................................on Guidelines..........................
...........n..........................................................er........
.................................................T Framework....................
......................................................
Introduction....................................................................
.............85
Software hierarchy..............................................................
...............................................89
Resume Preparation Guidelines...................................................
......................................................91
Salary Negotiation..............................................................
...............................................................93
................................................................................
................................................... Framework...................
.................................................................... JIT?.......
................................................................................
.......................................................................
Points to remember..............................................................
..............................................................95
1. Framework..........................................................98
What IL?........................................................................
.............................................................98
Twist JIT?......................................................................
...............98
What is a CLR?..................................................................
...............................................................98
What is a CTS?..................................................................
................................................................98
What is a CLS(Common Language Specification)?...................................
........................................99
What is a Managed Code?.........................................................
.........................................................99
What is a Assembly?.............................................................
............................................................99
What are the different types of Assembly?.......................................
...............................................100
What is NameSpace?..............................................................
........................................................100
What is Difference between NameSpace and Assembly?..............................
.................................100
If you want to view a Assembly how do you go about it ?.........................
.....................................100
Twist : What is ILDASM ?........................................................
........................................................100
What is Manifest?...............................................................
............................................................102
Where is version information stored of an assembly ?............................
.........................................103
Is versioning applicable to private assemblies?.................................
..............................................103
What is GAC ?...................................................................
.............................................................103
Twist :- What are situations when you register .NET assembly in GAC ?...........
............................103
What is the concept of strong names ?...........................................
.................................................103
Twist :- How do we generate strong names or what is the process of generating st
rong names, Whatis use the of SN.EXE , How do we apply strong names to assembly,
How do you sign an assem-bly?..................................................
................................................................................
..........103
How to add and remove an assembly from GAC?.....................................
......................................107
What is Delay signing ?.........................................................
..........................................................108
What is garbage collection?.....................................................
.........................................................109
Can we force garbage collector to run ?.........................................
.................................................109
What is reflection?.............................................................
..............................................................109
What are different types of JIT ?...............................................
......................................................110
What are Value types and Reference types ?......................................
.............................................111
What is concept of Boxing and Unboxing ?........................................
............................................111
What is the difference between VB.NET and C# ?..................................
.......................................112
What is the difference between System exceptions and Application exceptions?....
.......................113
What is CODE Access security?...................................................
...................................................113
What is a satellite assembly?...................................................
.........................................................114
How to prevent my .NET DLL to be decompiled?....................................
.......................................114
What is the difference between Convert.toString and .toString() method exe)?....
......................................... choose?...............................
................................................CodeDom?........................
...............................................................2..NET Interopera
bility...................................... How can we use COM Components in .N
ET?..........................................Twist : What is RCW ?..............
.................................................................... CHow COM?..
............................................components ?........................
..........................
?...................................114
What is Native Image Generator (Ngen.exe)?......................................
............. We have two version of the same assembly in GAC? I want my client
to makassembly to choose?.......................................................
..............................CodeDom?..........................................
...................................................Interoperability.............
............................. NET?..............................................
..?.............................................................................
........... COM?....................................................tacomponents
?........................................................NET?..................
.............................?.........?........................................
........................................................... ?...................
........................................... ?...................................
.........?......................................................................
VB6?.........................................................?..................
...................................................?..........................
exe)?...........................................................................
......115
exe)?....................................................makeassembly choose?...
................................................................................
...hat CodeDom?.................................................................
................................Interoperability................................
...........NET?.................................................wist ?..........
................................................................................
iow COM?.....................................................wist ?.............
............................................ow NET?.............................
....................hen ?..........hat ?........................................
.............................................................?..................
.............................................exe)?..............................
.......................make assembly choose?....................................
...................................................Interoperability.............
...............................NET?.............................................
.....COM?......................................................takcomponents ?..
........................................................?...........?...........
.....................................................?..........................
....................an ?........................................................
................ choose?........................................................
......................CodeDom?..................................................
....................................NET?........................................
.?..............................................................................
... COM?.............................................?..........................
.......................NET?........................................?..?.........
................................................................................
... ?....................................................... ?..................
...................?............................................................
...VB6?..................................................?......................
........................................?...................?...................
.................................VB6?...........................................
.........?...........................................3. Threading...............
.........................................What is Multi-tasking ?................
...............................................................What is Multi-thr
eading ?........................................................................
....?...........................................................................
............?.............................................................?.....
..............................
choice of whichassembly choose?.................................................
..................................................................116
What is CodeDom?................................................................
..........................................................124
Interoperability................................. NET?..........................
.......?........................................................................
.. t
Interoperability............................................................128
NET?............................................................................
..128
?...............................................................................
.......................................128
Once I have developed the COM wrapper do I have to still register the COM in reg
istry?...........129
How can we use .NET components in COM?..........................................
........................................129
Twist :- What is CCW (COM callable wrapper) ?, What caution needs to be taken in
order that .NETcomponents is compatible with COM ?.............................
.........................................................129
How can we make Windows API calls in .NET?......................................
.......................................132
When we use windows API in .NET is it managed or unmanaged code ?...............
........................134
What is COM ?...................................................................
.............................................................134
What is Reference counting in COM ?.............................................
...............................................134
Can you describe IUKNOWN interface in short ?...................................
..........Can you explain what is DCOM ?........................................
...............................How do we create DCOM object in VB6?.............
.............................................?..................................
....................................?...........................?...............
.............................................
?..........................................................................134
ou ?........u ?.................................o VB6?..................... ?...
.............................any o ?.......................re VB6?..............
.........s ?..............reading....................................s ?........
..........................................s ?...................................
............s ?.........................................................6 ?.....
..........................e ?..... ?..................................
?...............................................................................
.....................135
VB6?............................................................................
...........136
How to implement DTC in .NET ?..................................................
.................................................136
How many types of Transactions are there in COM + .NET ?........................
................................138
How do you do object pooling in .NET ?..........................................
...............................................139
What are types of compatibility in VB6?.........................................
................................................140
What is equivalent for regsvr32 exe in .NET ?...................................
.............................................141
Threading.......................................................................
.......142
hreading..................................................?.....................
..................................................?.............................
......................................?.........................................
.....................................B6 ?.......................................
..............?.......................... ?.....................................
.................?..............................................................
.....................?..........................................................
......................?.........................................................
..................................?.............................................
....................?.......................................?...................
................................................?.........................?.....
................................................................................
...............................142
?...............................................................................
..................................142
What is a Thread ?..............................................................
..............................................................142
Did VB6 support multi-threading ?...............................................
...................................................142
Can we have multiple threads in one App domain ?................................
........................................142
Which namespace has threading ?.................................................
...................................................142
Can you explain in brief how can we implement threading ?.......................
...................................142
How can we change priority and what the levels of priority are provided by .
NET ?.....................143
What does AddressOf operator do in background ?.................................
........................................144
How can you reference current thread of the method ?............................
........................................144
What's Thread.Sleep() in threading ?............................................
..................................................144
How can we make a thread sleep for infinite period ?............................
.........................................144
What is Suspend and Resume in Threading ?.......................................
..........................................144
What the way to stop a long running thread ?....................................
..............................................145
How do I debug thread ?.........................................................
........................................................145
What is Thread.Join() in threading ?............................................
....................................................146
What are Daemon threads and how can a thread be created as Daemon?..............
.........................146
When working with shared data in threading how do you implement synchronization
?..............146
Can we use events with threading ?..............................................
...................................................147
How can we know a state of a thread?............................................
.................................................147
What is a monitor object?.......................................................
.........................................................147
What are wait handles ?.........................................................
..........................................................148
ndles ?............................................ ?...........................
....esetEvent ?riter ?..................................id threading?...........
..ence process?
Twist :- What is a mutex object ?...............................................
.......................................................148
hat ?......................................................anualResetEvent and A
utoResetEvent ?.......................eaderWriter ?.............................
............................ threading?....................................he pr
ocess?.......................oting and Webservices....................n applicat
ion domain?......................................................NET Remoting ?.
...............................................................ass ?............
............ N Remoting?........... remundamental Remoti
What is ManualResetEvent ?......................................................
.................148
What is ReaderWriter Locks ?....................................................
.....................................................148
How can you avoid deadlock in threading?........................................
............................................149
What is the difference between thread and process?..............................
.........................................149
4. Remoting Webservices..................................................150
What is an domain?..............................................................
.........................................150
t domain?.......................................................................
...........at is .?.............................................................
...............................ich ?............................................
.......at ?...................cribe Remoting?...................................
....at ?................at ?....................at ?....... ?...................
...................................................................AO thions ?..
................................................................................
................t ?..at LeaseManagerPollich ?...................................
.... ?................................ SAO?..................................t ?
....................... ?.........................................at ?..........
..........................................................at ?..................
..........at ?..................................................................
........
What ?..........................................................................
......................................150
Which class does the remote object has to inherit ?.............................
...........................................151
What are two different types of remote object creation mode in .NET ?...........
.............................151
erent creatil Basic of SAO architecture of Remations architntal objes ?.........
............................hen cren ?..........................................
.......n implemeime, RenewonC pro
Describe in detail Remoting?....................................................
.......151
What are the situations you will use singleton architecture in remoting ?.......
..............................156
What is fundamental of published or precreated objects in Remoting ?............
.............................156
?................?...?..........................................................
........................istions ?...............................................
...............................................LeaseManagerPWhich ?.............
.....................?............................SAO?..........................
...wist ?..................?.....................................?..............
..................................................?.......................?.....
.................................................................?..............
...........................................................................?....
................................................................................
..................?.............................................................
.......................................WSDL?....................................
..................................................................
What are the ways in which client can create object on server in CAO model ?....
........................156
Are CAO stateful in nature ?....................................................
.......................................................157
In CAO model when we want client objects to be created by NEW keyword is there any
precau-tions to be taken ?.....................................................
..................................................................157
Is it a good design practice to distribute the implementation to Remoting Client
?.......................158
What are LeaseTime, SponsorshipTime, RenewonCallTime and LeaseManagerPollTime?..
........158
Which config file has all the supported channels/protocol ?.....................
......................................159
How can you specify remoting parameters using Config files ?....................
.................................160
Can Non-Default constructors be used with Single Call SAO?......................
................................162
Twist :- What are the limitation of constructors for Single call SAO ?..........
.................................162
How can we call methods in remoting Asynchronously ?............................
..................................163
What is Asynchronous One-Way Calls ?............................................
.............................................163
What is marshalling and what are different kinds of marshalling ?...............
.................................163
What is ObjRef object in remoting ?.............................................
..................................................164
What is a Web Service ?.........................................................
.........................................................164
What is UDDI ?..................................................................
............................................................165
What is DISCO ?.................................................................
............................................................165
What is WSDL?...................................................................
...........................................................165
What the different phase/steps of acquiring a proxy object in Webservice ?......
............................165
Following are the different steps needed to get a proxy object of a webservice a
t the client side :-165
What is file extension of Webservices ?.........................................
.................................................166
Which attribute is used in order that the method can be used as WebService ?....
...........................167
What are the steps to create a webservice and consume it ?......................
.....................................167
Do webservice have state ?......................................................
........................................................176
5. Caching Concepts.............................................................
....178
What is an application object ?.................................................
......................................................178
What s the difference between Cache object and application object ?...............
.............................178
How can get access to cache object ?............................................
...................................................178
What are dependencies in cache and types of dependencies ?......................
...................................178
Can you show a simple code showing file dependency in cache ?...................
...............................179
What is Cache Callback in Cache ?...............................................
..................................................179
What is scavenging ?............................................................
...........................................................180
What are different types of caching using cache object of ASP.NET?..............
..............................180
How can you cache different version of same page using ASP.NET cache o How will
implement Page Fragment Caching ?............................................ A
?.................................... ?................................ wor w ?.
............................. ?......................................... ?......
..................... ?.........................................................
.............................. ?....... management ?............................
.... frames?.......................... Cookies?.................................
... Query6. OOPS................................................................
. What is Object Oriented Programming ?.........................................
............. What s a Class ?....................................................
......................................... ob ?..................................
............. AS ?....................................... ?.....................
.............. wo ?................................. ?..........................
.................. ?.............................. ?............................
.............................................................. ?.......... manag
ement?. ?................................... frames?............................
. Cookies?....................................... S6. OOPS......................
............................................ ?..................................
....................... ?.......................................................
......................................... ?.....................................
.......................................................
object ?......................180
objectHow ?....................................................sWhich ?.........
...................................?........................................proW
hat pWhere ?......................................?.............................
....................?...................................?.......................
........................................................................?.......
.........management?......?.........................................frames?.....
..............................Cookies?..........................................
..Strin. OOPS...................................................................
...?..............................................................?.............
................................................................................
.........
?..............................................................................1
81
What are ASP.NET session and compare ASP.NET session with classic ASP session va
riables?181
Which various modes of storing ASP.NET session ?................................
. Is Session_End event supported in all session modes ?.........................
.... w ?........................... ?...................................... ?...
..................... ?.........................................................
........................... ?.... manageme ?............................. frames
?....................... Cookies?.................................
?......................................................................181
?..................................................................182
?......................ModWhat MWhere ?....................?....................
............?..................?................................................
.............................managHow ?.......................frames?...........
......Cookies?............................ OOPS.................................
.........................?............................................?.........
...........................................................................?....
...........................................................................?....
.........................?.wist Systeote:- thand y
What are the precautions you will take in order that StateServer Mode work prope
rly ?..............182
What are the precautions you will take in order that SQLSERVER Mode work properl
y ?..........182
Where do you specify session state mode in ASP.NET ?............................
....................................183
What are the other ways you can maintain state ?................................
...........................................183
What are benefits and Limitation of using Hidden fields ?.......................
......................................183
What is ViewState ?.............................................................
............................................................184
Does the performance for viewstate vary according to User controls ?............
.............................184
What are benefits and Limitation of using Viewstate for state management?.......
.........................184
How can you use Hidden frames to cache client data ?............................
......................................185
?..........................................frames?..............................
.......Cookies?..............................................String. OOPS.......
................................................................?...............
.................................................?..............................
..........................................................................?.....
................................................................................
..............
What are benefits and limitations of using Hidden frames?.......................
.....................................185
What are benefits and limitations of using Cookies?.............................
.........................................186
What is Query String and What are benefits and limitations of using Query String
s?...................186
6. OOPS.........................................................................
............200
?...............................................................................
.........200
?...............................................................................
...............................................200
What s an Object ?................................................................
...........................................................200
What is the relation between Classes and Objects ?..............................
..........................................200
What are different properties provided by Object-oriented systems ?.............
...............................200
Twist :- Can you explain different properties of Object Oriented Systems?.......
.............................200
Note:- Difference between abstraction and encapsulation is one of the favorite i
nterview questionand quiet confusing as both the terminology look alike. Best is
if you can brainstorm with yourfriends or do a little reading..................
................................................................................
.....200
Twist :- What is difference between Association, Aggregation and Inheritance rel
ationships?......201
How can we acheive inheritance in VB.NET ?......................................
.........................................202
What are abstract classes ?.....................................................
.........................................................203
What is a Interface ?...........................................................
.............................................................205
What is difference between abstract classes and interfaces?.....................
......................................207
What is a delegate ?............................................................
.............................................................207
What are events ?...............................................................
..............................................................208
Do events have return type ?....................................................
.......................................................210
Can event s have access modifiers ?...............................................
................................................210
Can we have shared events ?.....................................................
......................................................210
What is shadowing ?.............................................................
...........................................................210
What is the difference between Shadowing and Overriding ?.......................
................................211
What is the difference between delegate and events?.............................
........................................211
If we inherit a class do the private variables also get inherited ?.............
.......................................212
What are the different accessibility levels defined in .NET ?...................
......................................212
Can you prevent a class from overriding ?.......................................
...............................................212
What is the use of MustInherit keyword in VB.NET ?................................
................................212
Do interface have accessibility modifier?.......................................
................................................213
What are similarities between Class and structure ?.............................
..........................................213
What is the difference between Class and structure s ?............................
.......................................213
t ?.......................................t ?...................................
..................................t variables?..................................
............t ?.................................................................
....t ?.........................re ?............................................
....t ?.........................................................................
.....................t s ?........................................................
.................................. ?...........................t ?..............
................................................................t ?.............
................................................................................
....t ?.........................................................................
.............
What does virtual keyword mean ?................................................
.................................................213
?......................................................What are shared (VB.NET)/
Static(C#) variables?...............................?...........................
..........................?..........?.................................?........
......................................................................?.........
..................................................................wist ?........
....?..............................................................?............
......................................................................?.........
.............................................................hat NET?...........
....................................constructhat NET?..........................a
t ?.................................................................at variables
?..........................................at ?.................................
................................at ?.....................ere ?..................
..........................?.....................................................
.....................................?..........................................
............................................?.......................?...........
...............................................................?................
.............................................................................?..
................................................................................
NET?..........................................................t NET?............
......................... up?........................................ method?...
......................................................method?...................
.......................................... canethod?............................
..........................................................................privat
e?....................... ?....s ?..............................................
...........variables?..................................ispose ?.................
.......................................e ?............. ?.......................
.............rrayList ?.........................................................
........................?.......................................................
.......................hat s ?...............?....................................
.............................NUM ?..............................................
.......................................ested ?..................................
.......................................perator NET?.............................
.....................constructore NET?.............................referred up?.
...............................?................................................
...............variables?........................................?..............
.................................................?................... ?.........
.................................?..............................................
..........................................?.....................?...............
.........................................................?......................
..........................................................wile up?..............
........................ variables?.............................................
.......... ?....................................................................
.......... ?.................................. ?................................
......................... ?.....................................................
.................................................. ?............................
.......................................................................?........
............................ ?..................................................
..................................... ?.........................................
................................................................. ?.............
................................................................................
..NET?....................................................................... fi
rstWhat NET?..................................................up?...............
......................................method?...................................
...................................method?......................................
....................................tmethod?....................................
...............................................................................p
rivate?....................................?.................variables?.........
.................................................................213
What is Dispose method in .NET ?................................................
.................................................215
What is the use of OverRides and Overridable keywords ?.............................
........................215
Where are all .NET Collection classes located ?.................................
...........................................215
What is ArrayList ?.............................................................
.............................................................216
at ?............................................................................
...........at s ?.................................................................
...................t ?....................at ?..................................
.....................................at ?.......................................
....................................................at ?........................
.......................................................t NET?...................
.....................................elow wilt NET?.............................
...... up?..................................... method?.........................
.............................t method?..........................................
................. caethod?......................................................
.............................................hat private?.....................
What s a HashTable ?..............................................................
........................................................216
Twist :- What s difference between HashTable and ArrayList ?......................
.................................216
What are queues and stacks ?....................................................
......................................................216
What is ENUM ?..................................................................
...........................................................216
What is nested Classes ?........................................................
..........................................................216
What is Operator Overloading in .NET?...........................................
...............................................217
In below sample code if we create a object of class2 which constructor will fire
first ?................217
What is the significance of Finalize method in .NET?............................
.........................................217
Why is it preferred to not use finalize for clean up?...........................
.............................................218
How can we suppress a finalize method?..........................................
...............................................219
What is the use of DISPOSE method?..............................................
...............................................219
e method?..........................................................e the Dispose
method to be called automatically, as clients c................................
................................................................ces private?....
................ifferent ?.oto finaer ?.........................................
.................................................tatic ?........................
......................................here catcifference cET....................
......................................equence in which ASP.NET events are proces
sed ?...............t are the controls fully loaded ?...........................
..................
How do I force can forget to call Disposemethod?................................
................................................................................
.....................220
In what instances you will declare a constructor to be private?.................
......................................220
Can we have different access modifiers on get/set methods of a property ?.......
.............................221
If we write a goto or a return statement in try and catch block will the finally
block
execute ?....221
What is Indexer ?...............................................................
...............................................................221
Can we have static indexer in C# ?..............................................
....................................................221
e ?....................................................................ogram the
re are multiple catch blocks so can it happen that two catch bl1 classSP.NET....
.......................................................... is the sequence ?.....
................ich event ?...................................................?.
............................................
In a program blocks are executed ?221
What is the difference between System.String and System.StringBuilder classes?..
......................221
7. ASP.NET......................................................................
..........222
What ?..................................................222
quence ?.........?........................................entify ?..............
....................?....?......................................................
..................
In which ?......................................................................
...........222
How can we identify that the Page is PostBack ?.................................
..........................................222
How does ASP.NET maintain state in between subsequent request ?.................
............................222
What is event bubbling ?........................................................
.........................................................222
How do we assign page specific attributes ?.....................................
..............................................223
Administrator wants to make a security check that no one has tampered with ViewS
tate, how can heensure this ?...................................................
............................................................................223
What is the use of @ Register directives ?......................................
................................................223
What s the use of SmartNavigation property ?......................................
..........................................223
What is AppSetting Section in Web.Config file ?...................................
.....................................223
Where is ViewState information stored ?.........................................
...............................................223
What is the use of @ OutputCache directive in ASP.NET?..........................
.................................224
How can we create custom controls in ASP.NET ?..................................
.......................................224
How many types of validation controls are provided by ASP.NET ?.................
.............................224
Can you explain what is AutoPostBack feature in ASP.NET ?.........................
..........................225
How can you enable automatic paging in DataGrid ?...............................
......................................225
What s the use of GLOBAL.ASAX file ?................................................
....................................225
What is the difference between Web.config and Machine.Config ?......................
..................225
What is a SESSION and APPLICATION object ?............................... What i
s the difference between Server.Transfer and response.RedirecWhat authorization?
...... ?................................................... w NET?NET?..........
...............................?...............?...........................DataG
rid?.....................DataGrid?........................................... da
tali NET?.............................................. ?.......................
......... ?............................................................ ?.......
...............................................................?................
............?.theHow validators?..................................... ?.........
..................................... Redirect ?...........authorization?.......
.............. ?................................................................
.. works?....... NET?..............NET?.........................................
..............?..............................?..................................
........DataGrid?....................................DataGrid?..................
........................................
?..........................................................................226
?.......................................226
What is the difference between Authentication and authorization?................
.................................226
What is impersonation in ASP.NET ?..............................................
.............. Can you explain in brief how the ASP.NET authentication process w
orks?. NET?........NET?..................................................?......
..................?....................................DataGrid?................
..............DataGrid?.................................................... r NE
T?....................................................... ?.....................
.................... ?..........................................................
...........
?...............................................................................
...............227
works?...................................227
What are the various ways of authentication techniques in ASP.NET?..........NET?
...................................................?..........................?.
.....................................DataGrid?................................Da
taGrid?...................................................... NET?..............
........................................... ?...................................
........ ?......................................................................
. ?.............................................................................
....?.......................................?............validators?............
....................................awhat ?.....................................
.................................................?..............................
........................................... ?...................................
.........................................Browser?............
NET?..........................................228
How does authorization work in ASP.NET?.........................................
...........................................230
What s difference between Datagrid, Datalist and repeater ?.......................
...................................231
From performance point of view how do they rate ?...............................
......DataGrid?...............................DataGrid?.........................
............................ re NET?............................................
............ ?.......................................... ?......................
................................................ ?..............................
..................................................?.............................
.........?...........serverWhich clientHow validators?..........................
.....................theYou ?...................................................
..................................?.............................................
........................... ?...................................................
........................Browser?...........?....................................
.................................?..............................................
..........
?.......................................................................232
What is the method to customize columns in DataGrid?............................
.....................................232
How can we format data inside DataGrid?.........................................
..............................................232
How to decide on the design consideration to take a Datagrid, datalist or repeat
er ?....................232
Difference between ASP and ASP.NET?.............................................
............................................232
What are major events in GLOBAL.ASAX file ?.....................................
........... ?...................................................................
......... ?.....................................................................
.................?............................................?.................
sidWhich sidHow validators?.....................................................
cliYou ?........................................................................
...................?............................................................
.................. ?............................................................
.....................Browser?.................?.................................
..........................................?.....................................
..........................?...................................................le
vels?.................................................................
?...........................................................................234
What order they are triggered ?.................................................
......................................................235
Do session use cookies ?........................................................
.........................................................236
How can we force all the validation control to run ?............................
...........................................236
How can we check if all the validation control are valid and proper ?...........
.................................236
If client side validation is enabled in your Web page, does that mean server sid
e code is not run?236
Which JavaScript file is referenced for validating the validators at the client
side ?.......................236
How to disable client side script in validators?................................
................................................237
How can I show the entire validation error message in a message box on the clien
t side?.............237
You find that one of your validation is very complicated and does not fit in any
of the validators,what will you do ?...........................................
...........................................................................237
What is Tracing in ASP.NET ?....................................................
.....................................................238
How do we enable tracing ?......................................................
......................................................238
What exactly happens when ASPX page is requested from Browser?..................
..........................238
How can we kill a user session ?................................................
......................................................242
How do you upload a file in ASP.NET ?...........................................
...............................................243
How do I send email message from ASP.NET ?......................................
........................................243
What are different IIS isolation levels?........................................
....................................................243
ASP used STA threading model, what is the threading model used for ASP.NET ?....
....................245
What is the use of <%@ page aspcompat=true %> attribute ?.......................
...............................245
Explain the differences between Server-side and Client-side code?...............
.................................246
Can you explain Forms authentication in detail ?................................
............................................246
How do I sign out in forms authentication ?.....................................
...............................................248
If cookies are not enabled at browser end does form Authentication work?........
...........................248
How to use a checkbox in a datagrid?............................................
..................................................248
What are the steps to create a windows service in VB.NET ?......................
...................................249
What is the difference between Web farms and Web garden ?............................
.....................250
How do we configure WebGarden ?....................................................
.........................................253
What is the main difference between Gridlayout and FlowLayout ?.................
..............................256
8..NET Architecture.............................................................
.....257
What are design patterns ?......................................................
.........................................................257
What is the difference between Factory and Abstract Factory Patterns?...........
..............................258
What is MVC pattern?............................................................
..........................................................261
Twist: - How can you implement MVC pattern in ASP.NET?..........................
.................................261
NET?...............................an NET?......................................
.......o NET?............................................core projects?..u patte
rns?.........................an NET?............................................
s architecture?.................................................................
............ou which?..s architecture?..........................................
......................re tiers?..................................s architecture?
...................................................................an NETmplemen
t NET?...........plement NET?..........o shalituations Rea pattimplement NET?...
.......architecture?...........................................r Blockse archite
cture?..............................rent tiers?
How can we implement singleton pattern in .NET?.................................
........................................263
How do you implement prototype pattern in .NET?.................................
.......................................264
Twist: - How to implement cloning in .NET ? What is shallow copy and deep copy ?
....................264
What are the situations you will use a Web Service and Remoting in projects?....
..........................264
Can you give a practical implementation of FAÇADE patterns?.......................
..............................264
How can we implement observer pattern in .NET?..................................
......................................266
What is three tier architecture?................................................
.........................................................266
Have you ever worked with Microsoft Application Blocks, if yes then which?......
........................267
What is Service Oriented architecture?..........................................
..................................................267
What are different ways you can pass data between tiers?........................
......................................270
What is Windows DNA architecture?...............................................
................................................270
What is aspect oriented programming?............................................
.......................9. ADO.NET...............................................
.................What is the namespace in which .NET has the data functionality
classes ?........... Can you give a overview of ADO.NET architecture ?..........
..................................?............................................?
..............................................?.........................?.......
..............................................................co
programming?....................................................................
........................272
NET.............................................................................
.281
?...................................281
?....................................................................281
What are the two fundamental objects in ADO.NET ?...............................
.....................................283
What is difference between dataset and datareader ?.............................
..........................................283
What are major difference between classic ADO and ADO.NET ?.....................
............................283
What is the use of connection object ?..........................................
...................................................283
e ?........................................................e use of command obje
cts and what are the methods provided be ?......................................
............................
What is the by the command object ?284
What is the use of dataadapter ?................................................
.......................................................284
What are basic methods of Dataadapter ?.........................................
...............................................284
What is Dataset object?.........................................................
...........................................................285
What are the various objects in Dataset ?.......................................
..................................................285
How can we connect to Microsoft Access , Foxpro , Oracle etc ?..................
................................285
?.......................?................parameocedures?........................
..............................................................................t
thancan row2
How do we connect to SQL SERVER, which namespace do we use ?....................
.......................286
How do we use stored procedure in ADO.NET and how do we provide parameters to th
e storedprocedures?.............................................................
...................................................................291
paradures?......................................................................
........................... close t r
How can we force the connection object to close after my datareader is closed ?.
........................292
I want to force the datareader to return only schema of the datastore rather tha
n data ?................292
How can we fine tune the command object when we are expecting a single row or a
single value ?292
Which is the best place to store connectionstring in .NET projects ?............
.................................292
What are the steps involved to fill a dataset ?.................................
...............................................293
Twist :- How can we use dataadapter to fill a dataset ?.........................
.........................................293
What are the various methods provided by the dataset object to generate XML?....
.......................294
How can we save all data from dataset ?.........................................
................................................294
How can we check that some changes have been made to dataset since it was loaded
?...............295
Twist :- How can we cancel all changes done in dataset ? How do we get values wh
ich are changedin a dataset ?...................................................
...........................................................................295
How can we add/remove row s in DataTable object of DataSet ?..........................
.................295
What is basic use of DataView ?...................................................
...............................................296
What is the difference between DataSet and DataReader ?.............................
........................297
Twist :- Why is DataSet slower than DataReader ?................................
.........................................297
How can we load multiple tables in a DataSet ?..................................
...........................................297
How can we add relation s between table in a DataSet ?............................
....................................298
What is the use of CommandBuilder ?.............................................
...............................................298
What s difference between Optimistic and Pessimistic locking ?..................... ?.
...........................NET?.................................................
.............?................................Recor.............................
................................................................................
.....................pooling?.........................................String?...
............................pooling?............................................
............10. SQL SERVER......................................................
.. What is normalization? What are different types of normalization?............
............What is denormalization ?...........................................
..............................................?.................................
.......................................................... ?.........indeHow ?..
.............................................................?..................
......................................................................?.........
...........................................................................?....
............................................................................?...
..............................................................................?.
.............................................?..................................
.............DTS?...............................................................
...............................................
?............................................298
How many ways are there to implement locking in ADO.NET ?..................NET?.
...................................................?............................
................................................................................
...................................pooling?...............................String
?.....................pooling?..............................................SERV
ER.................................................. normalization?.............
.?..............................................................................
.?..............................................................................
... ?nonclustereHow ?.....................................................?.....
.........................................................................?......
....................................................................?...........
...........................................................?....................
...................................................?............................
.........
?...................................................299
How can we perform transactions in .NET?........................................
............................................299
What is difference between Dataset. clone and Dataset. copy ?...................
...................................300
Can you explain the difference between an ADO.NET Dataset and an ADO Reco.......
................................................................................
.........................................pooling?...............................
.......String?.............................pooling?.............................
........................SERVER..................................................
.... normalization?......................?......................................
.................................................
Recordset?...............300
ifference ..............................................pol Connesable pooling?.
...VER.....................n? oion ?.....................................ey ?...
....................................t hat betweene ?............AP ?............
......................... ?................................ ?...................
.........
................................................................................
.........................................................................300
Explain in detail the fundamental of connection pooling?........................
.......................................301
What is Maximum Pool Size in ADO.NET Connection String?.........................
.............................302
How to enable and disable connection pooling?...................................
...........................................302
SERVER................................................... normalization?........
........?.......................................................................
..........?.....................................................................
.............. ?.nonclusteredHow ?..............................................
.........?......................................................................
..........?.....................................................................
.......?........................................................................
?.........................................................................?.....
..................................?.......................................DTS?..
................................................................................
....................?...........................................................
...................................
SERVER.....................................................................303
normalization?...............................................303
?...............................................................................
.................................305
What is a candidate key ?.......................................................
..........................................................306
What are the different types of joins? What is the difference between them ?....
...........................306
What are indexes? What is the difference between clustered and nonclustered inde
xes?...............307
How can you increase SQL performance ?..........................................
............................................307
What is the use of OLAP ?.......................................................
........................................................308
What is a measure in OLAP ?.....................................................
......................................................308
What are dimensions in OLAP ?...................................................
...................................................308
What are levels in dimensions ?.................................................
......................................................309
What are fact tables and dimension tables in OLAP ?.............................
........................................309
Twist :- Can you explain the star schema for OLAP ?.............................
........................................309
What is DTS?....................................................................
...............................................................309
What is fillfactor ?............................................................
................................................................309
Twist :- When does page split occurs ?..........................................
..................................................309
- ?..................................s RAID and how does it work ?..............
.....................s TRUre impleme
What is ?.......................................................................
......................310
What is the difference between DELETE TABLE and TRUNCATE TABLE commands?........
.....311
What are the problems that can occur if you do not implement locking properly in
SQL SERVER ?311
What are different transaction levels in SQL SERVER?............................
......................................312
Twist :- What are different types of locks in SQL SERVER ?......................
.....................................312
What are the different locks in SQL SERVER ?....................................
..........................................313
Can we suggest locking hints to SQL SERVER ?....................................
........................................315
What is LOCK escalation?........................................................
.......................................................315
What are the different ways of moving data/databases between servers and databas
es in SQL Server?315
What are advantages of SQL 2000 over SQl 7.0 ?..................................
.........................................316
What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?..............
............317
What is the difference between UNION and UNION ALL SQL syntax ?.................
.....................317
How can you raise custom errors from stored procedure ?.........................
.....................................317
What is ACID fundamental? What are transactions in SQL SERVER ?.................
........................319
What is DBCC?...................................................................
...........................................................320
What is the purpose of Replication ?............................................
...................................................322
What are the different types of replication supported by SQL SERVER ?...........
..........................323
What is BCP utility in SQL SERVER ?.............................................
..............................................323
What are the different types of triggers in SQl SERVER 2000 ?...................
..................................325
If we have multiple AFTER Triggers on table how can we define the sequence of th
e triggers ?..326
f hat is SQl injection ?........................................................
...........................................hat U1. UML..........................
.................................................What is UML?...................
................................................................................
............?.........................................................wist ?....
..........................................UML?..................................
..........................................wist: ?...............................
.....................................hat project?...............................
.......................wist: project?...........................................
......ust project?...................................ive diagrams?..............
..............?..............................................?..................
...................................................................diagram?.....
.............................................................diagrams?..........
...................................?............................................
................
What ?..........................................................................
...........................................326
Ql ?............................................................................
....e FL...............................................................ML?......
................................................................................
.......y ?.......................................xplain ?.......................
..... UML?.........................................................hat ?........
..........................................e project?............................
........ow project?...............................ll project?................all
diagrams?..........ifferent ?...........................
What is the difference between Stored Procedure (SP) and User Defined Function (
UDF)?..........327
11. UML.........................................................................
............342
UML?............................................................................
................................ ?..............................................
........?........................................... UML?.......................
.................................................?..............................
...................................project?.....................................
..............project?.............................................project?.....
..........................diagrams?......................... ?..................
........................ ?......................................................
........................... diagram?............................................
.................. diagrams?......................................... ?.........
...............................................?................................
.............?...........................................................thi3641
2. Project Management.............................................. What is proj
ect management?.................................................................
.................... Is spending in IT projects constant through out the project
?...................................... ?.......................................
........................................................ ?......................
....................................................?...........................
.............. ?................................................................
.?...................................
UML?............................................................................
....................................................342
How many types of diagrams are there in UML ?...................................
........................................342
any ?....................................- ?.........................UML?.......
...............................................?................................
...............s project?.................................project?..............
..............project?............. diagrams?.......
Twist :- Explain in short all types of diagrams in UML ?........................
........................................342
What are advantages of using UML?...............................................
...............................................344
Twist: - What is Modeling and why UML ?.........................................
.............................................344
What is the sequence of UML diagrams in project?................................
........................................344
Twist: - How did you implement UML in your project?.............................
......................................344
Just a small Twist: - Do I need all UML diagrams in a project?..................
...................................345
Give a small brief explanation of all Elements in activity diagrams?............
..................................349
Explain Different elements of a collaboration diagram ?.........................
.......................................351
Explain Component diagrams ?....................................................
...................................................352
Explain all parts of a deployment diagram?......................................
..............................................354
Describe the various components in sequence diagrams?...........................
....................................356
What are the element in State Chart diagrams ?..................................
............................................358
Describe different elements in Static Chart diagrams ?..........................
.........................................360
Explain the different elements of a Use Case ?..................................
..............................................362
Twist: - What is the difference between Activity and sequence diagrams?(I leave
this to the readers)364
12. Management..........................................................365
management?.....................................................................
.....................................365
.........................................stant proj.............................
.............ycle ?............................... ?.....................ware cy
.........................................
project?...........................................................365
Who is a stakeholder ?..........................................................
...........................................................366
Can you explain project life cycle ?............................................
....................................................366
Twist :- How many phases are there in software project ?........................
.......................................366
Are risk constant through out the project ?.....................................
.................................................368
Can you explain different software development life cycles ?....................
.....................................369
Spiral Model....................................................................
................................................................371
What is triple constraint triangle in project management ?......................
.......................................372
What is a project baselines ?...................................................
.........................................................373
What is effort variance?........................................................
............................................................373
How is normally a project management plan document organized ?..................
.............................373
How do you estimate a project?..................................................
.....................................................373
What is CAR (Causal Analysis and Resolution)?...................................
.........................................374
What is DAR (Decision Analysis and Resolution) ?................................
.......................................374
What is a fish bone diagram ?...................................................
......................................................374
Twist:- What is Ishikawa diagram ?..............................................
...................................................374
What is pareto principle ?......................................................
..........................................................375
Twist :- What is 80/20 principle ?..............................................
......................................................376
How do you handle change request?...............................................
.................................................376
What is internal change request?................................................
......................................................376
What is difference between SITP and UTP in testing ?............................
........................................376
What is the software you have used for project management?......................
..................................376
What are the metrics followed in project management?............................
......................................377
Twist: - What metrics will you look at in order to see the project is moving suc
cessfully?.............377
You have people in your team who do not meet there deadlines or do not peraction
s you will take ?...............................................................
................sWhat testing?..................................... RegressioWha
t testing?......................................................................
......project?..................................................................
...........allocations?.........................................................
.... ?...................................................................CMMI?..
................................................................................
.............. CMMI?............................................................
..... representation?...............................................areas?......
...........................................................sigma?...............
...........................................................................?....
..................................................................implementation
?...............................points?.........................................
.......................................FPA?.....................................
..............FPA?............................points?...........................
........... points?...................................
perform what are theactions ?...................................................
.............................................................380
Twist :- Two of your resources have conflicts between them how would you sort it
out ?...............380
What is black box testing and White box testing?...............................
testing?.....................................................................380
What s the difference between Unit testing, Assembly testing and Regression testin
g?................381
What is V model in testing?.....................................................
..............................project?..........................................
..........................................allocations?..........................
.......................................... ?....................................
......................................CMMI?.....................................
................................................................. CMMI?.........
.............................................................. representation?..
...................................................areas?.......................
.................................................sigma?.........................
.......................................................................?........
....................................................................implementati
on?.....................................points?.................................
......................................................FPA?......................
....................................FPA?..................................points
?............................................ points?...........................
...............calculated?.............................points?..................
............................................ company?...........................
......................
testing?........................................................................
.....................................383
How do you start a project?.....................................................
.........................................................386
How did you do resource allocations?............................................
..................................................386
How will you do code reviews ?..................................................
..................................................386
What is CMMI?...................................................................
............................................................386
What are the five levels in CMMI?...............................................
................... representation?.............................................
...areas?...................................................................
CMMI?...........................................................................
......................386
What is continuous and staged representation?...................................
............................................390
Can you explain the process areas?..............................................
....................................................394
What is SIX sigma?..............................................................
...........................................................412
What is DMAIC and DMADV ?.......................................................
...............................................413
What are the various roles in Six Sigma implementation?.........................
......................................414
What are function points?.......................................................
........................
points?.........................................................................
........................................415
Twist: - Define Elementary process in FPA?......................................
..............................................415
What are the different types of elementary process in FPA?......................
......................................415
What are the different elements in Functions points?............................
..........................................415
Can you explain in GSC and VAF in function points?..............................
......................................421
What are unadjusted function points and how is it calculated?...................
....................................423
Can you explain steps in function points?.......................................
.................................................424
What is the FP per day in your current company?.................................
..........................................424
Twist :- What is your company s productivity factor ?.............................
........................................424
Do you know Use Case points?....................................................
....................................................424
o points?.......................................................................
...........hat is COCOMO I, COCOMOII and COCOMOIII?.............................
................estimation?.....................................................
.................ow requests?.............................3. XML................
........................................................
What COCOMOIII?.................................................................
...424
What is SMC approach of estimation?.............................................
...............................................424
How do you estimate maintenance project and change requests?....................
................................425
13. XML.........................................................................
............426
What is XML?....................................................................
.............................................................426
What is the version information in XML?.........................................
..............................................426
What is ROOT element in XML?....................................................
.................................................426
If XML does not have closing tag will it work?..................................
.............................................426
Is XML case sensitive?..........................................................
...........................................................427
What is the difference between XML and HTML?....................................
......................................427
Is XML meant to replace HTML?...................................................
.................................................427
Can you explain why your project needed XML?....................................
........................................427
What is DTD (Document Type definition)?.........................................
............................................427
What is well formed XML?........................................................
......................................................427
What is a valid XML?............................................................
..........................................................428
What is CDATA section in XML?...................................................
.................................................428
What is CSS?....................................................................
...............................................................428
What is XSL?....................................................................
...............................................................428
SL?.............................................................................
................lement XML?................................................... X
ML?.................................document?.........................cenarios p
arser?............. times?...........................................
What is element and attributes in XML?..........................................
................................................428
Which are the namespaces in .NET used for XML?..................................
.....................document?...............................................par
ser?................................... times?..................................
...............................classes?...... detaifunctionalities?.............
................................................................................
.............XSLT?..............................................................
..................................................XPATH?........................
................................................................................
.......XPOINTER?................................................................
...............Class?...........................................................
............................XMLTextReader?......................................
.........................................................XmlReader ?..............
........................................... ?...................................
............................ do?................................................
....................14. Localization/Globalization..............................
..........What is Unicode and why was it introduced?............................
.....................................Does .NET support UNICODE and how do you kn
ow it supports?...............................globalization?....................
..................soft NET?..... globalization?...............files?............
........................ extensions?............................project?........
.......................................................project?.................
......................................................assemblies?...............
..........................................................................assemb
lies?......................................................................EXE?.
...........................................................................
XML?........................................................................428
What are the standard ways of parsing XML document?.............................
...................................428
In What scenarios will you use a DOM parser and SAX parser?.....................
...............................433
parser?.....ndled during COM times?...................................ifference
y...............................................................................
................................................................................
.........................................................................t XPOIN
TER?.................................................eader Class?...............
..........................................eader?................................
................................. XmlReader ?...........................alk ?.....
............................lidatingReader do?..................................
....tion/Globalization....................nd introduced?........................
...........
How was XML handled times?......................................................
............................433
What is the main difference between MSML and .NET Framework XML classes?........
...............433
What are the core functionalities in XML .NET framework? Can you explain in deta
il thosefunctionalities?........................................................
..................................................................433
What is XSLT?...................................................................
.............................................................434
Define XPATH?...................................................................
............................................................435
What is the concept of XPOINTER?................................................
................................................435
e XPOINTER?......................................................n Class?.......
........................................................MLTextReader?...........
............................................................e XmlReader ?.........
........................?......................................do?..............
..............................calization/Globalization.......................nic
ode introduced?.........................................T supports?.......e glob
alization?..............itecture inte ande globalizaresource files?............u
rce extensions?....source project?.......................................
What is an XMLReader Class?.....................................................
...................................................436
What is XMLTextReader?..........................................................
......................................................436
How do we access attributes using XmlReader ?......................................
....................................437
Explain simple Walk through of XmlReader ?......................................
..........................................437
imple ?....................................s XmlValidatingReader class do?......
...................................Globalization......................introduced
?......................................supports?....globalization?...........i
What does do?...................................................................
..................440
Globalization.................................................441
introduced?.....................................................................
.............441
supports?................................................442
What s the difference between localization and globalization?.....................
..................................442
What architecture decisions you should consider while planning for international
software s?.....443
hat soow NET?.hich globalization?...........hat files?..........................
......an extensions?........................w project?..........................
.................................w project?.....................................
..............................hat assemblies?...................................
..................................................w assemblies?.................
.................................................hat EXE?.......................
.................................................hat s class?.....................
............................................hat assemblies?.............
How do we get the current culture of the environment in windows and ASP.NET?....
..................445
Which are the important namespaces during localization and globalization?.......
.........................448
What are resource files and how do we generate resource files?..................
...................................449
Can resource file be in any other format other than resx extensions?............
.................................450
How is resource files actually used in project?.................................
...............................................450
How can we use Culture Auto in project?.........................................
...............................................450
What are satellite assemblies?..................................................
........................................................453
How do we generate Satellite assemblies?........................................
...............................................453
What is AL.EXE and RESGEN.EXE?..................................................
...........................................453
What s the use of resource manager class?.........................................
.............................................455
What precautions do we need to take while deploying satellite assemblies?.......
...........................455
Can we get a strongly typed resource class rather than using resource manager?..
.........................456
Can you explain the fundamentals of GetGlobalResourceObject and GetLocalResourceObj
ect functions?....................................................................
..............................................................459
Can we sign a satellite assembly?...............................................
.....................................................459
Can you explain collation sequence in sql server?...............................
............................................459
How do we define collation sequence for database and tables?....................
...................................460
Can we change the order in a select query with a specified collation sequence?..
..........................461
What are the best practices to be followed while implementing globalization and
localization?....461
Why is the culture set to the current thread?...................................
.................................................463
15. Sample Projects.............................................................
......464
Approach to complete the projects...............................................
....................................................464
Address book....................................................................
...............................................................466
Mini-job site...................................................................
.................................................................467
Chat application................................................................
...............................................................473
n...........................................................................lica
tion..................................................................ementation
application..............ment application......................................
..............................................................ctions............
.......................................................
Reminder Application............................................................
..........................................................474
Complete implementation of address book application.............................
......................................476
Use Case Document for address book application..................................
........Estimation..............................................................
..........................................Sections..............................
..........................................................Document..............
..............................................................Overview..........
................................................................................
...............approach.........................................................
.............................Diagram............................................
..........................................................Layer.................
................................................................................
Layer...........................................................................
.......................Layer....................................................
........................................plans...................................
.......................................................................code.....
................................................................................
.................16. Test Yourself..............................................
.......exams.......................................................Topics.......
..........................................
application.....................................................................
......477
Estimation......................................................................
..................................................................478
Assumption Sections.............................................................
......................Document..................................................
.....................Overview...................................................
.................................................approach.......................
..........................................................Diagram...............
................................................................................
..Layer.........................................................................
...................Layer........................................................
.....................................Layer......................................
.................................................plans..........................
...........................................................................code.
................................................................................
................Yourself.................................................exams..
..................................................Topics........................
.....................
Sections........................................................................
...............................................481
Technical Design Document.......................................................
......................................................481
Overview........................................................................
.................................................................481
ew.........................................................................ectur
e approach.....................................................agram............
.........................................................se Layer...............
.................................................ss Layer.......................
..........................................tation Layer..........................
.................................ans............................................
............................. code..............................................
.......................est Yourself...............................ree exams.....
.............................
Architecture approach...........................................................
...........................................................481
ER Diagram......................................................................
...............................................................482
Database Layer..................................................................
..............................................................482
Business Layer..................................................................
...............................................................490
Presentation Layer..............................................................
.............................................................494
Test plans......................................................................
...................................................................499
Source code.....................................................................
................................................................501
Yourself........................................................................
505
17. Free exams..................................................................
.........516
18. Pending Topics..............................................................
......517
85
Introduction
Dedication
This book is dedicated to my kids Sanjana and Simran, whose dad s play time has be
en
stolen and given to this book. I am thankful to my wife for constantly encouragi
ng me and
also to BPB Publication to give new comer a platform to perform. Finally on top
of all
thanks to the two old eyes my mom and dad for always blessing me. I am blessed t
o have
Raju as my brother who always keeps my momentum moving on.
I am grateful to Bhavnesh Asar who initially conceptualized the idea I believe c
oncept
thinking is more important than execution. Tons of thanks to my reviewers whose
feedback
provided an essential tool to improve my writing capabilities.
Just wanted to point out Miss Kadambari . S. Kadam took all the pain to review f
or the
left outs with out which this book would have never seen the quality light.
About the author
Author works in a big multinational company and has over 8 years of experience i
n
software industry. He is working presently as project lead and in past has led p
rojects in
banking, travel and financial sectors.
But on top of all, I am a simple developer like you all guys there doing an 8 ho
ur job.
Writing is something I do extra and I love doing it. No one is perfect and same
holds true
for me .So anything you want to comment, suggest, and point typo / grammar mista
kes or
technical mistakes regarding the book you can mail me at [email protected].
Believe
me guys your harsh words would be received with love and treated to the top most
priority.
Without all you guys I am not an author.
Writing an interview question book is really a great deal of responsibility. I h
ave tried to
cover maximum questions for the topic because I always think probably leaving on
e silly
question will cost someone s job there. But huge natural variations in an intervie
w are
something difficult to cover in this small book. So if you have come across such
questions
during interview which is not addressed in this book do mail at shiv_koirala@yah
oo.com
.Who knows probably that question can save some other guys job.
Features of the book
v Around 400 plus interview questions from live .NET interviews.
Cheers to the true fighting spirit of IT professionals
86
v Section wise .NET interview question coverage according to multinational
companies.
v Short and to the point answers ( no hitting around the bush).
v Every question is classified in to Basic,Intermediate and advanced category,
thus providing more focus to readers on specific category.
v During interviews other than main technology (.NET, JAVA etc.) companies
expect other areas to be strong for example UML, Architecture, Database
etc. Other sections is the most strong point of the book, which makes
reader prepared for the unexpected questions.
v Full range of interview questions right from junior .NET developers to senior
architects or project manager.
v CD has sample resume, sample dummy project and sample code to understand
fundamentals..
v Book covers important points like salary negotiations, resume making and
general points to be remembered during interview.
v Recommended for .NET interviewers who are looking for what questions to
be asked to get better and decent .NET professionals
v Recommended for Fresher and students who want to have a feel of what
.NET questions are asked in multinational companies.
v Developers who are looking for Quick reference and FAQ.
I am sure after reading this book readers will have extra confidence and a bette
r approach
for .NET interviews.
Introduction
When we look back at times of COBOL, PASCAL features provided by these languages
where minimal. More emphasis was on completing projects than on quality of code.
As
features provided by languages where less, programmer had to code everything fro
m
scratch. For example to write a simple sorting logic you have to write your own
sorting
algorithm. As languages grew and started becoming mature, these logic where in-b
uilt
87
feature of language. As feature list of languages started growing programmer s bec
ame
feature specialist rather than specialist of whole language.
If a developer who is working for past two to three years on remoting is a remot
ing
specialist, but probably in ADO.NET he has minimal knowledge. Now after working
day
& night and becoming specialist he is looking for a job. But the bad part of IT
industry
today is that they do not look for specialist rather they look for developers wh
o have fair
knowledge of over all feature of the language. This remoting specialist stumbles
with
simple ADO.NET and SQL questions during interview. But guys that s ok when you are
working and concentrating on one particular aspect it s but obvious that you will
forget
these fundamentals.
Software clients no more look source code as the only one deliverable, but even
other
documents like SRS (System Requirement documents), SDD (System Design Documents)
,
Test Plans (SITP and UTP) etc. as a integral part of project. IT multinationals
are now
looking from both technical and process aspect of the project. So going with pur
e .NET
technical fundamentals will only take you to a programmer position, but know how
of
documenting project, UML understanding, SDLC cycle etc will take you to a better
position
(Project Manager, Program Manager, Senior architect etc).
This book covers the other aspect of .NET interview s by providing chapter like
Architecture, UML, SQL SERVER, Project Management, General Interview questions
etc.
I hope this book takes you to a better height and gives you extra confidence boo
st during
int erview s.Best of Luck and Happy Job-Hunting.............
How to read this book
If you can read English, you can read this book....kidding. There are some legen
ds which
will make your reading more effective. Every question has simple tags which mark
the
rating of the questions.
These rating are given by Author and can vary according to companies and individ
uals.
(B) Basic Questions
Basic Grade means according to the interviewer it s a fundamental question and sho
uld
be answered. Example What is a CLR ? Guy s stumbling on this question will rarely
pass
interviews.
88
(I) Intermediate Questions
These are Mid-level questions and will be expected to be answered if you are loo
king for
a decent position in the company.
(A) Advanced Questions
These are advanced level question which are expected when they are looking for s
pecialist
in the field.
(P) Psyche Questions
These level of questions do not judge anything for a candidate but see it as a a
ttitude
problem of the interviewer.
* Marked Questions
These are general questions asked in IT world. Example What s your expectation ? You
will see these question s as you keep reading. There are no direct answers to thes
e question
but they do affect a lot during job search. Be ready with some decent answers.
Note
While reading you can come across section marked as Note , which highlight special
points of that section.
89
Software Company hierarchy
Figure :- 0.1 IT Company hierarchy
Its very important during interview to be clear about what position you are targ
eting.
Depending on what positions you are targeting the interviewer shoots you questio
ns.
Example if you are looking for a project manager position you will be asked arou
nd 20%
technical questions and 80% management.
90
Note:- In small scale software house and mid scale software companies there are
chances
where they expect a PM to be very much technical. But in big software houses the
situations
are very much different, interview are conducted according to positions.... Unle
ss the
interviewer changes the rule.
Above is a figure of a general hierarchy across most IT companies.
Note:- There are many small and medium software companies which do not follow th
is
hierarchy and they have there own adhoc way of defining positions in the company
.
So why is the need of hierarchy in a interview.
Interview is a contract between the employer and candidate to achieve specific go
als.
So employer is looking for a suitable candidate and candidate looks for a better
career.
Normally in interviews the employer is very clear about what type of candidate h
e is
looking for.But 90% times the candidate is not clear about the positions he is l
ooking for.
How many times it has happened with you that you have given a whole interview an
d
when you mentioned the position you are looking for...pat comes the answer, we d
o not
have any requirements for this position . So be clarified about the position right
from
when you start the interview.
Following are the number of years of experience according to position.
v Junior engineers are specially fresher and work under software engineers.
v Software engineers have around 1 to 2 years of experience. Interviewer expects
software engineers to be technically at a medium level.
v Senior Software Engineers have around 2 to 4 years of experience. Interviewer
expects them to technically be very strong.
v Project leads should handle majority technical aspect of project and should
have around 4 to 8 years of experience. They are also indirect architect of the
project. Interviewer expects them to be technically strong and in terms of
architecture to be decent. Interviewer also expects them to have people
management skills.
v Project Manager are expected to be around 40% technically strong and should
have experience above 10 years plus. But they are more interviewed from
aspect of project management, client interaction, people management, proposal
preparation etc.
91
So now judge where you stand, and where you want to go..........
Resume Preparation Guidelines
First impression the last impression
Note :- A sample resume is provided in SampleResume folder.
Before even the interviewer meets you he will first meet your resume. Interviewe
r looking
at your resume is almost a 20% interview happening with out you knowing it. I wa
s
always a bad guy when it comes to resume preparation. But when I looked at my fr
iends
resume they where gorgeous. Now that I am writing series of book on interviews I
thought
this will be a good point to put in. You can happily skip it if you are confiden
t about your
resume. There is no hard and fast rule that you have to follow the same pattern
but just
see if these all check list are attended.
v Use plain text when you are sending resumes through email. For instance you se
nt
your resume using Microsoft word and what if the interviewer is using Linux he w
ill
never be able to read your resume. You can not be sure both wise, you sent your
resume in Word 2000 and the guy has Word 97 uuhhh.
v Attach a covering letter it really impresses and makes you look traditionally
formal.
Yes, even if you are sending your CV through email send a covering letter.
Check list of content you should have in your resume :-
v Start with an objective or summary, for instance, Working as a Senior Database
administrator for more than 4 years. Implemented quality web based application.
Follow the industry s best practices and adhered and implemented processes,
which enhanced the quality of technical delivery. Pledge to deliver the best tec
hnical
solutions to the industry.
v Specify your Core strengths at the start of the resume by which the interviewe
r can
make a quick decision are you eligible for the position. For example :-
Looked after data mining and data warehousing department independently. Played
a major role in query optimization.
Worked extensively in database design and ER diagram implementation.
Well versed with CMMI process and followed it extensively in projects.
Looking forward to work on project manager or senior manager position.
92
This is also a good position to specify your objective or position which makes i
t clear to
the interviewer that should he call you for an interview. For instance, if you a
re looking
for senior position specify it explicitly looking for this job profile . Any kind o
f certification
like MCP, MCSD etc you can make it visible in this section.
v Once you have specified briefly your goals and what you have done its time to
specify what type of technology you have worked with. For instance RDBMS,
TOOLS, Languages, Web servers, process (Six sigma, CMMI).
v After that you can make a run through of your experience company wise that is
what company you have worked with, year / month joining and year / month left.
This will give an overview to the interviewer what type of companies you have
associated your self.
Now its time to mention all your projects you have worked till now. Best is to s
tart in
descending order that is from your current project and go backwards. For every p
roject try
to put these things :-
v Project Name / Client name (It s sometimes unethical to mention clients name; I
leave it to the readers).
v Number of team members.
v Time span of the project.
v Tools, language, RDBMS and technology used to complete the project.
v Brief summary of the project.
Senior people who have huge experience will tend to increase there CV with putti
ng in
summary for all project. Best for them is to just put description of the first t
hree projects
in descending manner and rest they can say verbally during interview. I have see
n CV
above 15 pages I doubt who can read it.
v Finally comes your education and personal details.
v Trying for onsite, do not forget to mention your passport number.
v Some guys tend to make there CV large and huge. I think an optimal size should
be
not more than 4 to 5 pages.
v Do not mention your salary in CV. You can talk about it during interview with
HR
or the interviewer.
93
v When you are writing your summary for project make it effective by using verbs
like
managed a team of 5 members, architected the project from start to finish etc. I
t
brings huge weight.
v This is essential very essential take 4 to 5 Xerox copies of your resume you w
ill need
it now and then.
v Just in case take at least 2 passport photos with you. You can escape it but m
any
times you will need it.
v Carry all your current office documents specially your salary slips and joinin
g letter.
Salary Negotiation
Ok that s what we all do it for money not everyone is right. This is probably the w
eakest
area for techno savvy guys. They are not good negotiators. I have seen so many g
uys at the
first instance they will smile and say NEGOTIABLE SIR . So here are some points:-
v Do a study of what is the salary trend? For instance have some kind of baselin
e. For
example what is the salary trend on number of year of experience? Discuss this
with your friends out.
v Do not mention your expected salary on the resume?
v Let the employer first make the salary offer. Try to delay the salary discussi
on till the
end.
v If they say what you expect ?, come with a figure with a little higher end and
say negotiable. Remember never say negotiable on something which you have aimed,
HR guys will always bring it down. So negotiate on AIMED SALARY + some thing
extra.
v The normal trend is that they look at your current salary and add a little it
so that
they can pull you in. Do your home work my salary is this much and I expect this
much so whatever it is now I will not come below this.
v Do not be harsh during salary negotiations.
v It s good to aim high. For instance I want 1 billion dollars / month but at the
same
time be realistic.
v Some companies have those hidden cost attached in salary clarify that rather t
o be
surprised at the first salary package.
94
v Many of the companies add extra performance compensation in your basic which
can be surprising at times. So have a detail break down. Best is to discuss on h
and
salary rather than NET.
v Talk with the employer in what frequency does the hike happen.
v Take everything in writing, go back to your house and have a look once with a
cool
head is the offer worth it of what your current employer is giving.
v Do not forget once you have job in hand you can come back to your current empl
oyer
for negotiation so keep that thing in mind.
v Remember the worst part is cribbing after joining the company that your collea
gue is
getting more. So be careful while interview negotiations or be sportive to be a
good negotiator in the next interview.
v One very important thing is that the best negotiation ground is not the new co
mpany
where you are going but the old company which you are leaving. So once you have
offer on hand get back to your old employee and show them the offer and then mak
e
your next move. It s my experience that negotiating with the old employer is easy
than with the new one .Frankly if approached properly rarely any one will say no.
Just do not be aggressive or egoistic that you have an offer on hand.
Top of all some time some things are worth above money :- JOB SATISFACTION. So
whatever you negotiate if you think you can get JOB SATISFACTION aspect on highe
r
grounds go for it. I think its worth more than money.
Figure :- 0.2 Salary Card for India
95
Figure :- 0.3 US Salary Card
Note: - The above US Salary card is based on my experience and some talk which I
had
with my friends who are staying on longer term basis outside. In case you are fi
nding
discrepancies please do mail me at [email protected] probably we can standa
rdize it
better for the community.
The score card shown above is completely derived from author s experience and inte
raction
he had in his circle. It is not an approved score card by any authorized body as
such and
should be taken only has bench mark to measure your success. Also note that thes
e rates
are applicable for medium and large software companies. Small company rate cards
are
very irregular and governed by a single owner of the company. So the above rate
card is
not applicable for small company. Many people do get mind blowing salaries even
with
small experience which again the score card does not reflect.
Points to remember
v One of the first questions asked during interview is Can you say something abou
t
yourself ?
v Can you describe about your self and what you have achieved till now?
v Why do you want to leave the current company?
v Where do you see yourself after three years?
96
v What are your positive and negative points?
v How much do you rate yourself in .NET and SQL Server in one out of ten?
v Are you looking for onsite opportunities? (Be careful do not show your despera
tion
of abroad journeys)
v Why have you changed so many jobs? (Prepare a decent answer do not blame
companies and individuals for your frequent change).
v Never talk for more than 1 minute straight during interview.
v Have you worked with previous version of SQL Server?
v Would you be interested in a full time Database administrator job?
v Do not mention client names in resume. If asked say that it s confidential which
brings ahead qualities like honesty
v When you make your resume keep your recent projects at the top.
v Find out what the employer is looking for by asking him questions at the start
of
interview and best is before going to interview. Example if a company has projec
ts
on server products employer will be looking for BizTalk, CS CMS experts.
v Can you give brief about your family background?
v As you are fresher do you think you can really do this job?
v Have you heard about our company ? Say five points about our company? Just rea
d
at least once what company you are going for?
v Can you describe your best project you have worked with?
v Do you work on Saturday and Sunday?
v Which is the biggest team size you have worked with?
v Can you describe your current project you have worked with?
v How much time will you need to join our organization? What s notice period for
your current company?
v What certifications have you cleared?
v Do you have pass port size photos, last year mark sheet, previous companies
employment letter, last months salary slip, pass port and other necessary docume
nts.
97
v What is the most important thing that motivates you?
v Why you want to leave the previous organization?
v Which type of job gives you greatest satisfaction?
v What is the type of environment you are looking for?
v Do you have experience in project management?
v Do you like to work as a team or as individual?
v Describe your best project manager you have worked with?
v Why should I hire you?
v Have you been ever fired or forced to resign?
v Can you explain some important points that you have learnt from your past proj
ect
experiences?
v Have you gone through some unsuccessful projects, if yes can you explain why d
id
the project fail?
v Will you be comfortable with location shift? If you have personal problems say
no
right at the first stage.... or else within two months you have to read my book
again.
v Do you work late nights? Best answer if there is project deadline yes. Do not
show that it s your culture to work during nights.
v Any special achievements in your life till now...tell your best project which
you
have done best in your career.
v Any plans of opening your own software company...Beware do not start pouring
your bill gate s dream to him.....can create a wrong impression.
98
(B)What is a IL?
Twist :- What is MSIL or CIL , What is JIT?
(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language
) or CIL
(Common Intermediate Language). All .NET source code is compiled to IL. This IL
is then
converted to machine code at the point where the software is installed, or at ru
n-time by a Just-In-
Time (JIT) compiler.
(B)What is a CLR?
Full form of CLR is Common Language Runtime and it forms the heart of the .NET f
ramework.
All Languages have runtime and its the responsibility of the runtime to take car
e of the code
execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL,
Java has Java Virtual Machine etc. Similarly .NET has CLR. Following are the res
ponsibilities of
CLR
v Garbage Collection :- CLR automatically manages memory thus eliminating
memory leaks. When objects are not referred GC automatically releases those
memories thus providing efficient memory management.
v Code Access Security :- CAS grants rights to program depending on the security
configuration of the machine. Example the program has rights to edit or create
a new file but the security configuration of machine does not allow the program
to delete a file. CAS will take care that the code runs under the environment of
machines security configuration.
v Code Verification :- This ensures proper code execution and type safety while
the code runs. It prevents the source code to perform illegal operation such as
accessing invalid memory locations etc.
v IL( Intermediate language )-to-native translators and optimizer s :- CLR uses
JIT and compiles the IL code to machine code and then executes. CLR also
determines depending on platform what is optimized way of running the IL
code.
(B)What is a CTS?
In order that two language communicate smoothly CLR has CTS (Common Type System)
.Example
in VB you have Integer and in C++ you have long these datatypes are not compatible s
o the
interfacing between them is very complicated. In order to able that two differen
t languages can
1. Basic .NET Framework
99
communicate Microsoft introduced Common Type System. So Integer datatype in VB6 an
d
int datatype in C++ will convert it to System.int32 which is datatype of CTS. CLS
which is
covered in the coming question is subset of CTS.
Note: If you have undergone COM programming period interfacing VB6 application w
ith
VC++ application was a real pain as the datatype of both languages did not have
a
common ground where they can come and interface, by having CTS interfacing is sm
ooth.
(B)What is a CLS(Common Language Specification)?
This is a subset of the CTS which all .NET languages are expected to support. It
was always a
dream of Microsoft to unite all different languages in to one umbrella and CLS i
s one step
towards that. Microsoft has defined CLS which are nothing but guidelines that la
nguage to follow
so that it can communicate with other .NET languages in a seamless manner.
(B)What is a Managed Code?
Managed code runs inside the environment of CLR i.e. .NET runtime. In short all
IL are managed
code. But if you are using some third party software example VB6 or VC++ compone
nt they are
unmanaged code as .NET runtime (CLR) does not have control over the source code
execution
of the language.
(B)What is a Assembly?
v Assembly is unit of deployment like EXE or a DLL.
v An assembly consists of one or more files (dlls, exe s, html files etc.), and
represents a group of resources, type definitions, and implementations of those
types. An assembly may also contain references to other assemblies. These
resources, types and references are described in a block of data called a manife
st.
The manifest is part of the assembly, thus making the assembly self-describing.
v An assembly is completely self-describing.An assembly contains metadata
information, which is used by the CLR for everything from type checking and
security to actually invoking the components methods. As all information is in t
he
assembly itself, it is independent of registry. This is the basic advantage as
compared to COM where the version was stored in registry.
v Multiple versions can be deployed side by side in different folders. These
different versions can execute at the same time without interfering with each
other. Assemblies can be private or shared. For private assembly deployment, the
assembly is copied to the same directory as the client program that references
it. No registration is needed, and no fancy installation program is required.
100
When the component is removed, no registry cleanup is needed, and no uninstall
program is required. Just delete it from the hard drive.
v In shared assembly deployment, an assembly is installed in the Global Assembly
Cache (or GAC). The GAC contains shared assemblies that are
globally accessible to all .NET applications on the machine.
(A) What are the different types of Assembly?
There are two types of assembly Private and Public assembly. A private assembly
is normally used
by a single application, and is stored in the application's directory, or a sub-
directory beneath. A
shared assembly is normally stored in the global assembly cache, which is a repo
sitory of assemblies
maintained by the .NET runtime. Shared assemblies are usually libraries of code
which many
applications will find useful, e.g. Crystal report classes which will be used by
all application for
Reports.
(B) What is NameSpace?
Namespace has two basic functionality :-
v NameSpace Logically group types, example System.Web.UI logically groups
our UI related features.
v In Object Oriented world many times its possible that programmers will use the
same class name.By qualifying NameSpace with classname this collision is able to
be removed.
(B) What is Difference between NameSpace and Assembly?
Following are the differences between namespace and assembly :
v Assembly is physical grouping of logical units. Namespace logically groups
classes.
v Namespace can span multiple assembly.
(A)If you want to view a Assembly how do you go about it ?
Twist : What is ILDASM ?
When it comes to understanding of internals nothing can beat ILDASM. ILDASM basi
cally converts
the whole exe or dll in to IL code. To run ILDASM you have to go to "C:\Program
Files\Microsoft
101
Visual Studio .NET 2003\SDK\v1.1\Bin". Note that i had v1.1 you have to probably
change it
depending on the type of framework version you have.
If you run IDASM.EXE from the path you will be popped with the IDASM exe program
as
shown in figure ILDASM. Click on file and browse to the respective directory for
the DLL
whose assembly you want to view. After you select the DLL you will be popped wit
h a tree view
details of the DLL as shown in figure ILDASM. On double clicking on manifest you
will be able
to view details of assembly, internal IL code etc as shown in Figure Manifest Vi
ew.
Note : The version number are in the manifest itself which is defined with the D
LL or
EXE thus making deployment much easier as compared to COM where the information
was stored in registry. Note the version information in Figure Manifest view.
You can expand the tree for detail information regarding the DLL like methods et
c.
Figure:- 1.1 ILDASM
102
Figure :- 1.2 Manifest View
(A) What is Manifest?
Assembly metadata is stored in Manifest. Manifest contains all the metadata need
ed to do the
following things (See Figure Manifest View for more details):
v Version of assembly
v Security identity
v Scope of the assembly
v Resolve references to resources and classes.
v The assembly manifest can be stored in either a PE file (an .exe or .dll) with
Microsoft intermediate language (MSIL) code or in a stand-alone PE file that
contains only assembly manifest information.
103
(B)Where is version information stored of an assembly ?
Version information is stored in assembly in manifest.
(I)Is versioning applicable to private assemblies?
Versioning concept is only applicable to global assembly cache (GAC) as private
assembly lie in
their individual folders.
(B) What is GAC ?
Twist :- What are situations when you register .NET assembly in GAC ?
GAC (Global Assembly Cache) is used where shared .NET assembly reside. GAC is us
ed in the
following situations :-
v If the application has to be shared among several application.
v If the assembly has some special security requirements like only administrator
s
can remove the assembly. If the assembly is private then a simple delete of
assembly the assembly file will remove the assembly.
Note :- Registering .NET assembly in GAC can lead to the old problem of DLL hell
,
where COM version was stored in central registry. So GAC should be used when abs
olutely
necessary.
(I) What is the concept of strong names ?
Twist :- How do we generate strong names or what is the process of generating st
rong
names, What is use the of SN.EXE , How do we apply strong names to assembly, How
do you sign an assembly?
Strong name is similar to GUID(It is supposed to be unique in space and time) in
COM
components.Strong Name is only needed when we need to deploy assembly in GAC. St
rong
Names helps GAC to differentiate between two versions. Strong names use public k
ey cryptography
(PKC) to ensure that no one can spoof it.PKC use public key and private key conc
ept.
Following are the step to generate a strong name and sign a assembly :-
104
v Go to Visual Studio Command Prompt . See below figure Visual studio
Command Prompt . Note the samples are compiled in 2005 but 2003 users do
not have to worry about it. Same type of command prompt will be seen in
2003 also.
Figure :- 1.3 Visual Studio Command Prompt
v After you are in command prompt type sn.exe -k c:\test.snk .
Figure :- 1.4 Running SN.EXE
Figure :- 1.5 Successful output of SN.EXE
105
Figure :- 1.6 Sample view of test.snk file
v After generation of the file you can view the SNK file in a simple notepad.
v After the SNK file is generated its time to sign the project with this SNK fil
e.
106
Figure:- 1.7 Click on project and then click on classlibrary1 properties menu to s
ign the assembly
v Click on project -- properties and the browse the SNK file to the respective
folder and compile the project.
107
Figure :- 1.8 Click on Use a key file to sign the assembly with strong name
(I)How to add and remove an assembly from GAC?
There are two ways to install .NET assembly in GAC:-
v Using Microsoft Installer Package. You can get download of installer from
http://www.microsoft.com.
v Using Gacutil. Goto Visual Studio Command Prompt and type gacutil i
(assembly_name) , where (assembly_name) is the DLL name of the project.
108
(B) What is Delay signing ?
During development process you will need strong name keys to be exposed to devel
oper which
is not a good practice from security aspect point of view.In such situations you
can assign the key
later on and during development you an use delay signing
Following is process to delay sign an assembly:
v First obtain your string name keys using SN.EXE.
v Annotate the source code for the assembly with two custom attributes from
System.Reflection: AssemblyKeyFileAttribute, which passes the name of the file
containing the public key as a parameter to its constructor. AssemblyDelaySignAt
tribute,
which indicates that delay signing, is being used by passing true as a parameter
to its
constructor. For example as shown below:
[Visual Basic]
<Assembly:AssemblyKeyFileAttribute("myKey.snk")>
<Assembly:AssemblyDelaySignAttribute(true)>
[C#]
[assembly:AssemblyKeyFileAttribute("myKey.snk")]
[assembly:AssemblyDelaySignAttribute(true)]
The compiler inserts the public key into the assembly manifest and reserves spac
e in the PE file for
the full strong name signature. The real public key must be stored while the ass
embly is built so
that other assemblies that reference this assembly can obtain the key to store i
n their own assembly
reference.
v Because the assembly does not have a valid strong name signature, the verifica
tion of
that signature must be turned off. You can do this by using the Vr option with th
e
Strong Name tool.The following example turns off verification for an assembly ca
lled
myAssembly.dll.
Sn Vr myAssembly.dll
109
v Just before shipping, you submit the assembly to your organization's signing a
uthority
for the actual strong name signing using the R option with the Strong Name tool.
The following example signs an assembly called myAssembly.dll with a strong name
using the sgKey.snk key pair.
Sn -R myAssembly.dll sgKey.snk
(B)What is garbage collection?
Garbage collection is a CLR feature which automatically manages memory. Programm
ers forget
to release the objects while coding ..... Laziness (Remember in VB6 where one of
the good
practices is to set object to nothing). CLR automatically releases objects when
they are no longer in
use and refernced. CLR runs on non-deterministic to see the unused objects and c
leans them. One
side effect of this non-deterministic feature is that we cannot assume an object
is destroyed when
it goes out of the scope of a function. Therefore, we should not put code into a
class destructor
to release resources.
(I) Can we force garbage collector to run ?
System.GC.Collect() forces garbage collector to run. This is not recommended but
can be used if
situations arises.
(B)What is reflection?
All .NET assemblies have metadata information stored about the types defined in
modules. This
metadata information can be accessed by mechanism called as Reflection .System. Ref
lection
can be used to browse through the metadata information.
Using reflection you can also dynamically invoke methods using System.Type.Invok
emember.
Below is sample source code if needed you can also get this code from CD provide
d, go to
Source code folder in Reflection Sample folder.
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim Pobjtype As Type
Dim PobjObject As Object
Dim PobjButtons As New Windows.Forms.Button()
Pobjtype = PobjButtons.GetType()
For Each PobjObject In Pobjtype.GetMembers
LstDisplay.Items.Add(PobjObject.ToString())
Next
End Sub
End Class
110
Note :- Sample source code are compiled using VB.NET 2005.
Figure:- 1.9 Sample reflection display
Sample source code uses reflection to browse through Button class of Windows.Forms .
If
you compile and run the program following is output as shown in Sample Reflection
Display .
Using reflection you can also dynamically invoke a method using System.Type.Invok
eMember .
Note :- System.Type.InvokeMember is left as homework for readers. Believe me you
will
enjoy doing it yourself and the concept of reflection will be clearer.
(P)What are different types of JIT ?
Note :- This question can only be asked when the interviewer does not know what
he wants.
It was asked to me in one of interview and for 15 minutes he was roaming around
the
same question in order to get answer from me (requirement was for a simple datab
ase
project). Beware of such companies and interviewers you can land up no where.
JIT compiler is a part of the runtime execution environment.
In Microsoft .NET there are three types of JIT compilers:
111
v Pre-JIT :- Pre-JIT compiles complete source code into native code in a single
compilation cycle. This is done at the time of deployment of the application.
v Econo-JIT :- Econo-JIT compiles only those methods that are called at runtime.
However, these compiled methods are removed when they are not required.
v Normal-JIT :- Normal-JIT compiles only those methods that are called at runtim
e.
These methods are compiled the first time they are called, and then they are sto
red in
cache. When the same methods are called again, the compiled code from cache is
used for execution.
(B) What are Value types and Reference types ?
Value types directly contain their data which are either allocated on the stack
or allocated in-line in
a structure.
Reference types store a reference to the value's memory address, and are allocat
ed on the heap.
Reference types can be self-describing types, pointer types, or interface types.
Variables that are value types each have their own copy of the data, and therefo
re operations on
one variable do not affect other variables. Variables that are reference types c
an refer to the same
object; therefore, operations on one variable can affect the same object referre
d to by another
variable. All types derive from the System.Object base type.
(B) What is concept of Boxing and Unboxing ?
Boxing permits any value type to be implicitly converted to type object or to an
y interface type
implemented by value type. Boxing is a process in which object instances are cre
ated and copy
values in to that instance.
Unboxing is vice versa of boxing operation where the value is copied from the in
stance in to
appropriate storage location.
Below is sample code of boxing and unboxing where integer data type is converted
in to object
and then vice versa.
Dim x As Integer
Dim y As Object
x = 10
boxing process
y = x
112
unboxing process
x = y
(B) What is the difference between VB.NET and C# ?
Well this is the most debatable issue in .NET community and people treat there l
anguages like
religion. Its a subjective matter which language is best. Some like VB.NET s natur
al style and some
like professional and terse C# syntaxes. Both use the same framework and speed i
s also very much
equivalents. But still let s list down some major differences between them :-
Advantages VB.NET :-
v Has support for optional parameters which makes COM interoperability much easy
.
v With Option Strict off late binding is supported.Legacy VB functionalities can
be
used by using Microsoft.VisualBasic namespace.
v Has the WITH construct which is not in C#.
v The VB.NET part of Visual Studio .NET compiles your code in the background.
While this is considered an advantage for small projects, people creating very l
arge
projects have found that the IDE slows down considerably as the project gets lar
ger.
Advantages of C#
v XML documentation is generated from source code but this is now been incorpora
ted
in Whidbey.
v Operator overloading which is not in current VB.NET but is been introduced in
Whidbey.
v Use of this statement makes unmanaged resource disposal simple.
v Access to Unsafe code. This allows pointer arithmetic etc, and can improve
performance in some situations. However, it is not to be used lightly, as a lot
of the
normal safety of C# is lost (as the name implies).This is the major difference t
hat you
can access unmanaged code in C# and not in VB.NET.
* How much ever this book tries it can not match the huge variations of question
s that have
been asked in.NET interviews.But note there will be variations and they will map
to some
question of this book.
113
(I)What is the difference between System exceptions and Application
exceptions?
All exception derives from Exception Base class. Exceptions can be generated pro
grammatically
or can be generated by system. Application Exception serves as the base class fo
r all applicationspecific
exception classes. It derives from Exception but does not provide any extended f
unctionality.
You should derive your custom application exceptions from Application Exception.
Application exception is used when we want to define user defined exception, whi
le system
exception is all which is defined by .NET.
Figure :- 1.10 Exception Hierarchy
Note:- Frankly I have always relied on using Microsoft exception application blo
cks. As
such I have never used application exception; I think most of the work is done u
sing System
exception classes.
(I)What is CODE Access security?
114
CAS is part of .NET security model that determines whether or not a piece of cod
e is allowed to
run and what resources it can use while running. Example CAS will allow an appli
cation to read
but not to write and delete a file or a resource from a folder..
(I)What is a satellite assembly?
Refer Localization chapter for more details
(A)How to prevent my .NET DLL to be decompiled?
By design .NET embeds rich Meta data inside the executable code using MSIL. Any
one can easily
decompile your DLL back using tools like ILDASM (owned by Microsoft) or Reflecto
r for
.NET which is a third party. Secondly there are many third party tools which mak
e this decompiling
process a click away. So any one can easily look in to your assemblies and rever
se engineer them
back in to actual source code and understand some real good logic which can make
it easy to
crack your application.
The process by which you can stop this reverse engineering is using obfuscation . I
t s a technique
which will foil the decompilers. There are many third parties (XenoCode, Demeano
r for .NET)
which provide .NET obfuscation solution. Microsoft includes one that is Dotfusca
tor Community
Edition with Visual Studio.NET.
Note: - I leave this as homework to reader s compile, a DLL obfuscate it using
Dotfuscator Community Edition which comes with Visual Studio.NET and try viewing
the same using ILDASM.
(I) What is the difference between Convert.toString and .toString()
method ?
Just to give an understanding of what the above question means seethe below code
.
int i =0;
MessageBox.Show(i.ToString());
MessageBox.Show(Convert.ToString(i));
We can convert the integer i using i.ToString() or Convert.ToString so what s the dif
ence.
The basic difference between them is Convert function handles NULLS while i.ToStrin
g()
does not it will throw a NULL reference exception error. So as good coding pract
ice using
convert is always safe.
115
(A) What is Native Image Generator (Ngen.exe)?
The Native Image Generator utility (Ngen.exe) allows you to run the JIT compiler
on your assembly's
MSIL and generate native machine code which is cached to disk. After the image i
s created .NET
runtime will use the image to run the code rather than from the hard disk. Runni
ng Ngen.exe on
an assembly potentially allows the assembly to load and execute faster, because
it restores code
and data structures from the native image cache rather than generating them dyna
mically.
Below are some points to be remembered for Native Image Generator:-
v Native images load faster than MSIL because JIT compilation and type-safety ve
rification
is eliminated.
v If you are sharing code between process Ngen.exe improves the performance
significantly. As Native image generated Windows PE file so a single DLL file ca
n be
shared across applications. By contrast JIT produced code are private to an asse
mbly
and can not be shared.
v Native images enable code sharing between processes.
v Native images require more storage space and more time to generate.
v Startup time performance improves lot. We can get considerable gains when appl
ications
share component assemblies because after the first application has been started
the
shared components are already loaded for subsequent applications. If assemblies
in
an application must be loaded from the hard disk, does not benefit as much from
native images because the hard disk access time shadows everything.
v Assemblies in GAC do not benefit from Native image generator as the loader per
forms
extra validation on the strong named assemblies thus shadowing the benefits of N
ative
Image Generator.
v If any of the assemblies change then Native image should also be updated.
v You should have administrative privilege for running Ngen.exe.
v While this can fasten your application startup times as the code is statically
compiled
but it can be somewhat slower than the code generated dynamically by the JIT com
piler.
So you need to compare how the whole application performance with Ngen.exe and
with out it.
To run Ngen.exe, use the following command line.
ngen.exe install <assemblyname>
116
This will synchronously precompile the specified assembly and all of its depende
ncies. The generated
native images are stored in the native image cache.
In .NET Framework 2.0 there is a service (.NET Runtime Optimization Service) whi
ch can
precompile managed assemblies in the background. You can schedule your assemblie
s to be
precompiled asynchronously by queueing them up with the NGEN Service. Use the fo
llowing
command line.
ngen.exe install <assemblyname> /queue:<priority>
Assemblies which are critical to your application's start up time should either
be precompiled
synchronously or asynchronously with priority 1. Priority 1 and 2 assemblies are
precompiled
aggressively while Priority 3 assemblies are only precompiled during machine idl
e-time.
Synchronously precompiling your critical assemblies guarantees that the native i
mages will be
available prior to the first time your end user launches the application but inc
reases the time taken
to run your application's set up program.
You can uninstall an assembly and its dependencies (if no other assemblies are d
ependent on
them) from the native image cache by running the following command.
ngen.exe uninstall <assemblyname>
Native images created using Ngen.exe cannot be deployed; instead they need to be
created on the
end user's machine. These commands therefore need to be issued as part of the ap
plication's
setup program. Visual Studio .NET can be used to implement this behavior by defi
ning custom
actions in a Microsoft Installer (MSI) package.
Note: - One of the things the interviewer will expect to be answered is what sce
nario will
use a Native Image generator. Best is to say that we first need to test the appl
ication
performance with Native Image and with out it and then make a decision.
(A) We have two version of the same assembly in GAC? I want my client
to make choice of which assembly to choose?
Note: - I really want to explain this in depth for two reasons. First I have see
n this
question been frequently asked and second it s of real practical importance. I hav
e faced this
in every of my .NET projects...So let s try to get this fundamental not in our bra
in but in
our heart.
OK first let s try to understand what the interviewer is talking about. Let s say yo
u have made an
application and its using a DLL which is present in GAC. Now for some reason you
make second
version of the same DLL and put it in GAC. Now which DLL does the application re
fer? Ok by
default it always refers the latest one. But you want that it should actually us
e the older version.
117
So first we answer in short. You need to specify bindingRedirect in your config fi
le. For instance
in the below case ClassLibraryVersion has two versions 1.1.1830.10493 and 1.0.1830.10
461
from which 1.1.1830.10493 is the recent version. But using the bindingRedirect we
can specify
saying 1.0.1830.10461 is the new version. So the client will not use 1.1.1830.10493 .
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ClassLibraryVersion"
publicKeyToken="b035c4774706cc72"
culture="neutral"/>
<bindingRedirect oldVersion= "1.1.1830.10493"
newVersion= "1.0.1830.10461"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Ok now I will try to answer it in long way by doing a small sample project. Agai
n this project will
be done using C#. So in CD you can find the Versioning project. Below is the solut
ion display,
it has two projects one the windows client project ( WindowsVersioningCSharp ) and
second
the class library project ( ClassLibraryVersion ) which will be installed in GAC w
ith two versions.
118
Figure 1.11: - Solution files for the versioning project.
Our first primary goal is to put two different versions of the same DLL in GAC.
So let s make a
walk through of ClassLibraryVersion project. It s a very simple class which has Versi
on function
which just sends a string This is old Version . Second we will also just ensure tha
t the assembly
version is 1.0 in the AssemblyInfo.cs .
119
Figure 1.12 : - Assembly Version 1.0
Second in order that we can put a DLL in GAC we need to create generate strong n
ames and
assign the same to the class. For instance, in below figure I have generated the
strong name in
mykey.snk and assigned the same to the DLL.
120
Figure 1.13 : - Strong naming your DLL
Finally we need to install the same in GAC using gacutil tool. Below is the figure
which shows
the same. This installs one version of ClassLibraryVersion.dll in GAC.
Figure 1.14 : - Install the same in GAC
Now it is time to create a second version of the DLL. So here is what we will do
first we will just
return a different string value for this new version DLL. You can see in the bel
ow figure I have
changed the string to return This is New Version . Secondly we also need to change
the
AssemblyVersion to 1.1.* in the AssemblyInfo.cs file. After that again compile the D
LL and
run the gacutil to register this second version of the ClasLibraryVersion.dll .
121
Figure 1.15 : - Rename to Assembly Version 1.1
Now when we view the GAC we can see two version of ClassLibraryVersion i.e. 1.1.183
2.2619
and 1.0.1832.2172 (see figure below).
Figure 1.16 : - Two version of ClassLibraryVersion dll.
122
Now that we have created the environment of two version of the same DLL in GAC i
ts time to
look at how client can make a choice between those versions. We need to generate
publicKeyToken
in order to move ahead. Below is a sample print screen which shows how we can us
e sn.exe to
generated the public key token. Note the -T parameter.
Figure 1.17 : - Get the PublicKeyToken
Now let s look at the client which will consume this DLL. I have just added window
s form and
a button to the same. In the button click we will try to call the version functi
on and display the
data. So below is the code in the first step we create the object of ClassLibrary
Version.Class1
and in the second step we call the Version function to display the data.
Figure 1.18 : - Client code calling the GAC class.
Now comes the most important part of the whole thing the app.config file which wil
l decide
which version should be used. So add a new app.config file in the project and add
the
AssemblyBinding section as show below. So you need to specify the following things
:-
v Assembly name in the name attribute of assemblyIdentity section.
v Specify the publicKeyToken value in the assemblyIndentity section which was genera
ted
using sn.exe T dllname.dll .
v Specify the oldVersion and newVersion values in the bindingRedirect element. So
what ever version we want the client to use should be specified in the newVersion
attribute.
123
You can see from the figure below I have specified that client should use 1.0.* ve
rsion. So
the client will display This is old Version .
Figure 1.19 : - App.config file using the BindingRedirect
If you run the source code with changing version numbers you can see the below t
wo message
boxes on different version numbers. That is This is old version will be displayed
when
newVersion value is 1.0.1832.5411 and This is new Version will be displayed when
newVersion value is 1.1.1832.5427 .
124
Figure 1.20 : - Different Display depending on version numbers
Note: - Source code is provided in versioning folder. But as you compile the DLL s
different publicToken numbers are created so you need to run the sn.exe in your
machine and
change the token number accordingly in the App.config file.
(A)What is CodeDom?
CodeDom is an object model which represents actually a source code. It is designed
to be
language independent - once you create a CodeDom hierarchy for a program we can th
en
generate the source code in any .NET compliant language. So let s try to do someth
ing real
practical and simple to just get a feel of how powerful CodeDom is.
Note :- You can get the source code in CD in CodeDom folder.
We will try to generate the following code below. The below code which will be g
enerated does
not do anything special buy just displays a hello message and waits for the key
to be pressed.
namespace InterviewQuestions
{
using System;
public class EntryPoint
{
public static void Main()
{
System.Console.WriteLine( Hello from Interview Question series );
System.Console.ReadLine();
125
}
}
}
The Codedom folder in the CD has one GenerateCode method which returns
CodeCompileUnit object. CodeDom is nothing but a full DOM model where every object
in the structure represents a code unit. I have put comments the code so that th
e code is self
understandable. I have commented the code below so that readers can follow what
is exactly
happening. When you click the button it generates the MyCode.cs and also compiles
the
Mycode.exe in the bin folder.
private CodeCompileUnit GenerateCode()
{
// Definition of the Main method which will be entry point
CodeEntryPointMethod objMainMethod = new CodeEntryPointMethod();
objMainMethod.Name = Main ;
// generate this expression: Console
CodeTypeReferenceExpression consoleType = new CodeTypeReferenceExpression();
consoleType.Type = new CodeTypeReference(typeof(Console));
// Set up the argument list to pass to Console.WriteLine()
CodeExpression[] writeLineArgs = new CodeExpression[1];
CodePrimitiveExpression arg0 = new CodePrimitiveExpression( Hello from Interview
Question series );
writeLineArgs[0] = arg0;
// generate this statement: Console.WriteLine(message)
CodeMethodReferenceExpression writeLineRef = new
CodeMethodReferenceExpression(consoleType, WriteLine );
126
CodeMethodInvokeExpression writeLine = new
CodeMethodInvokeExpression(writeLineRef, writeLineArgs);
// generate this statement: Console.ReadLine()
CodeMethodReferenceExpression readLineRef = new
CodeMethodReferenceExpression(consoleType, ReadLine );
CodeMethodInvokeExpression readLine = new
CodeMethodInvokeExpression(readLineRef);
// Add Main() method to a class
CodeTypeDeclaration theClass = new CodeTypeDeclaration();
theClass.Members.Add(objMainMethod);
theClass.Name = EntryPoint ;
// Add both the code of WriteLine and Readline
objMainMethod.Statements.Add(writeLine);
objMainMethod.Statements.Add(readLine);
// Add namespace and add class
CodeNamespace ns = new CodeNamespace( InterviewQuestions );
ns.Imports.Add(new CodeNamespaceImport( System ));
ns.Types.Add(theClass);
// Generate the Compile Unit
CodeCompileUnit unit = new CodeCompileUnit();
unit.Namespaces.Add(ns);
127
Sample provided is very basic but in actual project using codedom can be very co
mplicated.
Projects where you need auto code generation codedom can be a right choice. Bewa
re of high
bulky architecture created due to codedom.

You might also like