100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 307 – Midterm Exam 2 Version 1 Stony Brook University CSE 307 $8.99   Add to cart

Exam (elaborations)

CSE 307 – Midterm Exam 2 Version 1 Stony Brook University CSE 307

 1 view  0 purchase
  • Course
  • Institution

CSE 307 – Midterm Exam 2 Version 1 Sample Name: First Last Student ID # _________________________________ Question # Points Available Points Earned 1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 Total: 100 Directions: You have 80 minutes to complete this exam. Write all answe...

[Show more]

Preview 2 out of 14  pages

  • April 3, 2023
  • 14
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
avatar-seller
CSE 307 – Midterm Exam 2 Version 1 Sample

Name: First Last

Student ID # _________________________________

Question # Points Points Earned
Available
1 10
2 10
3 10
4 10
5 10
6 10
7 10
8 10
9 10
10 10
Total: 100

Directions: You have 80 minutes to complete this exam. Write all answers neatly in the space provided.
Please do not separate exam sheets.

Individual closed book exam. You are not allowed to use the textbook, lecture notes, cheat sheets or anything
else beside your brain during the exam.




CSE 307 –Midterm Exam 2 1

, Question 1
Write an attribute grammar to recognize the language L = anbncn (e.g., abc, aabbcc,
aaabbbccc,…) that associates a Boolean attribute ok with the root R of the parse
tree, such that R.ok=true if and only if the string corresponding to the tree is in L.

G -> As Bs Cs > G.ok := (As.val == Bs.val /\ Bs.val == Cs.val)
As1 -> a As2 > As1.val := As2.val + 1
As -> epsilon > As.val := 0
Bs1 -> b Bs2 > Bs1.val := Bs2.val + 1
Bs -> epsilon > Bs.val := 0
Cs1 -> c Cs2 > Cs1.val := Cs2.val + 1
Cs -> epsilon > Cs.val := 0

Show the attributed trees for 2 strings:

aabbcc

aabcc




CSE 307 –Midterm Exam 2 2

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller beckyfawcet. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $8.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67096 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$8.99
  • (0)
  Add to cart