Given the code for Question 3.
.begin
while: load b
compare a
jumpeq done
out b
decrement a
jump while
done: halt
a: .data 0
b: .data 10
.end
What line of code would you change to have it work as intended?
Select one:
jump while
while: load b
done: halt
jumpeq done
a: .data 0
decrement a
compare a
out b
b: .data 10
I would change the line ' decrement a ' to 'decrement b' to make the code work. Decrementing a from zero would give a negative number. Also that would not have any effect in the loop conditions. whereas decrementing b will make the loop run till b=0.
Given the code for Question 3. .begin while: load b compare a jumpeq done out b...
QUESTION 10 Given the instruction set for MARIE: Instruction Opcode Instruction Opcode Instruction JnSX Load X Store X Add X SubtX Input Output | 8 19 A Instruction Halt Skipcond (00 for AC<0,01 for AC=0, 10 for AC>0) Jump X Clear Addl X Jumpl x write down the machine instruction (binary string of length 16) corresponding to "Add 005". Do not add spaces.
Op-code Operand Description 1 RXY LOAD register R from cell XY 2 RXY LOAD register R with value XY 3 RXY STORE register R in cell XY 4 0RS MOVE R to S 5 RST ADD S and T into R (2’s comp.) 6 RST ADD S and T into R (floating pt.) 7 RST OR S and T into R 8 RST AND S and T into R 9 RST XOR S and T into R A R0X ROTATE...
Not yet answered Marked out of 1.00 Flag question Question text What is the value of the following Python expression? not(True and False) Select one: True False Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following Python program. fin = open('words.txt') for line in fin: word = line.strip() print(word) What does the program loop over? Select one: a. Lines in a file b. Lines in a list c. Words in a dictionary d....
edef extract_num(s, begin, end): Given string s, and "begin" is the index of the first of one or more digits, and "end" is the index one beyond the last digit. Parse out and return the int value of the number, accounting for possible 's' and 'a', Return -1 if the number should be skipped. >>> extract_nun('xx123$, 2, 5) 321 >>> # add Doctests here 29 def. parse line(s): Given a string s, parse the ints out of it and return...
Hello, I've been working on this for a while and I can't figure the rest out. Need asap if anyone can help. maxBSt,minBST,isBST, and inOrder package lab7; import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; public class TreeExercise { /* * Construct BST from preorder traversal */ public static Node<Integer> consBSTfromPreOrder(int[] arr, int start, int end) { if(start > end) return null; Node<Integer> root = new Node<Integer>(arr[start],...
Question 1 Not yet answered Marked out of 1.00 Not flaggedFlag question Question text The statements inside of a Python loop are known as the ____ of the loop. Select one: a. body b. expression c. counter d. block Question 2 Not yet answered Marked out of 1.00 Not flaggedFlag question Question text The Python 3 program below prints the number 3. s = "Python3" print(s[len(s)]) Select one: True False Question 3 Not yet answered Marked out of 1.00 Not...
Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next iteration of a loop? Select one: a. do b. break c. switch d. continue e. while Clear my choice Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following? Select one: a. a statement b. a class...
In this assignment, try to understand the assembly code instructions addv1.sim1. In #addv1.sim1 using only one acc register, addition of two numbers have been done. For the assignment, you need to write assembly code, whose corresponding c code is as followings. int a = 0; int b = 5; int c = 10; a = (b*2)^c + c; exit(0); Only operations that are allowed is to use add, load, store, shift, and xor. addv1.sim1(txt file) #addv1.sim1 Add contents twice 005,...
Table 1: Load 26% Compare 14% Shift left and shift right 4% Store 9% Load immediate 4% AND 3% Add 14% Conditional branch 17% OR 5% Sub 0% Jump 1% Other register-register instructions (XOR, NOT, etc.) 1% Multiply 0% Call 1% Divide 0% Return 1% Using the data in Table 1, which of the following two enhancements will result in faster execution of the five benchmark programs that are described by the instruction frequency data? Assume that the computer used...
Debug the following java code so that it will have given out put at the bottom. Make sure to fix all syntax and logical errors. import java.util.Scanner; public class Graphs { // draws 5 histograms public void drawHistograms() Scanner input = new Scanner( System.in ); int number1 = 0; // first number int number2 = 0; // second number int number3 = 0; // third number int number4 = 0; // fourth number int number5 = 0; // fifth number...