{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CSE340Fall2009Test2

# CSE340Fall2009Test2 - Arizona State University Ira A Fulton...

This preview shows pages 1–5. Sign up to view the full content.

Arizona State University Ira A. Fulton College of Engineering Computer Science and Engineering CSE 340 Fall 2009 TEST 2 State any assumptions you make . TOTAL 70 Write legibly . If I cannot read what you write, I cannot grade it! [10 points] Consider the following declarations. Which variables are structurally equivalent? Which variables are name equivalent (explicitly declared name)? typedef struct A { Answer int i; int j; } ; typedef struct B { int k; int l; } ; struct { int i; int j; } z, z1; A x, x1; B y, y1;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
[15 points] What is the output of the following program if parameters are passed by: value? name? reference? int a[2], i; int p(int a, int b) { int i; i = a; a = b; b = i+1; } Void main() { a[0] = 1; a[1] = 2; i = 0; p(a[i],a[i]) p rint(“%d %d %d\ n”, i, a[0], a[1] ); }
[10 points] How does Hindley-Milner type checking infers the type of the following declaration? fun fac(g, m, n) = if n = 0 then m else g( fac(g,n-1),m,n) Assume arithmetic can only be done on values of the same type and that 1 and 0 are integers!

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
[10 points] Consider the declaration struct A{
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

CSE340Fall2009Test2 - Arizona State University Ira A Fulton...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online