Study Guide CMSC 313 Midterm Exam name________________________________ Closed book, no notes, calculators OK returned with your key _ _ Multiple choice - circle the letter that is your answer. Choose closest if not exact. Short answer, print neat. Not case sensitive. Unreadable by me is wrong. Answer all questions with exactly one choice (zero, two or more is automatically wrong) All questions refer to this course, using NASM assembler, gcc and gdb Comments are ignored. Work very carefully! Study guide, in no particular order: Q1: Convert xxx from decimal to binary Q2: Convert .xxx from decimal to binary Q3: Convert xxx from binary to decimal Q4: Convert .xxx from binary to decimal Q5: Know the commands to compile=nasm, link=gcc and run=./convert programs Q6: Know what “global” and “extern” are used for, e.g. “main” and “printf” Q7: Know the register names and number of bits Q8: Know that “push” decrements ‘esp’ and “pop” increments ‘esp’ Q9: Know that the “.data” segment takes db, dw, dd (8, 16, 32-bit) values Q10: Know that the “.bss” segment takes resb, resw, resd (8, 16, 32-bit) reserve Q11: Know the assembly line format label: op operands ; comment Q12: Understand what instructions do mov, cmp, jmp, je, jg, jl, jz, add, sub Q13: Know what registers are used by mul, imul input eax , memory or constsnt, output lower product eax, upper edx Q14: Know what registers are used by div, idiv dividend upper in edx, lower in eax, quotient in eax, remainder in edx Q15: Know what registers are used by “loop”=ecx, “ret”=eip, “jmp”=eip, “shrd” shrd edx,eax,7 moves lower 7 bits of eax into edx, not changing eax, “shld” shld edx,eax,7 moves upper 7 bits of eax into edx, not changing eax Q16: Be able to write small fragments of “C” code in assembly language add two values, “if” statement, “loop” statement, function call statement, function entry, function return, function passing arguments, int arr[10]; int *p; int n=4; arr[i]=i; Q17: Be able to add, subtract, multiply small binary numbers (ok to convert to decimal)\ Q18: Understand that a program may exit via “C”, the operating system or BIOS Q19: Know that the BIOS starts executing when the computer is turned on and then loads a program from some device. Expect up to 35 questions. Some short answer. Some multiple choice. Some true-false.