{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

midterm12 - Comp Sci 1MD3 Mid-Term I 2005 Dr Jacques...

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

View Full Document Right Arrow Icon
Comp Sci 1MD3 Mid-Term I 2005 Dr. Jacques Carette Name: Student No.: Duration : 50 minutes This midterm contains 17 questions on 7 pages. This midterm will be marked out of 50. There are 54 total marks available. Answer the questions in the space provided. Do not separate the pages. Make sure that you do not get stuck on one question; use your time wisely. You should spend roughly 1 minute per mark for each question.
Image of page 1

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

View Full Document Right Arrow Icon
1. First, translate the following Pascal code fragment to C, keeping the structure as similar as possible. Then write the smallest C program you can which does the same thing. [6] program funny; const len = 10; var i,j: Integer; L: Array[1..len] of Integer; begin for i := 1 to len do begin L[i] := len-i; end; j := len; repeat begin writeln(L[j]); j := j - 1; end; until j = 0; end. 2
Image of page 2
2. What is the difference between a declaration and an imperative statement (in languages like C and Pascal)? [2] 3. What is the difference between machine language and assembly language? Illustrate your answer with an example. [3] 4. Explain the difference between immediate and direct mode addressing.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern