Difficulty: Easy
Correct Answer: * matches any sequence of zero or more characters, and ? matches exactly one character in that position
Explanation:
Introduction / Context:
Command line interfaces and file managers often allow the use of wildcard characters to match more than one file name at once. In Windows, the most common wildcard symbols are the asterisk and the question mark. Knowing what each of these wildcards means is fundamental for tasks such as copying, deleting, or listing groups of files efficiently. This question tests your understanding of how these symbols work in Windows file patterns.
Given Data / Assumptions:
Concept / Approach:
In Windows patterns, the asterisk represents any sequence of zero or more characters. That means it can match an empty string, a single character, or many characters. For example, *.txt matches all files that end in .txt. The question mark, on the other hand, matches exactly one character in the position where it appears in the pattern. For example, file?.doc matches file1.doc or fileA.doc but not file10.doc, because that last example has two extra characters where only one is allowed.
Step-by-Step Solution:
Step 1: Recall that * can stand for any sequence of characters, including none, in Windows file name patterns.Step 2: Recall that ? stands for exactly one character in the position where the question mark appears.Step 3: Consider examples such as *.jpg, which matches all JPEG files, and report?.txt, which matches report1.txt but not report10.txt.Step 4: Compare these definitions with the options presented in the question.Step 5: Select the option that states exactly these meanings for the two wildcard symbols.
Verification / Alternative check:
You can verify the behaviour by running simple commands in a Windows command prompt. For instance, create files named test.txt, test1.txt, and testAB.txt. The pattern test*.txt will match all of them, because * covers zero or more characters. The pattern test?.txt will match only test1.txt, because only that file has exactly one extra character between test and .txt. These observations confirm the roles of * and ? in file patterns.
Why Other Options Are Wrong:
Option B reverses the meanings of the two symbols, which does not match Windows behaviour. Option C is incorrect because Windows wildcards do not distinguish digits and letters in that way; they operate on characters in general. Option D is wrong because in file selection contexts, * and ? are indeed treated as wildcards and not as literal characters.
Common Pitfalls:
Common mistakes include forgetting that * can match zero characters, which means patterns like *.txt will also match .txt if such a file exists. Another pitfall is trying to use these wildcards as if they were full regular expressions, which they are not. Windows patterns are simpler and do not support complex constructs like character classes or quantifiers. Remembering the simple roles of * and ? is usually enough for most file operations.
Final Answer:
In Windows file patterns, * matches any sequence of zero or more characters, and ? matches exactly one character in that position, which is option A.
Discussion & Comments