prac8-spr10

prac8-spr10 - c. int count(Set s) { } count(new...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC330 Spring 2010 Practice Problems 8 1. Operational semantics Use operational semantics to determine the values of the following OCaml codes: a. 1 b. + 3 7 c. + 1 ( + 2 3 ) d. (fun x = 4 ) 5 e. (fun x = + x 6 ) 7 f. (fun x = (fun y = + y x)) 8 9 2. Programming languages a. Describe the difference between ad-hoc and parametric polymorphism. b. Describe 2 differences between HTML and XML. c. Describe the difference between query languages and programming languages. 3. Polymorphism Consider the following Java classes: class A { public void a( ) { … } } class B extends A { public void b( ) { … } } class C extends B { public void c( ) { … }} Explain why the following code is or is not legal a. int count(Set<A> s) { … } … count(new Set<A>); b. int count(Set<A> s) { … } … count(new Set<B>);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c. int count(Set s) { } count(new Set<A>); d. int count(Set<?> s) { } count(new Set<A>); e. int count(Set<? extends A> s) { } count(new Set<B>); f. int count(Set<? extends B> s) { } count(new Set<A>); g. int count(Set<? extends B> s) { for (A x : s) x.a( ); } h. int count(Set<? extends B> s) { for (C x : s) x.c( ); } i. int count(Set<? super B> s) { for (A x : s) x.a( ); } j. int count(Set<? super B> s) { for (C x : s) x.c( ); } 4. Markup languages a. Creating your own XML tags, write an XML document that organizes the following information: 1-hour test on Spanish Monday in Jimnez worth 15%. 1-hour test on Computers Tuesday in CSIC worth 10%. 30-minute test on Computers Friday in AVW worth 5%....
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 330 taught by Professor Staff during the Fall '08 term at Maryland.

Ask a homework question - tutors are online