c109f05t2 - CSE 109 Test 2 Wednesday 16 November 2005...

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

View Full Document Right Arrow Icon
CSE 109 Test 2 Wednesday 16 November 2005 <<<<<<<<<<<<<<<<<<<SUGGESTED ANSWERS>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 1. Write the MACH1 code that corresponds to the VE program below. Recall MACH1 operators: read(0), write(1), load(2), store(3), clear(4), add(5), sub(6), mult(7), div(8), addi(9), subi(10), multi(11), divi(12), jumpl(13), jumpg(14), halt(15). x begin read x write 10 if x<=15 goto g write x g: halt end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 0 0 0 3 10 read x 1 2 11 2 1 0 write 10 3 2 10 4 6 12 x-15 5 13 9 6 2 10 7 1 0 write x 8 15 0 halt 9 0 0 x 10 0 10 11 0 15 12 E >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2. Write a program that lists the strings entered on the command line and then states which correspond to an existing file. Thus, if the executable file for the program is stored in a.out and the files a, b, and c exist in the directory, then the command a.out a d p q would display something like The file 'a' exists The file 'd' does not exist The file 'p' does not exist
Background image of page 1

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

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

This note was uploaded on 03/09/2008 for the course CSE 109 taught by Professor Kay during the Spring '08 term at Lehigh University .

Page1 / 2

c109f05t2 - CSE 109 Test 2 Wednesday 16 November 2005...

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

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