Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Abstraction, Polymorphism, and OOP Review for CS3723 Exam in ML, C++, and Java, Exams of Programming Languages

The review questions for the final exam of cs3723, covering concepts and exercises related to abstraction, polymorphism, and object-oriented programming in ml, c++, and java. Topics include definitions and examples of abstraction, data abstraction, function abstraction, modules, higher-order functions, ml abstype, object-oriented abstraction, c++ namespaces, operator overloading, virtual functions, public and protected/private inheritance, design goals of c++ and java, and subtype polymorphism. Exercises involve writing bnf, lambda calculus reduction, language translation, scheme/ml programming, and applying type inference.

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-hte
koofers-user-hte 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS3723 Final Exam Review Questions
1. Concepts
(a) All the review questions for midterm1 and midterm2.
(b) What is an abstraction? What is a data abtraction? What is a
function abstraction? What is a module? Give two examples for
each concept in ML/C++/Java.
(c) Give two fundamental differences between the different support of
abstractions. What is the interface and implementation of each ab-
straction?
i. the higher-order function implementation of abstractions and the
ML abstype implementations
ii. the ML abstype abstraction and the object oriented abstraction
in C++/Java?
iii. ML datatype/abstype and C++ namespace
iv. C++ namespaces and C++ classes
(d) How does C++ support ad-hoc, subtype, and parametric polymor-
phism respectively? Briefly explain each.
(e) What are the fundamental properties of an object-oriented abstrac-
tion? (give 4) How does C++ or Java support each property?
(f) Why can’t we consider the ML datatype/abstype as an object-oriented
abstraction? Why can’t we consider the C++ namespace an OO ab-
straction?
(g) What is different between the virtual and non-virtual functions in
C++? What is different between the non-virtual and static functions
in C++? What is different between operator overloading and virtual
functions in C++?
(h) What is different between the public and protected/private inheri-
tance in C++? What is diferent between subtyping and implemen-
tation inheritance?
(i) What is the design goal of C++ and Java respectively? How does
each language support their goals? (give at least 3 examples).
(j) In order to support subtype polymorphism, what is the requirement
for the layout of a derived class? Why is multiple inheritance diffi-
cult to implement (compared to single inheritance? How does C++
resolve naming conflict in multiple inheritance?
1
pf2

Partial preview of the text

Download Abstraction, Polymorphism, and OOP Review for CS3723 Exam in ML, C++, and Java and more Exams Programming Languages in PDF only on Docsity!

CS3723 Final Exam Review Questions

  1. Concepts

(a) All the review questions for midterm1 and midterm2. (b) What is an abstraction? What is a data abtraction? What is a function abstraction? What is a module? Give two examples for each concept in ML/C++/Java. (c) Give two fundamental differences between the different support of abstractions. What is the interface and implementation of each ab- straction? i. the higher-order function implementation of abstractions and the ML abstype implementations ii. the ML abstype abstraction and the object oriented abstraction in C++/Java? iii. ML datatype/abstype and C++ namespace iv. C++ namespaces and C++ classes (d) How does C++ support ad-hoc, subtype, and parametric polymor- phism respectively? Briefly explain each. (e) What are the fundamental properties of an object-oriented abstrac- tion? (give 4) How does C++ or Java support each property? (f) Why can’t we consider the ML datatype/abstype as an object-oriented abstraction? Why can’t we consider the C++ namespace an OO ab- straction? (g) What is different between the virtual and non-virtual functions in C++? What is different between the non-virtual and static functions in C++? What is different between operator overloading and virtual functions in C++? (h) What is different between the public and protected/private inheri- tance in C++? What is diferent between subtyping and implemen- tation inheritance? (i) What is the design goal of C++ and Java respectively? How does each language support their goals? (give at least 3 examples). (j) In order to support subtype polymorphism, what is the requirement for the layout of a derived class? Why is multiple inheritance diffi- cult to implement (compared to single inheritance? How does C++ resolve naming conflict in multiple inheritance?

(k) What are the components inside The Java virtual machine? What does each component do? (l) What need to be checked at runtime to make Java type safe? (m) What are the steps that JVM takes to invoke a dynamic method in Java at the first time? What does it do the second time the method is invoked? (n) What makes the Java implementation of classes different from that of C++? What makes the implementation of Java interfaces different from Java classes? (o) Enumerate five differences between C++ and Java. Briefly explain why the decisions were made differently. Specifically, for each of the OO property, give a difference in the lanauge design and explain why.

  1. Exercises

(a) Write BNF. Draw parse trees and ASTs for given inputs. Rewrite BNF to be non-ambiguous. (b) Lambda calculus reduction. (c) Language translation between Scheme, C, and Lambda calculus. (d) Scheme/ML programming. (e) Translate Scheme code to ML. (f) Apply type inference to determine the types of variables in ML code. (g) Draw the snapshot of runtime stack for ML code. (h) Convert tail recursive functions to loops in ML (i) Convert ML code to continuation passing style. (j) List the sequence occured events when a ML code with exceptions is evaluated. (k) Translate ML datatype/abstype to C++/Java classes (l) Draw the layout of C++ classes/objects