nerdexam
Linux_FoundationLinux_Foundation

LFCS · Question #798

LFCS Question #798: Real Exam Question with Answer & Explanation

The correct answer is C: Match the preceding qualifier zero or one times.. In regular expressions, the ? symbol acts as a quantifier, matching the preceding element zero or one time, making it optional.

Submitted by minji_kr· Apr 18, 2026Essential Commands

Question

What does the ? symbol within regular expressions represent?

Options

  • AMatch the preceding qualifier one or more times.
  • BMatch the preceding qualifier zero or more times.
  • CMatch the preceding qualifier zero or one times.
  • DMatch a literal ? character.

Explanation

In regular expressions, the ? symbol acts as a quantifier, matching the preceding element zero or one time, making it optional.

Common mistakes.

  • A. Matching the preceding qualifier one or more times is represented by the + symbol in regular expressions.
  • B. Matching the preceding qualifier zero or more times is represented by the * symbol in regular expressions.
  • D. To match a literal ? character in a regular expression, it must be escaped with a backslash, i.e., \?.

Concept tested. Regular expression quantifiers (?)

Reference. https://www.gnu.org/software/grep/manual/grep.html#Regular-Expressions

Topics

#Regular Expressions#RegEx#Pattern Matching#Essential Commands

Community Discussion

No community discussion yet for this question.

Full LFCS PracticeBrowse All LFCS Questions