CSE340Fall2009Test2

CSE340Fall2009Test2 - Arizona State University Ira A....

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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; [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! Assume arithmetic can only be done on values of the same type and that 1 and 0 are integers!...
View Full Document

This note was uploaded on 02/27/2011 for the course CSE 340 taught by Professor Farley,t during the Fall '08 term at ASU.

Page1 / 5

CSE340Fall2009Test2 - Arizona State University Ira A....

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online