Professional Documents
Culture Documents
com
The Software Interview Question Bank
-- Maintained by Shivprasad Koirala shiv_koirala@yahoo.com
Looking for a job but do not know where to start buy my interview
question series books from bpb@bol.net.in
Do not have time to prepare for interview its on head join our one
day course at mumbai and feel the confidence call 9892966515 for
more details.
Do you have a question which can cost somebody a good job mail
me at shiv_koirala@yahoo.com
Do you have a suggestion / tips and tricks which can make job
searcher easier mail me at shiv_koirala@yahoo.com.
www.questpond.com
Contents
From the Author.............................................................................. 3
Career Path Institute ....................................................................... 4
5. Caching Concepts ....................................................5
(B) What is application object ? ........................................................................................................... 5
(I)What’s the difference between Cache object and application object ? ........................................... 5
(I)How can get access to cache object ? ............................................................................................... 5
(A)What are dependencies in cache and types of dependencies ? ....................................................... 5
(P)Can you show a simple code showing file dependency in cache ? ................................................. 6
(A) What is Cache Callback in Cache ? ............................................................................................... 6
(A) What is scavenging ?...................................................................................................................... 7
(B) What are different types of caching using cache object of ASP.NET? .......................................... 7
(B) How can you cache different version of same page using ASP.NET cache object ? ..................... 7
(A) How will implement Page Fragment Caching ? ............................................................................ 8
(B) What are ASP.NET session and compare ASP.NET session with classic ASP session variables?
8
(B) Which various modes of storing ASP.NET session ? ..................................................................... 8
(A) Is Session_End event supported in all session modes ?................................................................. 9
(A) What are the precautions you will take in order that StateServer Mode work properly ? ............. 9
(A) What are the precautions you will take in order that SQLSERVER Mode work properly ? ......... 9
(A) Where do you specify session state mode in ASP.NET ? ............................................................ 10
(B) What are the other ways you can maintain state ? ....................................................................... 10
(B) What are benefits and Limitation of using Hidden fields ?.......................................................... 10
(B) What is ViewState ? ..................................................................................................................... 11
(A) Do performance vary for viewstate according to User controls ? ............................................... 11
(B) What are benefits and Limitation of using Viewstate for state management? ............................. 11
(B) How an you use Hidden frames to cache client data ? ................................................................. 12
(I) What are benefits and Limitation of using Hidden frames? .......................................................... 12
(I) What are benefits and Limitation of using Cookies? .................................................................... 13
(I) What is Query String and What are benefits and Limitation of using Query Strings?.................. 13
Distribution Partner ...................................................................... 15
How to buy the book .................................................................... 16
www.questpond.com
From the Author
First thing thanks to all those who have sent me complaints and also appreciation for what ever titles
i have written till today. But interview question series is very near to my heart as i can understand
the pain of searching a job. Thanks to my publishers (BPB) , readers and reviewers to always excuse
all my stupid things which i always do.
So why is this PDF free ?. Well i always wanted to distribute things for free specially when its a
interview question book which can fetch a job for a developer. But i am also bounded with publish-
ers rules and regulations. And why not they have a whole team of editor, printing guys, designers,
distributors, shopkeepers and including me. But again the other aspect, readers should know of what
they are buying , the quality and is it really useful to buy this book. So here are sample free ques-
tions which i am giving out free to the readers to see the worth of the book.
I can be contacted at shiv_koirala@yahoo.com its bit difficult to answer all answers but as i get time
i do it.
We have recently started a career counselling drive absolutely free for new comers and experienced
guys. So i have enlisted the following guys on the panel. Thanks to all these guys to accept the panel
job of consulting. Feel free to shoot them questions just put a title in the mail saying “Question about
Career”. I have always 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 up one of
the positions. You can contact me at shiv_koirala@yahoo.com for technical career aspect.
Tapan Das :- If you think you are aiming at becoming a project manager he is the right person to
consult. He can answer all your questions regarding how to groom your career as a project manager
tapand@vsnl.com.
Kapil Siddharth :- If you are thinking to grow as architect in a company then he is a guy. When it
comes to role model as architect i rate this guy at the top. You can contact him at
kapilsiddharth@hotmail.com
Second if you think you can help the developers mail me at shiv_koirala@yahoo.com and if i find
you fitting in the panel i will display your mail address. Please note there are no financial rewards as
such but i am sure you will be proud of the work you are doing and whos knows what can come up.
Lets make Software Industry a better place to work ..... Happy Job Hunting and Best of Luck
www.questpond.com
-- Interview preparation course two days ( Saturday and Sunday Batch). ( C# , SQL Server)
-- Full one year course for C# , SQL Server
ww
w.
qu
est
po
nd
.co
m
www.questpond.com
5. Caching Concepts
Application object can used in situation where we want data to be shared across users
globally.
The main difference between the Cache and Application objects is that the Cache object
provides cache-specific features, such as dependencies and expiration policies.
The Cache object is defined in the System.Web.Caching namespace. You can get a reference
to the Cache object by using the Cache property of the HttpContext class in the
System.Web namespace or by using the Cache property of the Page object.
When you add an item to the cache, you can define dependency relationships that can
force that item to be removed from the cache under specific activities of
dependencies.Example if the cache object is dependent on file and when the file data
changes you want the cache object to be update.Following are the supported dependency
:-
√ File dependency :- Allows you to invalidate a specific cache item when a disk
based file or files change.
√ Time-based expiration :- Allows you to invalidate a specific cache item
depending on predefined time.
√ Key dependency :-Allows you to invalidate a specific cache item depending
when another cached item changes.
Cache object is dependent on its dependencies example file based , time based etc.Cache
items remove the object when cache dependencies change.ASP.NET provides capability
to execute a callback method when that item is removed from cache.
When server running your ASP.NET application runs low on memory resources , items
are removed from cache depending on cache item priority.cache item priority is set when
you add item to cache.BY setting the cache item priority controls which items scavenging
is removed first.
(B) What are different types of caching using cache object of ASP.NET?
You can use two types of output caching to cache information that is to be transmitted to
and displayed in a Web browser:
(B) How can you cache different version of same page using ASP.NET
cache object ?
Page fragment caching involves the caching of a fragment of the page, rather than the
entire page. When portions of the page need to be dynamically created for each user
request this is best method as compared to page caching.You can wrap Web Forms user
control and cache the control so that these portions of the page don’t need to be recreated
each time.
(B) What are ASP.NET session and compare ASP.NET session with
classic ASP session variables?
ASP.NET session caches per user session state.It basically uses “HttpSessionState” class.
Following are the limitations in classic ASP sessions :-
√ ASP session state is dependent on IIS process very heavily.So if IIS restarts
ASP session variables are also recycled.ASP.NET session can be independent
of the hosting environment thus ASP.NET session can maintained even if IIS
reboots.
√ ASP session state has no inherent solution to work with Web Farms.ASP.NET
session can be stored in state server and SQL SERVER which can support
multiple server.
√ ASP session only functions when browser supports cookies.ASP.NET session
can be used with browser side cookies or independent of it.
√ InProc:- In this mode Session state is stored in the memory space of the
Aspnet_wp.exe process.This is the default setting.If the IIS reboots or web
application restarts then session state is lost.
8
Reading tits and bits is not worth buy complete
hard copy see the last page for more details
www.questpond.com
√ StateServer:-In this mode Session state is serialized and stored in a separate
process (Aspnet_state.exe); therefore, the state can be stored on a separate
computer(a state server).
√ SQL SERVER:- In this mode Session state is serialized and stored in a SQL
Server database.
Session state can be specified in <sessionState> element of application configuration
file.Using State Server and SQL SERVER session state can be shared across web farms
but note this comes at speed cost as ASP.NET needs to serialize and deserialize data over
network again and again.
Session_End event occurs only in “Inproc mode”.”State Server” and “SQL SERVER”
do not have Session_End event.
(A) What are the precautions you will take in order that StateServer Mode
work properly ?
Following are the things to remember so that StateServer Mode works properly :-
√ StateServer mode session data is stored in a different process so you must
ensure that your objects are serializable.
√ <machineKey> elements in Web.config should be indentical across all
servers.So this ensures that encryption format is same across all computers.
√ IIS metabase (\LM\W3SVC\2) must be identical across all servers in that
farm.
(A) What are the precautions you will take in order that SQLSERVER
Mode work properly ?
Following are the things to remember so that SQLSERVER Mode works properly :-
√ SQLSERVER mode session data is stored in a different process so you must
ensure that your objects are serializable.
√ IIS metabase (\LM\W3SVC\2) must be indentical across all servers in that
farm.
(B) What are the other ways you can maintain state ?
Other than session variables you can use the following technique to store state :
√ Hidden fields
√ View state
√ Hidden frames
√ Cookies
√ Query strings
10
Reading tits and bits is not worth buy complete
hard copy see the last page for more details
www.questpond.com
√ They can be tampered creating a security hole.
√ Page performance decreases if you store large data , as the data is stored in
pages itself.
√ Hidden fields do not support rich structures as HTML hidden fields are only
single valued.Then you have to work around with delimiters etc to handle
complex structures.
Below is how you will actually implement hidden field in a project
<input id="HiddenValue" type="hidden" value="Initial Value"
runat="server"NAME="HiddenValue">
Viewstate is a built-in structure for automatically retaining values among multiple requests
for the same page. The view state is internally maintained as a hidden field on the page
but is hashed, providing greater security than developer-implemented hidden fields do.
Performance of view state varies depending on the type of server control to which it is
applied. Label, TextBox, CheckBox, RadioButton, and HyperLink are server controls
that perform well with ViewState. DropDownList, ListBox, DataGrid, and DataList suffer
from poor performance because of their size and the large amounts of data making
roundtrips to the server.
(B) What are benefits and Limitation of using Viewstate for state
management?
This technique is implemented by creating a Hidden frame in page which will contain
your data to be cached.
<FRAMESET cols="100%,*,*">
<FRAMESET rows="100%">
<FRAME src="data_of_frame1.html"></FRAMESET>
<FRAME src="data_of_hidden_frame.html">
<FRAME src="data_of_hidden_frame.html" frameborder="0" noresize
scrolling="yes">
</FRAMESET> www.questpond.com
Above is a sample of hidden frames where the first frame “data_of_frame1.html” is visible
and the remaining frames are hidden by giving whole col section to first frame. See allocation
where 100 % is allocated to first frame and remaining frames thus remain hidden.
A query string is information sent to the server appended to the end of a page URL.
Following are the benefits of using query string for state management:-
√ No server resources are required. The query string is contained in the HTTP
request for a specific URL.
www.questpond.com
www.questpond.com
14
www.questpond.com
Distribution Partner
www.questpond.com
www.questpond.com
Pakistan
M/s. Vanguard Books P Ltd, 45 The Mall, Lahore, Pakistan (Tel: 0092-42-7235767, 7243783 and
7243779 and Fax: 7245097)
E-mail: vbl@brain.net.pk
http://www.prakashbooks.com/details.php3?id=17875&c=Computer Books
http://www.amazon.co.uk/exec/obidos/ASIN/8183330770/qid%3D1139594062/026-8105897-
7667603
http://www.prakashbooks.com/details.php3?id=19008&c=Computer Books
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 , India :-
bpb@bol.net or bpb@vsnl.com
www.questpond.com