[go: up one dir, main page]

0% found this document useful (0 votes)
40 views3 pages

MARIE Programming Exercises

The document presents 10 problems or programming exercises in MARIE. These include calculating sums, subtractions, and multiplications of numbers entered by the user, writing counters that count down, analyzing fragments of MARIE assembly code, and questions about the features of the MARIE language and types of programming languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views3 pages

MARIE Programming Exercises

The document presents 10 problems or programming exercises in MARIE. These include calculating sums, subtractions, and multiplications of numbers entered by the user, writing counters that count down, analyzing fragments of MARIE assembly code, and questions about the features of the MARIE language and types of programming languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Perform the following programs in MARIE:

1) The user must enter two positive integer numbers, X and Y, and the subtraction X-Y must be calculated.
showing the result on screen.

2) Ask for a value X and write a counter down to 1, that is, print X, X-1, … 2, 1.

3) Ask for a value X and write a countdown until reaching 0, that is, print X, X-1, … 2, 1, 0.

4) The user must enter two positive integers, called X and Y. It must be performed
the multiplication X by Y, store the result in a variable called Z and display the result
on screen.

5) Knowing that the instruction 'clear' is coded as 'A' and that its function is to set the value of
AC to 0, and having the following program:

and the following program,

Address Label Instruction


100 Start, Load A
101 Add B
102 Store C
103 Clear
104 Output
105 Add C
106 Store B
107 Halt
108 A Hex 0003
109 B, Dec 5
10A C Hex 000b

a) Write the code in machine language (expressed in hexadecimal)


b) What is the final value of the AC register?
c) What values will A, B, and C have at the end of the program?

6) In a certain high-level language, a line of code contains the instruction Y = X. Having in


It states that the variables X and Y are stored in memory, write the sequence of operations.
which are produced in the registers in the form of Register Transfer Notation (RTN).
7) Based on the following fragment of MARIE assembly code. Complete with
appropriate instructions the 5 lines for the program to fulfill its purpose. The program allows
the user to enter integer values.

For each value entered, the program returns the sum of all values.
introduced so far.

The user inputs values as long as they do not enter a 0. If the user enters a number
negative, the absolute value will be used for the sum.
8) Marie's instruction: Jump out
a. performs an unconditional jump to the address 800H.
b. perform a jump of the following instruction if AC has a value = 0
c. make an unconditional jump to the instruction that is labeled with exit
d. performs an unconditional jump to the halt instruction

9) In MARIE, which register stores the result of executing an arithmetic operation?


how to add X? Where X is a memory location that stores an integer value.
a. AC
b. MBR
c. MAR
d. IR

10) Programming languages (C++, Java, Visual Basic,...) are types of language
machine
b. assembler
high level
d. of specific application

You might also like