Web Developer Framework 4.0 Sample Questions – 3

Question: You have created an ASP.NET server control named Shopping Cart for use by other developers. Some developers report that the Shopping Cart control does not function properly with ViewState disabled. You want to ensure that all instances of the Shopping Cart control work even if ViewState is disabled. What should you do?

  1. Require developers to set EnableViewStateMac to true.
  2. Store state in ControlState instead of ViewState.
  3. Serialize the state into an Application state entry called “MyControl”.
  4. Require developers to change the session state mode to SQLServer.

Correct Answer: 2


Question: You are troubleshooting an ASP.NET Web application. System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state. You need to fix the problem. What should you do?

  1. Set viewStateEncryptionMode to Auto in web.config on both servers.
  2. Set the machineKey in machine.config to the same value on both servers.
  3. Change the session state mode to SQLServer on both servers and ensure both servers use the same connection string.
  4. Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

Correct Answer: 2


Question: You are developing a Web page. The user types a credit card number into an input control named cc and clicks a button named submit. The submit button sends the credit card number to the server. A JavaScript library includes a CheckCreditCard function that returns a value of true if the credit card appears to be valid, based on its checksum. You need to ensure that the form cannot be used to submit invalid credit card numbers to the server. What should you do?

  1. Configure the input control to run on the server. On the submit button, add a server-side OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
  2. On the input control, add an onChange handler that calls CheckCreditCard and cancels the form submission when the input is invalid.
  3. Configure the input control and the submit button to run on the server. Add a submit_OnClick handler that calls CheckCreditCard and rejects the form submission if the input is invalid.
  4. On the form, add an onSubmit handler that calls CheckCreditCard and cancels the form submission if the input is invalid.

Correct Answer: 4


Question: You are implementing an ASP.NET page that includes a text box. You need to validate values that are typed by users to ensure that only numeric values are submitted. Which control markup should you use?

  1. <asp:TextBox ID=”txt1″ runat=”server” CausesValidation=”true” ValidationGroup=”Numeric” />
  2. <asp:TextBox ID=”txt1″ runat=”server” EnableClientScript=”true” ValidationGroup=”Numeric” />
  3. <asp:TextBox ID=”txt1″ runat=”server” /> <asp:RegularExpressionValidator ID=”val1″ runat=”server” ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />
  4. <asp:TextBox ID=”txt1″ runat=”server” /> <asp:RegularExpressionValidator ID=”val1″ EnableClientScript=”true” ControlToValidate=”txt1″ ValidationExpression=”[0-9]*” ErrorMessage=”Invalid input value” />

Correct Answer: 3


Question: You are implementing an ASP.NET Web page. You need to add a text box that allows only values between 1 and 10, inclusive, to be submitted. Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)

  1. <script type=”text/javascript”>function validate_value(obj, args) {return(args.Value >= 1 && args.Value <= 10);} </script>
  2. <script type=”text/javascript”>function validate_value(obj, args) {args.IsValid =(args.Value >= 1 && args.Value <= 10);} </script>
  3. <asp:TextBox ID=”txt1″ runat=”server” />
    <asp:CustomValidator ID=”val1″ runat=”server” ControlToValidate=”txt1″ ClientValidationFunction=”validate_value” ErrorMessage=”Value invalid” />
  4. <asp:TextBox ID=”txt1″ runat=”server” onChange=”validate_value(this, args)” />

Correct Answer: 2,3

Tagged . Bookmark the permalink.

4 Responses to Web Developer Framework 4.0 Sample Questions – 3

  1. vikram says:

    I mean,
    ——————————————————————————–
    Question: You are implementing an ASP.NET Web page. You need to add a text box that allows only values between 1 and 10, inclusive, to be submitted. Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)
    1.function validate_value(obj, args) {return(args.Value >= 1 && args.Value <= 10);}
    2.function validate_value(obj, args) {args.IsValid =(args.Value >= 1 && args.Value <= 10);}
    3.
    4.
    Correct Answer: 2,3

  2. vikram says:

    Hi Dear, option 4 should be start at last line.

Leave a Reply