Answers

Question and Answer:

  Home  MCSD.NET - 70-340 Exam

⟩ Suppose You are an application developer for your company. You are conducting a code review of aWindows Forms application that was developed by another developer. The applicationincludes a function named Logon(), which validates a users logon credentials. The functiondisplays a dialog box for the user to enter the users credentials, and the function validates thosecredentials by using a database.The function returns a value of 0 if the users password is incorrect, a value of 1 if the users userID is incorrect, and a value of 2 if both are correct. Users should receive access to the applicationonly if the function returns a value of 2. A function named EndApp() is used to exit the application.The application must display a message to the user, depending on the result of the Logon()function.The application contains the following code segment.int logonresult = Logon();switch(logonresult) {case 0MessageBox.Show("User name is OK, password incorrect.");break;case 1MessageBox.Show(&

D. int logonresult = Logon();

if(logonresult == 2) {

MessageBox.Show("Welcome!");

}

else {

MessageBox.Show("User name or password was incorrect.");

EndApp();

}

 142 views

More Questions for you: