Midterm2_2020-21

pdf

School

Western University *

*We aren’t endorsed by this school

Course

2208A

Subject

Computer Science

Date

Jan 9, 2024

Type

pdf

Pages

9

Uploaded by JusticeStar19063

Report
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 1/9 0.5/ 0.5 Points 4.0/ 4.0 Points 2nd midterm test Return to Assessment List Part 1 of 13 - 0.5/ 0.5 Points Question 1 of 13 Hold up to the camera your single EMPTY page scrap paper (letter size 8.5” x 11”). Show both sides of your EMPTY scrap paper. Did you show the EMPTY scrap paper? A. Yes B. No Answer Key: A Part 2 of 13 - 4.0/ 4.0 Points Question 2 of 13 Consider the following program, AREA my_First_Example, CODE, READONLY ENTRY p B p ppp SPACE 3 qqq SPACE 3 rrr DCB 0xFF sss DCD 0xFF END What will be the addresses (in hexadecimal) of ppp, qqq, rrr and sss ? the address of memory location ppp = 0x 4 , the address of memory location qqq = 0x 7 , COMPSCI 2208A 001 FW20 Online Tests, Quizzes & Assignments Online Tests, Quizzes & Assignments
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 2/9 1.0/ 1.0 Points 0.0/ 2.0 Points the address of memory location rrr = 0x A , and the address of memory location sss = 0x C . Answer Key: 4|00000004, 7|00000007, A|0000000A, C|0000000C Part 3 of 13 - 1.0/ 1.0 Points Question 3 of 13 LDR R1 , =0x12345678 ” is an ARM assembly pseudo instruction at location 0x00000034 . The assembler stored the literal value “ 0x12345678 ” at the literal pool and converted the instruction to “ LDR R1 ,[PC,#0x0038] ”. What is the address (in hexadecimal) used to store the value “ 0x12345678 ”? 0x 74 Answer Key: 74|00000074 Part 4 of 13 - 0.0/ 2.0 Points Question 4 of 13 Consider the following ARM assembly segment of code: A NOP B NOP C NOP D NOP ADR R1 , D E NOP F NOP The ARM assembler translates the ADR pseudo instruction to a real ARM instruction. What is this translated instruction? Write your answer (i.e., the instruction) in TWO parts, the Op-Code in a box and ALL operands in another box. The Op-Code is: ADD The operands are: r1, PC, #-12 . Answer Key: SUB, R1,PC,#0x000000C| R1,PC,#0xC| R1,PC,#12|R1,R15,#0x000000C| R1,R15,#0xC|
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 3/9 5.0/ 5.0 Points 5.0/ 5.0 Points 3.0/ 3.0 Points R1,R15,#12 Part 5 of 13 - 5.0/ 5.0 Points Question 5 of 13 After executing the following ARM instructions LDR r0 ,=-0xFFFFF123 NEGS r1 ,r0 What will be the values of the NZC flags, as well as the values of r0 and r1 (in hexadecimal)? N = 1 , Z = 0 , C = 0 , r0 = 0x 00000EDD , and r1 = 0x FFFFF123 . Answer Key: 1, 0, 0, EDD|00000EDD, FFFFF123 Part 6 of 13 - 5.0/ 5.0 Points Question 6 of 13 After executing the following ARM instructions LDR r0 ,=0xCA ADDS r1 ,r0,r0,ROR#12 What will be the values of the NZC flags, as well as the values of r0 and r1 (in hexadecimal)? N = 0 , Z = 0 , C = 0 , r0 = 0x 000000CA , and r1 = 0x 0CA000CA . Answer Key: 0, 0, 0, CA|000000CA, CA000CA|0CA000CA Part 7 of 13 - 3.0/ 3.0 Points Question 7 of 13 Consider the following ARM assembly program AREA prog, CODE, READONLY MOV R0 , #0 MOV R1 , #4 for ADD R0 , R0, R1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 4/9 SUBS R1 , R1, #1 BNE for halt B halt END What is the value of R0 and R1 after executing the above program (until reaching the B halt ” instruction)? R0 = 0x A , and R1 = 0x 0 . How many times is the " ADD R0 , R0, R1" instruction executed? 4 Answer Key: A|0000000A, 0|00000000, 4 Part 8 of 13 - 1.5/ 2.0 Points Question 8 of 13
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 5/9 1.5/ 2.0 Points Encode ONLY the branching ARM assembly instruction in the following program segment. Write your answer as eight hexadecimal digits, each digit in a box. A NOP B NOP C NOP BVC A D NOP E NOP F NOP G NOP 7 A F F F F E C Answer Key: 7, A, F, F, F, F, F, B Part 9 of 13 - 2.0/ 2.0 Points
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 6/9 2.0/ 2.0 Points Question 9 of 13 Decode the following ARM machine language code to ARM assembly instruction. 0x306BA97C Write your answer (i.e., the instruction) in TWO parts, the Op-Code in a box and ALL operands in another box. The Op-Code is: RSBCC The operands are: r10, r11, r12, ROR r9 . Answer Key: RSBCC, r10,r11,r12,ROR r9 Part 10 of 13 - 2.0/ 2.0 Points
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 7/9 2.0/ 2.0 Points 1.0/ 2.0 Points 3.0/ 3.0 Points Question 10 of 13 Encode ONLY the literal part in " ADC r0 ,r1,#0x3380 " ARM assembly instruction, i.e., give ONLY the value of the alignment and the 8-bit immediate value . Give your answer in hexadecimal. The alignment value in a single hexadecimal digit is 0x D . The 8-bit immediate value in two hexadecimal digits is 0x CE . Answer Key: D, CE Part 11 of 13 - 1.0/ 2.0 Points Question 11 of 13 Assume that r1 is a pointer to an integer array, where each array element is 32-bits. This array starts from r1[0]. Also, assume that register r2 is used as an index for this array. Write one ARM instruction that loads the value of the element number r2 of this array to r0 , and to update the value of r1 to make it a point to the value that is just loaded, if and only if the negative flag is 1. Write your answer (i.e., the instruction) in TWO parts, the Op-Code in a box and ALL operands in another box. The Op-Code is: LDRMI The operands are: r0, [r1, r2]! Answer Key: LDRMI, r0,[r1,r2, LSL#2]!|r0,[r1,r2, LSL#0x2]! Part 12 of 13 - 3.0/ 3.0 Points Question 12 of 13
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 8/9 0.5/ 0.5 Points What are the values of r0, r2, and r3 (in hexadecimal) after executing the following program? AREA prog, CODE, READWRITE ENTRY LDR r0 ,=AAA2 LDR r2 ,[r0],#-4 LDR r3 ,[r0,#-4]! Loop B Loop AAA0 DCB 0x10, 0x20, 0x30, 0x40 AAA1 DCB 0x50, 0x60, 0x70, 0x80 AAA2 DCB 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0xFF END r0 = 0x 10 , r2 = 0x 90A0B0C0 , and r3 = 0x 10203040 . Answer Key: 10|00000010, 90A0B0C0, 10203040 Part 13 of 13 - 0.5/ 0.5 Points Question 13 of 13 Hold up to the camera ALL of your FILLED scrap papers. Show both sides of each FILLED scrap paper. Did you show BOTH SIDES of ALL of the FILLED scrap papers? A. Yes B. No Answer Key: A Gateway Help & Support Western University
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 9/9 OWL is the learning management system of Western University. It is a customized version of Sakai. Copyright 2003-2020 The Apereo Foundation. All rights reserved. OWL - OWL - Sakai 11.3-owl6 - Server azuki30
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help