70-483 question 176 discussion

answered

You are creating a console application named App1.
App1 will validate user input for order entries.
You are developing the following code segment (line numbers are included for reference
only):


You need to complete the code segment.
The solution must ensure that prices are positive and have two decimal places.
Which code should you insert at line 03?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Created 4 months, 1 week ago by kalmusr

kalmusr

^(-)? doesn't ensure that the price is positive. My choice is answer C

ehcomel

Correct Answer is C. IsMatch is not a static method, and price must be positive to be valid.

thava

No there is static method available

xDJR1875

Validated in VS. C is the correct answer

leehong

No, C is not the correct answer because isMatch takes up 2 parameters as indicated at the bottom of the green description.

lyndaToko

Correct answer is C, see "https://msdn.microsoft.com/de-de/library/3y21t6y4(v=vs.110).aspx" with example

sunefred

Only C ensures that the value is positive, but none of them ensures that prices have (exactly) two digits. Remember ? means _zero_ or one times. "^\d+(\.\d\d){1}$" would work with answer C.