Systems
Question 7
Question 7 options:
Consider the code fragment below. What value is pushed onto the stack by the callinstruction?
0x400627 <main+55> callq 0x4004a0 <printf@plt> x 0x40062c <main+60> mov $0x400745,%edi
Question 4 (2 points)
Given the array declaration below, which one of the following is equivalent to a[4]?
int a[10];
Question 4 options:
*( a + 4 ) |
|
*( a + 1 ) |
|
*a + 1 |
|
*(a + 16) |
|
none of these |
Question 5 (2 points)
Suppose we have declared an array: short a[10], and that a is stored in %rax and i is stored in %rdx.
Which one of the following instructions would set a[i] to be 8?
Question 5 options:
movw $8, 2(%rax, %rdx,2) |
|
movw $8, (%rax, %rdx, 2) |
|
movw $8, 2(%rax, %rdx) |
|
movw $8, (%rax, %rdx, 4) |
|
none of these |
Hide hint for Question 7 |
|
think hexadecimal |
Systems Question 7 Question 7 options: Consider the code fragment below. What value is pushed onto...
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:...
Assembly language 64 bit please ! An example file for set up ==========+ ;| Data Segment BEGINS Here | ;+======================================================================+ segment .data ;Code this expression: sum = num1+num2 num1 dq 0 ;left operand of the addition operation num2 dq 0 ;right operand of the addition operation sum dq 0 ;will hold the computed Sum value RetVal dq 0 ;Integer value RETURNED by function calls ;can be ignored or used as determined by the programmer ;Message string prompting for the keyboard...
Write the C Code for the Intel assembley below. Note: Don't copy and paste anything from github because it won't be the right answer. .file "mystery.c" .comm num,1600,32 .text .globl add .type add, @function add: .LFB2: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movq %rdi, -8(%rbp) movq %rsi, -16(%rbp) movq -16(%rbp), %rax movq -8(%rbp), %rdx addq %rdx, %rax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE2: .size add, .-add .globl dothething .type dothething, @function...
Question 4 (2 points) Consider the C statements below. Assume x has been assigned a value. int mask = 0xFF000000; y = x ^ mask; Which one of the following best describes the value computed for variable y? Question 4 options: y contains the most significant byte of x complemented, with the rest of the bits unchanged y contains the most significant byte of x unchanged, with the rest of the bits 0 y contains the most significant byte of...
Quiz Question 1 (1 point) Saved The maximum value for an int is: Question 1 options: 2147483647 65535 32767 9223372036854775804 Question 2 (1 point) A float has ____ decimal places of accuracy. Question 2 options: 15 none 7 3 Question 3 (1 point) It is a good practice to compare floats and doubles with ==. Question 3 options: True False Question 4 (1 point) Strings are reference data types. Question 4 options: True False Question 5 (1 point) Value data...
Question 31 -Given the following code fragment, what value is contained in myArr[O]? const int ARRAYSIZE 3 double() myArr new double [ARRAYSIZE] myArr [0]1.1 myArr [1]2.2; myArr [2] myArr [0] myArr[1 O3.3 2.2 O 1.1 0 Question 32 - Given the following code fragment, what is displayed in IblResult? const int ARRAYSIZE 3 double(] myArr - new double [ARRAYSIZE] myArr [0] - 1.1 myArr [1] 2.2 lblResult.Text - Convert.Tostring (myArr (01) 3.3 O 2.2 1.1 0 Question 33 - Given...
Question 8 Consider the tree below. What is the value stored in the parent node of the node containing 30? Question 8 options: 10 11 14 40 None of the above Question 9 Consider the tree below. How many descendants does the root have? Question 9 options: 0 2 4 8 Question 10 Consider the tree below. What is the depth of the tree? Question 10 options: 2 3 4 8 9 Question 11 Consider the tree below. How many...
Questions 9 and 10 are based on the code fragment below: if ((currentYear % 4 0) && (currentYear 100 !-0)) 11 (current Year 400 0)) daysInMonth [0]-31; days InMonth [1)-29; daysInMonth [2] -31; daysInMonth [3]-30; days InMonth [4]-31; daysInMonth [5]-30; daysInMonth [6]-31; days InMonth [7]-31; daysInMonth [8] -30; daysInMonth [9] -31; days InMonth [10]-30; daysInMonth [11)-31; ) else daysInMonth [0]-31; days InMonth [1]-28 daysInMonth [2] -31; daysInMonth [3] -30; days InMonth [4] -31 daysInMonth [5] -30; daysInMonth [6] -31; days...
Question 1 What is the value of x after the following int x = 5; x++; x++; x+=x++; A)14 B)10 C)13 D)15 Question 2 The last line in value returning function (before the }) should contain the word return. True False Question 3 This contains three parts: Void or Data Type the name optional parameter list A)Menu System B)Function Header C)Switch Question 4 What is a variable? A)a pointer B)a place in memory to hold data C)int D)a computer programming...
QUESTION 10 What will be the output of following code snippet? char *str; str = "%s"; printf(str, "S"); A. S B. Garbage Value C. Compile-time Error D. Run-time Error 4 points QUESTION 11 What will be the output of the following statements assuming that the array begins at the memory address location 7002 and size of an integer is 4 bytes? int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; printf("%d,...