ITPEC IP April 2019 Question 29
When character strings are searched by using wildcard characters with expression “*A*.te??”, which of the following lists all and only the character strings that match the search condition among the character strings I through IV? Here, the wildcard character “?” represents any one (1) character and “*” represents a character string that consists of zero (0) or more of any characters.
Explanation
I only — A.text is the only string with an A somewhere before a literal ".te" that is followed by exactly two characters.
Read *A*.te?? piece by piece: any characters, an A, any characters, the literal characters .te, then exactly two characters. So a matching string ends in .te plus two characters and has an A before that .te.
Answer (a)
Why not others:
- •(b) I, II — treats
.texas enough, but each?must match exactly one character, so II is one character short - •(c) II, III, IV and (d) III, IV — III and IV contain "te", but not right after the dot; the dot in the pattern is a literal character and must stand directly before te
Key rule: * matches any number of characters including none, ? exactly one; every other character, the dot included, must appear literally and in that order.
Software · 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 IP past-paper collection or Report an issue.