MATH 241 Midterm: MATH 241 UPenn 241Fall 02 Exam

14 views23 pages
31 Jan 2019
School
Department
Course
Professor

Document Summary

Solutions: true or false (10 points) a. In ocaml, the binding between a variable and its value can never be changed. b. In ocaml, if x is a variable of any type, some x == some x will always return true. c. In java, it is good practice, when overriding the equals method from object, to override the hashcode method as well. d. In java, the default implementation of equality in the object class uses reference equality for mutable objects and structural equality for immutable objects. e. Java"s subtype polymorphism is very similar to ocaml"s parametric polymorphism, whereas java"s generics are a different thing with no direct analog in ocaml. f. In java, the dynamic class of the result of an expression will always be the same as or a subtype of its static type, even if casts are used. g.