Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING/C SC/PSYC 438/538 Midterm 10/11. Instructions It is recommended that you attempt all questions –Submit your answers in one file by to

Similar presentations


Presentation on theme: "LING/C SC/PSYC 438/538 Midterm 10/11. Instructions It is recommended that you attempt all questions –Submit your answers in one file by to"— Presentation transcript:

1 LING/C SC/PSYC 438/538 Midterm 10/11

2 Instructions It is recommended that you attempt all questions –Submit your answers in one file by email to sandiway@email.arizona.edu –Write your name and 438 or 538 as the first line of the file –You have until the end of the class (1:45pm) –average time: 12.5 to 15 mins per question for 538 –You may consult the lecture slides and other resources on the web –You may not consult with one another (or anyone else) –However, you may ask me questions about the questions

3 Grading 438 –Answer 4 Questions correctly for an A –More than 4 = A* 538 –Answer 5 Questions correctly for an A –Answer all 6 correctly for A*

4 Question 1 Download the file wsj.txt (~ 50K lines) Write a Perl program that finds all lines containing any possible form of the idiom take... advantage of... How many are there in wsj.txt? Submit your program Submit the lines returned by your program

5 Question 2 Give a regular grammar in Prolog notation that accepts strings with an odd number of a’s (#a’s =1,3,5,...) followed by an even number of b’s (#b’s = 2,4,6,...) i.e. a n b m n odd, m even Examples: –aaabb –abbbb –aaaaabb –*aabb –*aaab Submit your program Show it works on the given examples

6 Question 3 Using an extra argument with regular grammar rules in Prolog DCG format, give a grammar that accepts L = a n b m n even (n=2,4,6,...) m is the odd number closest to but not exceeding n/2 Note: L is a non-regular language Examples: –aab –aaaab –*aaaabb –aaaaaabbb –*aaaaaabbbb –aaaaaaaabbb –*aaaaaaaabbbb –*aaaaaaaabbbbb Show your program works on the above examples

7 Question 4 Give a regexp for the language described in Question 2

8 Question 5 Give a regexp for the complement of the following FSA 1 2 4 35 ba ab a b a,b a b

9 Question 6 Give the deterministic FSA corresponding to:


Download ppt "LING/C SC/PSYC 438/538 Midterm 10/11. Instructions It is recommended that you attempt all questions –Submit your answers in one file by to"

Similar presentations


Ads by Google