- Study guides, Class notes & Summaries
Looking for the best study guides, study notes and summaries about ? On this page you'll find 3 study documents about .
3 results
Exam (elaborations)
Department of Computer ScienceMidterm Examination 3 Computer Science 312 Functional and Logic Programming
Department of Computer ScienceMidterm Examination 3 
 
Computer Science 312 Functional and Logic Programming 
 
Question 1 [12 marks] 
Consider the program 
zipWith _ _ [] = [] zipWith _ [] _ = [] 
zipWith f (h1:t1) (h2:t2) = f h1 h2 : zipWith f t1 t2 
(a)	[4 marks] What is the inferred type of zipWith? 
(b)	[4 marks] What is the value of 
zipWith (*) [1,2,3,4] [5,4,3,2,1] 
[You do not need to show your reasoning if you get the correct answer, but if you want partial marks, 
you need to explain...
Exam (elaborations)
Department of Computer Science Midterm Examination 1 Computer Science 312 Functional and Logic Programming
PopularDepartment of Computer Science 
Midterm Examination 1 
 
Computer Science 312 Functional and Logic Programming 
 
Question 1 [8 marks] 
Consider the program 
dw _ [] = [] 
dw p (h:t) 
| p h	= dw p t 
| otherwise = (h:t) 
(a)	[4 marks] What is the inferred type of dw? (Use the notation that will be accepted by Haskell) 
 
(b)	[4 marks] What is the value of 
dw (/= ’?’) "CS312? Real fun?" 
Note that /= is “not equals” (defined in the Eq class). 
[You do not need to show your reasoning ...
Exam (elaborations)
Department of Computer Science Midterm Examination 2 Computer Science 312 Functional and Logic Programming
Question 1 [12 marks] 
 
Department of Computer Science Midterm Examination 2 
 
Computer Science 312 Functional and Logic Programming 
 
 
(a)	[4 marks] In the semantic web, a URI is a “Uniform Resource Identifier”. What is a URI? Why are URIs useful? 
(b)	[4 marks] Explain what “Triples are universal representations of relations” means, and why it is true. 
(c)	[4 marks] Suppose you are told the triples using prop(Subject, Verb, Object): 
prop(bread,’rdfs:domain’,’
This entails...