Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 8 MCQs Pattern Matching

ECAP538 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Design of algorithms for pattern matching problems Easy

    What is the main goal of a pattern matching algorithm?

  2. Question 2 of 60 Design of algorithms for pattern matching problems Easy

    In pattern matching, what does the term text usually mean?

  3. Question 3 of 60 Design of algorithms for pattern matching problems Easy

    In pattern matching, what is a pattern?

  4. Question 4 of 60 Design of algorithms for pattern matching problems Easy

    If a text has length and a pattern has length , how many possible starting alignments exist when ?

  5. Question 5 of 60 Design of algorithms for pattern matching problems Easy

    What does preprocessing a pattern mean?

  6. Question 6 of 60 Brute-force algorithm Easy

    How does the brute-force pattern matching algorithm search the text?

  7. Question 7 of 60 Brute-force algorithm Easy

    After a mismatch, how far does the basic brute-force algorithm usually shift the pattern?

  8. Question 8 of 60 Brute-force algorithm Easy

    What is the worst-case time complexity of brute-force pattern matching for text length and pattern length ?

  9. Question 9 of 60 Brute-force algorithm Easy

    What preprocessing is required by the basic brute-force pattern matching algorithm?

  10. Question 10 of 60 Brute-force algorithm Easy

    When does brute-force pattern matching report a match at an alignment?

  11. Question 11 of 60 Knuth-Morris-Pratt algorithm Easy

    What is the main advantage of the Knuth-Morris-Pratt algorithm?

  12. Question 12 of 60 Knuth-Morris-Pratt algorithm Easy

    Which table is commonly constructed during KMP preprocessing?

  13. Question 13 of 60 Knuth-Morris-Pratt algorithm Easy

    What does LPS stand for in the KMP algorithm?

  14. Question 14 of 60 Knuth-Morris-Pratt algorithm Easy

    What is the time complexity of KMP for a text of length and a pattern of length ?

  15. Question 15 of 60 Knuth-Morris-Pratt algorithm Easy

    Which part of the input is used to build the KMP LPS table?

  16. Question 16 of 60 Boyer-Moore algorithm Easy

    In which direction does Boyer-Moore typically compare pattern characters?

  17. Question 17 of 60 Boyer-Moore algorithm Easy

    Which two heuristics are associated with the Boyer-Moore algorithm?

  18. Question 18 of 60 Boyer-Moore algorithm Easy

    What information does the bad-character heuristic use after a mismatch?

  19. Question 19 of 60 Boyer-Moore algorithm Easy

    What information does the good-suffix heuristic use?

  20. Question 20 of 60 Boyer-Moore algorithm Easy

    Why can Boyer-Moore be faster than brute-force matching in practice?

  21. Question 21 of 60 Design of algorithms for pattern matching problems Medium

    A text has length and a pattern has length . How many valid alignments must an exact pattern-matching algorithm potentially examine?

  22. Question 22 of 60 Design of algorithms for pattern matching problems Medium

    Which algorithm is most suitable when a text arrives as a stream and previously read text characters should not be revisited?

  23. Question 23 of 60 Design of algorithms for pattern matching problems Medium

    A case-insensitive matcher converts both the text and pattern to lowercase before searching. Why must the same normalization be applied to both?

  24. Question 24 of 60 Design of algorithms for pattern matching problems Medium

    If every occurrence, including overlapping occurrences, must be reported, what should a correct pattern-matching algorithm do after finding a match?

  25. Question 25 of 60 Brute-force algorithm Medium

    Using brute-force matching on the text AABAACAADAABAABA with pattern AABA, which zero-based starting positions are reported?

  26. Question 26 of 60 Brute-force algorithm Medium

    A brute-force matcher reports all occurrences of pattern AAA in text AAAAAA. How many character comparisons does it perform if it compares the complete pattern at every valid alignment?

  27. Question 27 of 60 Brute-force algorithm Medium

    What is the worst-case running time of brute-force pattern matching for text length and pattern length ?

  28. Question 28 of 60 Brute-force algorithm Medium

    After a mismatch at an alignment, how does the standard brute-force algorithm choose the next alignment?

  29. Question 29 of 60 Knuth-Morris-Pratt algorithm Medium

    What is the LPS array for the pattern ABABAC?

  30. Question 30 of 60 Knuth-Morris-Pratt algorithm Medium

    During KMP matching, five pattern characters have matched, but the next comparison fails. If the LPS value for the fifth matched character is , what happens next?

  31. Question 31 of 60 Knuth-Morris-Pratt algorithm Medium

    What does an LPS value of at pattern index mean?

  32. Question 32 of 60 Knuth-Morris-Pratt algorithm Medium

    KMP searches for ABABCABAB in ABABDABACDABABCABAB. At which zero-based index does the pattern begin?

  33. Question 33 of 60 Knuth-Morris-Pratt algorithm Medium

    After KMP finds AAA in AAAAA, which pattern index should it use next to detect overlapping matches?

  34. Question 34 of 60 Knuth-Morris-Pratt algorithm Medium

    Including preprocessing, what is the asymptotic time complexity of KMP for a text of length and a pattern of length ?

  35. Question 35 of 60 Boyer-Moore algorithm Medium

    In which direction does the Boyer-Moore algorithm normally compare pattern characters at each alignment?

  36. Question 36 of 60 Boyer-Moore algorithm Medium

    For the pattern ALGORITHM, a mismatch occurs at pattern index against text character G. Using the bad-character rule and the rightmost G at pattern index , what shift is selected?

  37. Question 37 of 60 Boyer-Moore algorithm Medium

    A Boyer-Moore mismatch occurs at pattern index , and the mismatched text character does not occur in the pattern. What shift does the bad-character rule permit?

  38. Question 38 of 60 Boyer-Moore algorithm Medium

    What information is used by the good-suffix rule after a mismatch?

  39. Question 39 of 60 Boyer-Moore algorithm Medium

    If the bad-character rule suggests a shift of and the good-suffix rule suggests a shift of , what shift does standard Boyer-Moore apply?

  40. Question 40 of 60 Boyer-Moore algorithm Medium

    Why can Boyer-Moore be especially effective on long patterns over a large alphabet?

  41. Question 41 of 60 Design of algorithms for pattern matching problems Hard

    Let have length , let have length , and form , where occurs in neither string. Using zero-based indices, if the prefix function of satisfies , what is the starting index of the corresponding match in ?

  42. Question 42 of 60 Design of algorithms for pattern matching problems Hard

    For two nonempty strings and of equal length , which test correctly determines in time whether is a cyclic rotation of ?

  43. Question 43 of 60 Design of algorithms for pattern matching problems Hard

    A text arrives in chunks whose boundaries may split an occurrence of the pattern. Which design reports every match in worst-case linear total time without retaining the complete text?

  44. Question 44 of 60 Design of algorithms for pattern matching problems Hard

    Assume and arbitrary unstructured inputs. What is the optimal worst-case asymptotic time for reporting all occurrences of one length- pattern in a length- text?

  45. Question 45 of 60 Design of algorithms for pattern matching problems Hard

    An occurrence is formally defined by for every integer . Under this definition, how should an algorithm handle an empty pattern when the text has length ?

  46. Question 46 of 60 Brute-force algorithm Hard

    A left-to-right brute-force matcher searches for , where . How many character comparisons are performed when every alignment is examined?

  47. Question 47 of 60 Brute-force algorithm Hard

    A left-to-right brute-force algorithm reports every match of in . Counting both successful and failed character tests, how many comparisons does it perform?

  48. Question 48 of 60 Brute-force algorithm Hard

    Suppose text and pattern symbols are independent and uniformly distributed over an alphabet of size . What is the expected number of comparisons made by left-to-right brute force over all alignments?

  49. Question 49 of 60 Brute-force algorithm Hard

    For and , compare left-to-right and right-to-left brute-force matching over all alignments. By what asymptotic factor can right-to-left matching perform more comparisons?

  50. Question 50 of 60 Brute-force algorithm Hard

    After brute force finds a complete match, it shifts the pattern by rather than by one. For which patterns is this optimization guaranteed to preserve every occurrence in every possible text?

  51. Question 51 of 60 Knuth-Morris-Pratt algorithm Hard

    Using the convention that is the length of the longest proper prefix that is also a suffix of , what is the prefix array for ?

  52. Question 52 of 60 Knuth-Morris-Pratt algorithm Hard

    For , KMP is in state , meaning that has matched. If the next text symbol is , what state does KMP enter after all necessary fallback operations?

  53. Question 53 of 60 Knuth-Morris-Pratt algorithm Hard

    KMP searches for . Which result and post-match state are correct when overlapping occurrences must be reported?

  54. Question 54 of 60 Knuth-Morris-Pratt algorithm Hard

    Which amortization fact is sufficient to prove that KMP's text scan takes time even though one text symbol may trigger several fallback operations?

  55. Question 55 of 60 Knuth-Morris-Pratt algorithm Hard

    For , the final prefix value is . Which sequence lists all nonempty proper border lengths from longest to shortest?

  56. Question 56 of 60 Boyer-Moore algorithm Hard

    In Boyer-Moore, let with zero-based indices. A mismatch occurs at pattern index , and the aligned text symbol is . What shift is proposed by the standard bad-character rule?

  57. Question 57 of 60 Boyer-Moore algorithm Hard

    After Boyer-Moore matches the suffix but mismatches at , which action describes the strong good-suffix rule?

  58. Question 58 of 60 Boyer-Moore algorithm Hard

    After a complete match of , what shift does Boyer-Moore's good-suffix preprocessing prescribe to preserve overlapping matches?

  59. Question 59 of 60 Boyer-Moore algorithm Hard

    Consider Boyer-Moore using only the standard bad-character rule, scanning right to left. For and , what is its worst-case comparison count?

  60. Question 60 of 60 Boyer-Moore algorithm Hard

    A bad-character-only Boyer-Moore search has and . At every alignment, the final pattern symbol mismatches a text symbol absent from the pattern, so each shift is . Exactly how many character comparisons occur?

That's unit 8

Answer a few questions and your score shows up here.