Question

4) Suppose the memory of a computer is as follows: Address 0x100 Address 0x101 Address 0x102...

4) Suppose the memory of a computer is as follows:

Address 0x100

Address 0x101

Address 0x102

Address 0x103

12

34

56

78

What integer value is this on a big-endian computer?

5) Use a stack to evaluate the postfix expression: 6 3 * 5 3 - /

Homework Answers

Answer #1

In big-endian machines, The Most Significant byte of the data is put in the lowest address

the most significat byte of given data is 78, so it goes to the lowest address, the next 3 bytes are placed in order in next 3 bytes.

So in a big-endian machine the values are placed as

Address 0x100

Address 0x101

Address 0x102

Address 0x103

78

56

34

12

2.

The expression is 6 3 * 5 3 - /

to do this we scan the expression from left to right and if the current element is a number we push it to stack , if it is an operator we pop 2 elements from stack, operate those 2 element with current operation and then push the result back to stack

first element is 6, a number so push it to stack. Stack is |6|

2nd is also a number so push it to stack.Stack is |6 3|

3rd is *,an operator to we pop 3 and 6 and push 6*3=18 to stack. Stack is |18|

next is 5, so we push it to stack. Stack is |18 5|

next we push 3 to stack. Stack is |18 5 3|

next is - so we pop 3 and 5 and store 5-3=2 to stack.Stack is |18 2|

next is / so we pop 18 and 2 and push 18/2=9 to stack .Stack is |9|

so the expression calculates to 9

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
3) Assume a computer has 32-bit integers. Show how the value 0xCAFEBABE would be stored sequentially...
3) Assume a computer has 32-bit integers. Show how the value 0xCAFEBABE would be stored sequentially in memory, starting at address 0x100, on both a big-endian machine and a little-endian machine, assuming that each address holds one byte. Address Big Endian Little Endian 0x100 0x101 0x102 0x103
in assembly 1. Real mode allows access to memory below which memory address? 2. Under real...
in assembly 1. Real mode allows access to memory below which memory address? 2. Under real and protected mode, the far jump modifies the current instruction address by changing which register or registers? 3. Under real and protected mode, the near jump modifies the current instruction address by changing which register or registers? 4. Under real mode, briefly explain what happens when the PUSH BX instruction executes. Make sure to show where BH and BL are stored. Assume that initially...
The memory for a certain computer consists of 4 Mbytes of RAM. This is to be...
The memory for a certain computer consists of 4 Mbytes of RAM. This is to be made up from 256 K by 4 bits RAM chips. (a) What is the number of RAM chips are needed in total? (b) What is the number of address bits that must be fed to an address decoder for this system?
in Java In this exercise, you'll write a Java version of the infix-to-postfix conversion algorithm. These...
in Java In this exercise, you'll write a Java version of the infix-to-postfix conversion algorithm. These same mechanisms can be used as a part of writing a simple compiler. Write class InfixToPostfixConverter co convert an ordinary infix arithmetic expression (assume a valid expression is entered) with single-digit integers (to make things easier) such as (6 + 2) • 5 - 8 / 4 to a postfix expression. The postfix version (no parentheses are needed) of this infix expression is 6...
(For Python) Evaluating Postfix Arithmetic Expressions. In this project you are to implement a Postfix Expression...
(For Python) Evaluating Postfix Arithmetic Expressions. In this project you are to implement a Postfix Expression Evaluator as described in section 7-3b of the book. The program should ask the user for a string that contains a Postfix Expression. It should then use the string's split function to create a list with each token in the expression stored as items in the list. Now, using either the stack classes from 7.2 or using the simulated stack functionality available in a...
Use C++ Your program should expect as input from (possibly re-directed) stdin a series of space-...
Use C++ Your program should expect as input from (possibly re-directed) stdin a series of space- separated strings. If you read a1 (no space) this is the name of the variable a1 and not "a" followed by "1". Similarly, if you read "bb 12", this is a variable "bb" followed by the number "12" and not "b" ,"b", "12" or "bb", "1" ,"2". Your program should convert all Infix expressions to Postfix expressions, including expressions that contain variable names. The...
We are given the following CSP problem. The variables and domains are as follows. A: {4,...
We are given the following CSP problem. The variables and domains are as follows. A: {4, 5, 6, 7, 8} B: {10, 20, 30, 40} C: {2, 3, 4} D: {28, 43, 56, 77, 94, 114} The constraints are: A + C is odd. A + D is a square of an integer. B + D < 60. Solve this problem using the following heuristics and algorithms. • Use backtracking search. • For variable ordering, use MRV. If there are...
Microprocessor 8086 material. Choose the correct answer. 1-A normal memory write bus cycle of 8086Mp takes...
Microprocessor 8086 material. Choose the correct answer. 1-A normal memory write bus cycle of 8086Mp takes _ clock cycles. * 4 5 6 2 3 2-Reading a word from the memory in one memory read cycle is possible if the required memory address is: * in the stack odd even in the data segment 3-To test bit 0 and bit 4 of (AX) in one step using TEST instruction, the destination and source must be: * AX, 10h AX, 12h...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.    ...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.     In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x1fff0000. Loop: sw $t1, 4($s0)        addi $t1, $t1, -1    sll $t1, $t1, 2        bne $t1, $s5, Exit    addi $s0, $s0, 4          j Loop Exit: … 2.     Find the MIPS...
1. The memory units that follow are specified by the number of words times the number...
1. The memory units that follow are specified by the number of words times the number of bits per word. How many address lines and input/output data lines are needed in each case? (a) 8K X 16 (b) 2G X 8 (c) 16M X 32 (d) 256K X 64 2. Give the number of bytes stored in each memory unit in question 1. 3. Word number 563 decimal in the memory shown in Fig. 7.3 (see Mano-Ch7.pdf) contains the binary...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT