About Me

My photo
Northglenn, Colorado, United States
I'm primarily a BI Developer on the Microsoft stack. I do sometimes touch upon other Microsoft stacks ( web development, application development, and sql server development).
Showing posts with label Assessement Question. Show all posts
Showing posts with label Assessement Question. Show all posts

Monday, September 25, 2006

MS ASP.Net Assessment Question: Giving permissions

You develop a Web application. The Web application accesses resources. You create a Microsoft Windows(R) account named AppUser. You grant AppUser appropriate permissions to the resources.

You need to configure the Web application so that it always runs in the context of the AppUser account.

Which code segment should you use?

A)<identity
impersonate="true"
userName="CONTOSO\AppUser"
password="pwd"/>
B)<appSettings>
<add key="userName" value="CONTOSO\AppUser"/>
<add key="password" value="pwd"/>
</appSettings>
C)<identity
impersonate="false"
userName="registry:HKLM\Software\AspNetProcess,Pwd"
password="registry:HKLM\Software\AspNetProcess,Name"/>
D)<identity
impersonate="false"
userName="registry:HKLM\Software\AspNetProcess,Name"
password="registry:HKLM\Software\AspNetProcess,Pwd"/>

A) This would give the user the appropriate permissions on the account.
B) This is more like a global variable that can be used throughout the asp.net pages. For example, setting the database connection information in the web.config.
C & D) Well to impersonate you will need it to be true, and these lines actually save the information to the registry. This is good for storing the user's name and password for the site.

Saturday, September 23, 2006

MS ASP.Net Assessment Question: Constant deployment of a web page.

You deploy an intranet Web application that is updated daily.

After performance testing, you decide to precompile the Web application to improve page-loading speed. Currently, the source files are deployed with the Web application for ease of maintenance.

You need to precompile the Web application by using the minimum amount of administrative effort.

What should you do?

A) Create a Web Setup project.
B) Create a batch file that uses MSBuild.exe.
C) Use the Copy Web tool.
D) Load the following URL into a Web browser.
http://localhost/mywebsitename/precompile.axd

A: The web setup project is a great solution when you want to import and deploy to a server, but there are alot of step and seems to be other simpiler, quicker ways.
B: MSBuild.exe will build the project. This would work as long as the IIS and VS.Net are on the same server.
C: The copy web tool copys a website to another location on a different server, for example. This of course doesn't precompile, and would be ok as long as there is nothing complicated in the design. However, if you think your website is going too slow, then this would not be the answer.
D: This will precompile the website and give a message if successful. This seems to be the best answer. This might not always be the best solution: http://dotnetgeek.blogspot.com/2004/10/pre-compilation-in-aspnet-v11.html

Friday, September 22, 2006

MS ASP.Net assessment Question: Verify XML from Schema

You load an XML document into an instance of the XmlDocument class. You add elements to it.

You need to validate the changes that you made to the XML document against a schema. You do not want to create a new instance of the Document Object Model (DOM).

What should you do?

A) Create an XmlNodeReader by using the XML document. Set the validation settings on the XmlReaderSettings object. Create a validating reader that wraps the XmlNodeReader object.
B) Save the contents of the XML document to the file system. Create a new instance of the XmlDocument class. Call the Load method, and pass in the file path of the recently modified XML document.
C) Create an XmlNodeReader by using the elements of the XML document that changed. Set the validation settings on the XmlReaderSettings object. Create a validating reader that wraps the XmlNodeReader object.
D) Save the contents of the XML document to a string. Create a new instance of the XmlDocument class. Call the LoadXml method, and pass in the string representation of the recently modified XML document.

A- seems to be correct, the XmlReaderSettings allows for setting the schema to be used and you can then just use a XmlReader that would use that. I am assuming that the XmlNodeReader could do the same.
B- would work, but seems excessive amount of time to accomplish.
C- Same as A, but only looks at the newly created nodes, this seems to be the quickest. The XmlNodeReader is suppose to keep track of where in the schema the current not would be referencing.
D- inefficient, holding xml in string is probably not the best choice.

A good way of doing this was found on MSDN: http://support.microsoft.com/kb/318504/

MS ASP.Net Assessment Question: Using RequiredFieldValidator

You create a Web Form. The Web Form contains a text box that has the ID txtName. The Web Form also contains a button named btnSave.

You need to use the RequiredFieldValidator control to ensure that the text box contains a value before it is submitted to the server.

What should you do?

A) Set the RequiredFieldValidator control's ControlToValidate property to txtName.
B) Set the RequiredFieldValidator control's InitialValue property to txtName.Text.
C) Set the RequiredFieldValidator control's EnableClientScript property to False. Add code to the form's btnSave_Click event that checks whether the text box contains a value. If it does not, set the RequiredFieldValidator's IsValid property to False.
D) Set the text box's CausesValidation property to True. Set its ValidationGroup to the ID of the RequiredFieldValidator control.

A - obvious answer, the ControlToValidate tells what control it will be checking to see if a value exist.
B - Wrong, sets the inital value to what is in the textbox.
C - kinda wrong, since you are setting the EnableClientScript to false, it would only check during the postback event that is thrown from the button. It might show you that the field is required or not only during postback though.
D - kinda wrong, this is better used on webcontrols that are not easily validated like a set of radio buttons.

Thursday, September 21, 2006

MS ASP.Net Assessment Question: Specify for browser type.

You create a Web Form. The Web Form will be viewed by both mobile and desktop browsers. You add a Label control to the page. You use the following code segment.



When mobile browsers view the page, the Label must render "Name" instead of "Enter Your First Name."

You need to ensure that the Label renders correctly.

What should you do?

A) Add the following XML segment to Ie.browser. <capability name="mobile" value="true" />
B) Use device filters to specify alternate text in the Label definition.
C) Create a new file named All.browser, and add it to the browser's directory. Specify browser capabilities in All.browser.
D)Add the following attribute to the Label. EnableTheming="True"

A - Just states that IE can handle mobile, but don't know if capability is an actual tag.
B - I would think a device filter would be easy, by just checking for WML
C - Creating a All.browser will allow for the page to specify how it is render based on the browser used by the user, but don't think it would allow small cosmetic changes.
D - EnableTheming would just use the theme for that page.

Found this on a 2004 MSDN article which would be nice to use instead:
<asp:label runat="server" text="some browser" IE:text="any IE browser"
IE5:text="the IE 5 browser" PIE:text="the Pocket PC browser" />

Wednesday, September 20, 2006

MS ASP.Net Assessment Question: Cancelling a logon event.

You create a Web Form. The Web Form allows users to log on to an application. You include a Login control named Login1. You want to be able to cancel the logon process when a user clicks the Log on button in the Login1 control.

You need to write code in one of Login1's event handlers to cancel the logon process.

What should you do?

A)Write code in the Login1_Load event handler.
B)Write code in the Login1_LoginError event handler.
C)Write code in the Login1_LoggedIn event handler.
D)Write code in the Login1_LoggingIn event handler.
E)Write code in the Login1_Authenticate event handler.


A is wrong since there is no Load event for the Login Control.
B is wrong since this only occurs when the login event throws an error.
C is wrong since the user is logged into the site and is authenticated.
D is probably the best answer since the process of logging on is still taking place and authentication has not occured yet.
E is wrong because the user would have already been authenicated by then.

MS ASP.Net Assessment Question: Store custom events in a database.

You manage a remote Web site that is experiencing random errors.

You need to implement an event tracking process that enables custom events to be stored in a database.

What should you do?

A) Log a message into a MessageQueue.
B) Implement ICallbackEventHandler.
C) Derive a class from WebBaseEvent.
D) Derive a class from EventInstance.

A, the MSMQ allows for communication over networks and allows server-side applications running within ASP.NET to use MSMQ. Storing messages into a database can be done with MSMQ.

B is wrong because ICallbackEventHandler is used for calling codebehind from a javascript function.

C the WebBaseEvent allows the monitoring of performance of an app, diagnose failing apps and/or systems and appraising significant events during the lifecycle of a the given app. Using SqlWebEventProvider as your event provider and inherit from the WebBaseEvent to customize them if you wanted.

D) is wrong. EventInstance is for 3.0, not 2.0. Allows for writing messages based on the localized language on the machine and writes the entry to the event log.

So it could be A or C (IMO), but I would take the guest of C in this case.

MS ASP.Net Assessment Question: Extract data from XML Node.

You have an application that reads the following XML document with an instance of the XmlReader class.
<bookstore>
<books>
<book genre="'reference'" id="'23'">
<title>World Atlas</title>
<author status="bestseller">
<first-name>Joe</first-name>
<last-name>Worden</last-name>
</author>
<price>8.99</price>
</book>
</books>
</bookstore>

You advance the XmlReader to the author XmlNode.
You need to extract the values of the author XmlNode and all of its children as a string.
What should you do?

A) Use the ReadInnerXml method of the XmlReader.
B) Use the ReadOuterXml method of the XmlReader.
C) Use the ReadString method of the XmlReader.
D) Use the Value property of the XmlReader

A would be wrong since it would only get the children information.
B is correct since it would give the children tags and the current start tag.
C would return a string, but only the data up to the first end tag.
D this would only return the attribute of the author in this case.