Embercode
✕
Character Arrays and StringsQuick quiz

CSV and search

8 questions. Covers Naive substring search.

Questions 1 to 5 of 8

  1. 1. What does this code print? ``cpp auto a = csvSplit(R"(x,"a,b",,y)"); std::cout << a.size() << '\n'; for (const auto& s : a) std::cout << '<' << s << '>'; ``
  2. 2. What does csvSplit from the lesson return for the line "Ada,""Lovelace""",36?
  3. 3. What does this code print? ``cpp int comparisons = 0; int at = naiveFind("abcabcab", "cab", comparisons); std::cout << "index: " << at << ", comparisons: " << comparisons; ``
  4. 4. A text has 50 letters and the pattern has 8 letters. In the worst case, how many character comparisons does naiveFind make? Use the formula (n - m + 1) * m.

    Type a number.

  5. 5. In the worst case, which expression gives the number of character comparisons that naiveFind makes for a text of length n and a pattern of length m?

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.