

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: PROGRAM LANG CONCEPTS; Subject: COMPUTER PROGRAMMING; University: University of Florida; Term: Spring 2008;
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


COP4020 Spring 2008 Sample Exam Solutions 1. proc T(); proc Ta(); Ta(); N = 1; Tc(); while NT = ‘,’ { while NT = ‘aug’ { Read(‘,’); Read (‘aug’; ) Ta(); Tc (); N ++; BuildTree (‘aug’, 2); } } if N > 1 BuildTree(‘tau’, N); end; end; proc Tc(); B(); if NT = ‘->’ { Read (‘->’); Tc (); Read (‘|’); Tc (); BuildTree (‘->’, 3); } end; 2. (1) No, the two lists do not unify. Unifying them would require first that [Y,a] unify with [a,X]. They do unify, but Y is bound to a, and so is X. Next, Y would have to unify with b, which it can't, because it is already bound to a. Changing the first list to [ [Y, a], a, c] would solve the problem. (2) Uncle(X,Y) :- Parent(W,X), Parent(Z,W), Parent(Z,Y)