***************************************************
(1)-What’s the difference between Response.Write() andResponse.Output.Write()?
(2)-What methods are fired during the page load?
(3)-When during the page processing cycle is ViewState available?
(4)-What namespace does the Web page belong in the .NET Framework class hierarchy?
(5)-Where do you store the information about the user’s locale?
(6)-What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?
(7)-What’s a bubbled event?
(8)-Suppose you want a certain ASP.NET function executed on MouseOver for a certain button.Where do you add an event handler?
(9)-What data types do the RangeValidator control support?
(10)-Explain the differences between Server-side and Client-side code?
(11)-What type of code (server or client) is found in a Code-Behind class?
(12)-Should user input data validation occur server-side or client-side? Why?
(13)-What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
(14)-Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
(15)-What is the Global.asax used for?
***************************************************
Answers:
=============
-Response.Output.Write() allows you to write formatted output.
=============
-(a).Init() - when the page is instantiated
(b).Load() - when the page is loaded into server memory
(c).PreRender() - the brief moment before the page is displayed to the user as HTML
(d).Unload() - when page finishes loading.
=============
-After the Init() and before the Page_Load(), or OnLoad() for a control.
=============
- System.Web.UI.Page
=============
- System.Web.UI.Page.Culture
=============
-CodeBehind is relevant to Visual Studio.NET only.
=============
- When you have a complex control, like DataGrid, writing an event processing routine for each object(cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
=============
- Add an OnMouseOver attribute to the button.
Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
=============
- Integer, String, and Date.
============
- Server-side code executes on the server. Client-side code executes in the client's browser
=============
- The answer is server-side code since code-behind is executed on the server. However,
during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.
=============
- All user input data validation should occur on the server at a minimum. Additionally, client-side
validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
=============
-Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.
==============
- · A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
· A DataSet is designed to work without any continuing connection to the original data source.
· Data in a DataSet is bulk-loaded, rather than being loaded on demand.
· There's no concept of cursor types in a DataSet.
· DataSets have no current record baller You can use For Each loops to move through the data.
· You can store many edits in a DataSet, and write them to the original data source in a single operation.
· Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
============
-The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
Where would you use an iHTTPModule, and what are the limitations of anyapproach you might take in implementing one?
Answer :
One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes
between client and server. You can use them to extend your ASP.NET applications by adding pre- and
post-processing to each HTTP request coming into your application. For example, if you wanted custom
authentication facilities for your application, the best technique would be to intercept the request when
it comes in and process the request in a custom HTTP module.
What is different b/w webconfig.xml & Machineconfig.xml[/b]
Answer :
Web.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration files.Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.
If I’m developing an application that must accomodate multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?
Use the state server or store the state in the database. This can be easily done through simple setting change in the web.config.
StateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1; user id=sa; password="
cookieless="false"
timeout="30" />
You can specify mode as “stateserver” or “sqlserver”.
Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one
“One of ASP.NET’s most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
What are Pipelining Issues?
Answer :
Pipelining increases the CPU instruction throughput - the number of instructions completed per unit of time. But it does not reduce the execution time of an individual instruction. In fact, it usually slightly increases the execution time of each instruction due to overhead in the pipeline control.
The increase in instruction throughput means that a program runs faster and has lower total execution time.
Limitations on practical depth of a pipeline arise from:
Pipeline latency. The fact that the execution time of each instruction does not decrease puts limitations on pipeline depth;
Imbalance among pipeline stages. Imbalance among the pipe stages reduces performance since the clock can run no faster than the time needed for the slowest pipeline stage;
Pipeline overhead. Pipeline overhead arises from the combination of pipeline register delay (setup time plus propagation delay) and clock skew.
Once the clock cycle is as small as the sum of the clock skew and latch overhead, no further pipelining is useful, since there is no time left in the cycle for useful work.
What is resource adapter module
Answer :
A deployable unit that contains all Java interfaces, classes, and native libraries, implementing a resource adapter along with the resource adapter deployment descriptor.
Can an anonymous class be declared as implementing an interface and extending a class?
Answer :
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
What are links and symbolic links in UNIX file system?
Answer :
A link is a second name (not a file) for a file. Links can be used to assign more than one name to a file, but cannot be used to assign a directory more than one name or link filenames on different computers.
Symbolic link ‘is’ a file that only contains the name of another file.Operation on the symbolic link is directed to the file pointed by the it.Both the limitations of links are eliminated in symbolic links.
What is an .ASP file?
: It is a Text File that contains the combination of the following:
• Text
• HTML tags
• Script Commands
What is EJB client JAR file?
: An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.
What is the different between GUI map and GUI map files?
Answer :
The GUI map is actually the sum of one or more GUI map files. There are two modes for organizing GUI map files. Global GUI Map file: a single GUI Map file for the entire application. GUI Map File per Test: WinRunner automatically creates a GUI Map file for each test created.
GUI Map file is a file which contains the windows and the objects learned by the WinRunner with its logical name and their physical description.
What is a File server?
Answer :
File servers are useful for sharing files across a network. With a file server, the client passes requests for file records over nerwork to file server.
What is ‘inode’?
Answer :
All UNIX files have its description stored in a structure called ‘inode’. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to additional data blocks (this further aggregates for larger files). A block is typically 8k.
Inode consists of the following fields:
File owner identifier
File type
File access permissions
File access times
Number of links
File size
Location of the file data
What is the difference between the File and RandomAccessFile classes?
-The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
I've introduced you to Output caching and Fragment caching in my last article. By means of both we are able to increase the performance of our web applications significantly by storing and retrieving commonly accessed pages and fragments of pages in memory. This article will explain the use of the third and most granular cache method, Data Caching. I will show you how to cache at the object level. Translation: more flexibility, more speed. Therefore, happier users, and not to mention (cough cough), more ca-ching.
My first article on caching showed you the benefit of properly implementing caching in your ASP.NET applications. But beyond that I also showed you how and when to use Output caching and Fragment caching. As you've no doubt gleaned already, different forms of caching are appropriate for different situations you meet. Just keep that in mind, because as I explain the use of data caching you may realize just how superior it is, and feel a strange need to employ it at every opportunity. Just remember that Fragment and Output caching are the best choices in the situations I presented in the last article, and they remain that. That said, let's see what data caching is, and where to use it.
Basically, data caching is the engine that provides for the storage and retrieval from memory at object level. This means that individual objects, (which includes... well, everything in .NET) can be cached and shared throughout multiple requests and sessions. In this article I will show you three methods of utilizing the data cache.
METHODS:
Method # 1: the Cache Method
This is by far the simplest way to get your object/data into the cache. If you're at all familiar with classic ASP, you'll see it's as easy as using session variables. If you're new to all of this, then you're about to see just how easy it really is. Here's the incredibly large amount of code you will need to type in order to store an item in the cache:
strVal = "something trivial"
cache("item") = strVal
So that's it. 'item' is the variable name you will use, and 'value' is none other than -- you guessed it -- the value! But how do we now retrieve the item once it's sitting in memory? Also, not very difficult:
newVariable = cache("item")
There, wasn't that far less painful than a trip to the dentist? But you may be wondering if we're limited to storing simplistic variable such as the string I used in the example. Well, recall that this is caching at the object level. So any object, for instance an array, can certainly be stored this way! Now I sense you are starting to get excited, beginning to understand the power and versatility of data caching.
But if you really examine this first method, you'll agree that it's very basic. All you can do it add and retrieve items from the cache. There's really no further level of control granted us. For instance, how do we tell the application when to oust the object from memory at a given time to free up resources? We don't; It just remains there until a server restart or explicit removal (through the cache.remove(“item”) method), which is far too onerous of a task for most developers to bother with. Hmm, you're thinking that something more is needed. Well, something more is given, let's check it out!
Methods #2 & #3, .Insert & .Add
Now we move beyond the restrictions of the Cache method. We take the control of the cache-flow out of the hands of the server, and place it where it should be, in your hands. You and I will get to determine the lifetime of the objects, either with time expiration, external dependencies, or even based on priority against other cached objects. Before we do that though, I'll just quickly show you how to use these methods in their raw form, wit no options:
strVal = "this is SOOO exciting!"
cache.insert("item", strVal)
'or
cache.add("item", strVal)
Why you would choose one method over the other will not be readily apparent yet. Really the only difference is that cache.add has one extra option, that of returning an object representing the cached data. Other than that option, the syntax for both is the same, so I'll only use one method in my example, and you can interchange as you see fit. So why don't we just proceed through these one at a time, starting with the expiration option.
You're Too Old, Please Leave
So how exactly can we set a maximum age requirement for the cached data? Well I hate you tell you that you have more options, but it's true. I know, first you have the option of which caching method to choose. Then if you've chosen data caching, you've got three more option of how to implement it. Then, if you've decided on .insert or .add, you have the control options. You've finally decided to use a time expiration, and are very tired. This is why I'm sorry to present more options to you, but I'm afraid I have to.
Firstly, the most straightforward option is just to set an absolute expiration time. Here's how you could do that:
strVal = "I'm learning so much!"
cache.insert("item", strVal, nothing, datetime.now.addminutes(10), timespan.zero) 'there should be no carriage return here
Ok, some explanation is needed. That 'nothing' that you see is the dependency option, which will be discussed next. That needs to be there. You may quickly decipher that we're telling the object to expire in 10 minutes, but maybe you're wondering what the last option is, the timespan.zero. That us the sliding expiration time, which I will explain next. Just remember that both must be represented by some value, if you are to use either option. Also remember that only one can be used at a time.
The second option, which was turned off in the last example by the use of timespan.zero, is called the sliding expiration policy. This will 'slide' the time to get rid of the object until a specified time after the last request for that object. We set this option in the following way:
strVal = "Caching is so much fun!"
cache.insert("item", strVal, nothing, datetime.maxvalue,
timespan.fromseconds(60)) 'there should be no carriage return here
Nothing to cryptic in that code, just note that the datetime.maxvalue disables the absolute expiration, because as I'm confident that you remembered, only one can be used at a time. So now let's go back to first option in the chain, the dependency option.
Do You Have Any Dependents?
I find this to be a very cool option. We can tell the application to leave the object in cache, depending entirely on the variability of another object. That other object is monitored for any changes, and as soon as a change is detected, the cached object expires! This could be a file, another cached object, or even multiple objects! Here's an example in code:
strVal = "I may or may not have understood these directions..."
cache.insert("item", strVal, New CacheDependency(Server.MapPath("depend.xml")))
LEARN TO SET PRIORITIES
I'm assuming that you're already making plans of how to use this, and I don't blame you -- it is very powerful. However, in Whidbey (ASP.NET version 2) you will have the option of setting the dependency to be upon an actual database, now THAT's powerful! But I guess until we have a public release, this will have to suffice! Ok, enough coveting what we do not have, let's continue learning what's now within our grasp.
sed. Naturally, Microsoft foresaw this situation, and graciously allowed us to set the Priority, or preferred purging order, of cached objects. Here are the different priority settings we have available:
NotRemovable – Never removed on low memory purging. Be careful with this one!
High – last purged
AboveNormal – less likely purged
Normal – default
BelowNormal – more likely purged
Low – first purged
Before I show you the code to implement this, I have to inform you that there are yet another two options that absolutely must be included if you wish to set cache priorities. The first is the CacheItemPriorityDecay setting, which decays (decreases) the priority as the object is less frequently accessed. It can be set to Never, Slow, Medium, or Fast.
The last option that must be set is the CacheItemRemoveCallback, which sets when the application is notified of the purging of a cached item. The possible settings are DependencyChanged, Expired, Removed, or Underused.
Here is the final example, showing all the options I've gone through:
strVal = "Finally, we're done!"
cache.insert("item", strVal, nothing, datetime.maxvalue, _
timespan.fromseconds(60), CacheItemPriority.BelowNormal, _
CacheItemPriorityDecay.Fast, OnRemove)
Pros and Cons of Data Caching
To sum it all up, I'd like to just give a quick runs down of both the positive and negative aspects of Data caching.
On the positive side: if a page is too dynamic for either Output or Fragment caching, Data caching will provide the flexibility and performance enhancements that you require. Also, if you have very commonly accessed objects that may be used on several pages throughout your application, you could throw them in the cache so that they could be almost instantly delivered to each page from memory. And the biggest advantage I see is in the case of large or slow-loading objects. You can load them right into cache the first time they're requested, and continue to serve them from memory. This could be great for collections of data pulled from a database, such as an employee list, or a site navigation structure that you don't want to have to hit the database for on every page load.
So then, what are the negative aspects, the cons? Hmm, I would have to say that once you become adept at employing the various cache engines within your application, people will be too happy with you as a programmer, you will be far too much in demand, and your fame and pay-check will swell so greatly that you will be at risk of losing touch with reality. (Please write me if that happens to you.)
What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.
Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
Whats an assembly?
Assemblies are the building blocks of the .NET framework.
Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.
Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.
Can you edit data in the Repeater control?
No, it just reads the information from its data source.
Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.
How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.
What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.
What base class do all Web Forms inherit from?
The Page class.
Name two properties common in every validation control?
ControlToValidate property and Text property.
Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.
Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.
How many classes can a single .NET DLL contain?
It can contain many classes.
(1.) What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.
(2.) True or False: A Web service can only be written in .NET?
False
(3.)What does WSDL stand for?-Web Services Description Language.
(4.)Where on the Internet would you look for Web services?-http://www.uddi.org
(5.)True or False: To test a Web service you must create a Windows application or Web application to consume
this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.
State Management Questions
What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page.
ViewState is transported to the client and back to the server, and is not stored on the server or
any other external source. ViewState is used the retain the state of server-side objects between postabacks.
What is the lifespan for items stored in ViewState?
Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).
What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a
given control into ViewState, which is stored as a hidden value on the page before sending the page to the
clients browser. When the page is posted back to the server the server control is recreated with the state stored
in viewstate.
What are the different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the
web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to
the same web server. Out-of-Process Session state management stores data in an external data source. The
external data source may be either a SQL Server or a State Server service. Out-of-Process state management
requires that all objects stored in session are serializable.
No comments:
Post a Comment