[General boards] [Fall 2018 courses] [Summer 2018 courses] [Winter 2018 courses] [Older or newer terms]

August 2017 Q6


#1

For the second subquestion " (ii) a.*[12] ", if we think the substring "a2 " matches then we can’t write down “a2bbc1” as an answer at the same time since it doesn’t backtrack? Or we don’t have to worry about backtracking here?

Thanks in advance!


#2

Java cannot backtrack, but you can. So if it asks for all substrings, please write ALL substrings, even if they overlap.

Alternatively, if you are given Java code that matches substrings to regex, your answer would be different. The output of the code would not include overlapping substrings.


#3

where can I find those past exams? Do you have a link??


#4

You can find those past exams on Portal. There is an ‘Old Exam Repository’ under ‘Hot Spots’ on the left hand side of Portal’s home page.