read carefully Which DOES NOT evaluate.
Note :- Question is the option which doesn't evaluate Z
correctly then the answer is A
But, if you see which option doesn't evaluate Z then the Answer is
C
c) Operation :-
It calculates the value . But, never stores the value in Z.
a) Operation :-
It evaluates the value of Z in-correctly.As, it never considers the value of X and without any check it adds the value of ebx i.e Y to eax .
read carefully Which DOES NOT evaluate. Consider the following arithmetic operations in C: int X-20; int Y-20; int Z-2*(X+Y) which assembly code(0x86) does not evaluate value for Z correctly? mov...
pls write correct answers asap.... Note- You are athempting question 9 out of 10 Match the following: 1) Quick Sort A) Divide and conquer programming 2) Task Scheduling B) Greedy programming 3) Merge Sort C) Dynamic programming 4) Prim's D) Not stable a) 1-B2-A 3-C4-D b) 1-D 2-C3-A 4-B c) 1-D 2-C 3-B 4-A d) 1-C 2-D 3-A 4-B Ansre Note - You are attermpring qpestion out of 10 Odd man out: e Topological sort Algorithm DFS Algorithm Binary search...
And also when recursive(5). Consider the following funtion int recursive(int n) f The assembly code equivalent of the above function is: recursive push %ebp mov %esp,%ebp push %ebx sub $0x14,%esp cmpl $0x1,0x8(%ebp) je L1 cmpl $0x2,0x8(%ebp) jne L2 L1 mov 0x8 (%ebp),%eax jmp L3 L2 mov 0x8 (%ebp),%eax sub $0x1,%eax mov %eax, (%esp call recursive mov %eax,%ebx mov ox8(%ebp),%eax sub $0x2,%eax mov %eax, (%esp call recursive imul %ebx,%eax L3 add $0x14,%esp pop %ebx pop %ebp ret
1. Assume that you are given values in eax, ebx, ecx. Write an assembly code that does the following: eax = (ecx + edx ) - (eax + ebx) 2. Write a piece of code that copies the number inside al to ch. Example: Assume that Initially eax = 0x15DBCB19. At the end of your code ecx = 0x00001900. Your code must be as efficient as possible. 3. You are given eax = 0x5. Write one line of code in...
Exercise 3 [Conditionals] Consider the following assembly code for a function F3 with two integer arguments: F3: push EBP mov EBP, ESP mov EDX, DWORD PTR [ebp+12] mov EAX, DWORD PTR [ebp+8] cmp EAX, EDX # setup stack #if # goto .L1 #EAX- mov EAX, EDX # ignore for now mov DWORD PTR [EBP-4], EAX mov ESP, EBP pop EBE ret # cleanup stack To the right of each instruction, show the contents of the register whose value changes as...
avr assembly please 3) Write an assembly program that is algorithmically equivalent to the following C++ code. Treat the variable y as a short int (16 bits) 1 int y; 2 for (int x = 2; x <= 20; x = x + 2) { 3 ¡f (x < 18) { 4 5 у 24 6 else f 7 8 9 3) Write an assembly program that is algorithmically equivalent to the following C++ code. Treat the variable y as...
QUESTION 62 Consider the following code: void Pancake(int x, int& y, int z); void Waffle(int& x, int& y); int Doughnut(int y, int z); int main( ) { int a = 1; int b = 2; int c = 3; int d = 4; Pancake(a, b, c); Waffle(b, c); Pancake(d, c, b); d = Doughnut(b, a); return 0; } void Pancake(int x, int& y, int z) { y += 3; ...
The following problem concerns the following, low-quality code: void foo(int x) { int a[3]; char buf[1]; a[1] = x; a[2] = 0xA0B1C2D3; gets(buf); printf("a[0] = 0x%x, a[2] = 0x%x, buf = %s\n", a[0], a[2], buf); } In a program containing this code, procedure foo has the following disassembled form on an x86/64 machine: 000000000040057d <foo>: 40057d: push %rbp 40057e: mov %rsp,%rbp 400581: sub $0x30,%rsp 400585: mov %edi,-0x24(%rbp) 400588: mov -0x24(%rbp),%eax 40058b: mov %eax,-0xc(%rbp) 40058e: movl $0xa0b1c2d3,-0x8(%rbp) 400595: lea -0x11(%rbp),%rax 400599:...
5. Consider the following C code: int main() int x = 1; switch (x) case 1: i=1; case 2: i=5; return 0; Based on this code, answer the following: (a) Convert the above C code to MIPS assembly. (b) The condition you are testing is met at Case 1. You do not want the Case 2 to be tested. Add appropriate instructions in MIPS for this implementation. (c) If int x is any integer other than 1 or 2, you...
What is the value of y after the following code is executed? int x = 20, y = 30; do { int z; z = 3 * ( y
Translate the following piece of code into MIPS assembly. int x, y; int A=100, B=15, C=19, D=21; main(){ x = A + B; y = C + D; if (x > y) swap(&x,&y); } int swap (int *arg1,int *arg2) { int temp; temp = *arg1; *arg1 = *arg2; *arg2 = temp; }