ITPEC FE Morning April 2021 Question 5

The table below is a state transition table used for character string validation. In this table, “A” represents the initial state, and “E” represents the failure state. Which of the following is a character string that fails this validation? Here, each character of a string is parsed from the leftmost side, and the symbol “△” represents a blank character.

CharacterBlankNumberSignRadix pointOtherCurrentstateAABCDEBABEDECEBEDEDAEEEE

Explanation

12.2 — after the radix point the table has no transition on a number except to the failure state E.

Trace each string from the initial state A:

  • •12.2: 1 (number) A → B, 2 (number) B → B, . (radix point) B → D, 2 (number) D → E, failure
  • •+0010: + (sign) A → C, 0 C → B, then 0, 1, 0 keep it in B
  • •−1: − (sign) A → C, 1 C → B
  • •9.△: 9 A → B, . B → D, blank D → A

Row D sends a number to E, so this table accepts a number that ends with a radix point but rejects any digit after it.

Answer (c)

Why not others:

  • •(a) +0010 — a sign followed by digits ends in B; leading zeros are just numbers
  • •(b) −1 — a sign then one digit ends in B
  • •(d) 9.△ — the blank after the radix point takes D back to A, not to E

Key rule: To test a string against a state transition table, look up (current state, input class) for each character in turn; the string fails as soon as it reaches the failure state.

Basic Theory · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.