COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
An e-commerce site asks users to input a shipping address. A United States address consists of the street name and number, the city, the two-character state/territory abbreviation, and the ZIP code. Once the information has been entered, it must be validated. To eliminate some of the validation, the designers decide to ask users to choose the two-character state/territory code from a pull-down menu containing all legal codes. What additional validation must be performed on the state/territory code?
A
The state/territory code must be validated against the ZIP code to make sure they form a valid pair.
B
The state/territory code must be validated against a database of shipping costs to determine the user’s total cost.
C
No additional validation is needed since only state/territory codes from the pull-down menu can be entered.
D
The state/territory code must be validated against a pattern-matching algorithm to make sure it contains the correct characters.
Explanation: 

Detailed explanation-1: -Example (in the U.S.): Mr John Smith. 132, My Street, Kingston, New York 12401.

Detailed explanation-2: -Addresses (ZIP code present) USPS abbreviations are used for both the street address and state, and there is no punctuation in the lines for the street address or city, state and ZIP code. Write to Paul and Mary Moore, 1313 E Main St, Portage MI 49024-2001.

Detailed explanation-3: -Envelopes: Write your address (the “return” or “sender” address) in the top left corner (and put “USA” on the last line). Write the delivery address in the center (near the bottom). Put the destination country’s name (in English) on the last line.

Detailed explanation-4: -Place the recipient’s name on the first line. On the second line, write the building number and street name. Include the city, state and ZIP code on the final line.

There is 1 question to complete.