Which three actions should you perform in sequence?

DRAG DROP
You create the following JavaScript code:

You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater than 500.
Display the message Approved! If the PaymentAmount variable is less than 300.
Display the message Approved with caution! If the PaymentAmount variable is less than 500 and
greater than 300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the
requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the
required code segments and arranging them in the correct order.)

DRAG DROP
You create the following JavaScript code:

You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater than 500.
Display the message Approved! If the PaymentAmount variable is less than 300.
Display the message Approved with caution! If the PaymentAmount variable is less than 500 and
greater than 300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the
requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the
required code segments and arranging them in the correct order.)

Answer: See the explanation.

Explanation:

Box 1:

Box 2:

Box 3:

Note:
Use > for greater than comparison.
Use < for less than comparison.



Leave a Reply 7

Your email address will not be published. Required fields are marked *


Joachim

Joachim

This solution will give “Approved with caution” also for 500 and 300! But according to description it should do so only for 299 and less or 501 and greater!?

M

M

Yes, for 500 and 300 it will give “Approved with caution” and this is correct.
If in the description was writen: “… is greater or equal to 500” or “less or equal to 300” it would be wrong answer, but it isn’t so. 🙂
The answer given here is correct!

Damien

Damien

Joachim is correct; the answer is incorrect. HAving said that, no answer is correct. The question is just badly written.

Al

Al

This is a case of conflicting/unclear requirements. The description states “Display the message Denied! if the PaymentAmount variable IS GREATER THAN 500.” This is equivalent to this.PaymentAmount > 500, which is what the answer indicates. Also, the description states “Display the message Approved! if the PaymentAmount variable IS LESS THAN 300.” This is equivalent to this.PaymentAmount < 300, which is what the answer indicates.

Therefore, it is assumed that if the PaymentAmount is 300 to 500 inclusive, the message "Approved with caution! should be displayed. However, the question goes on to state "Display the message Approved with caution! if the PaymentAmount variable is less than 500 and greater than 300." Thus, the requirements exclude the conditional values 500 and 300, leaving the tester to wonder what assumption he should make here.

Aside from wanting to give Microsoft a right hook to the jaw for making a test question of this quality, I would deduce that, since none of the available choices explicitly include the value 300 in a proper conditional statement (in other words, there is no way to force the value 300 to present a message other than "Approved with caution!"), the first statements that specify "greater than 500" and "less than 300" are accurate, and all other values should fall to "Approved with caution!"

Therefore, I believe the answer given is correct. But who knows what Microsoft expects?

iRon

iRon

P > 500 && P < 300 is never true!

Po

Po

@Al is spot on.

Also, is this really the quality of question to expect on an MS exam? This is disappointing.