Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

In the text "abcabdabc", how many positions match the pattern "a?c" where '?' matches any single character?

  1. A. 3
  2. B. 2
  3. C. 1
  4. D. 0

Correct answer: B. 2

A wildcard match checks each position character by character, treating '?' as a free slot. Exact matching of the literal text "a?c" (last option) finds none, which is a different answer.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic