0% found this document useful (0 votes)
39 views13 pages

Assembly Past Papers

The document outlines a midterm examination for COMSATS University Islamabad, covering topics in microprocessors and assembly language. It includes questions on computer architecture, assembly language instructions, and programming tasks related to calculations and data manipulation. The exam emphasizes understanding and applying concepts in assembly language and computer organization.

Uploaded by

Haniya Farooq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
39 views13 pages

Assembly Past Papers

The document outlines a midterm examination for COMSATS University Islamabad, covering topics in microprocessors and assembly language. It includes questions on computer architecture, assembly language instructions, and programming tasks related to calculations and data manipulation. The exam emphasizes understanding and applying concepts in assembly language and computer organization.

Uploaded by

Haniya Farooq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
COMSATS University Islamabad, Lahore Campus Midterm Examination - SPRING 2023 Question 02; [CLO-1] [Marks: 1.$*2+2] ran: Explain the ditterence bets een Von Newinann and Harvard architecture machines Neumann Hharvard Hart 2: ty KOKO @ Harvard of a Yon Neumann machine ? Explain on 0. ICL.O-2| [Marks: 5+5] ‘wrrent and voltage across an electrical device ate given as follow over a time interval of 9 Caren 2 [o 1 " Wousw [20 for I : uu J Suppose that the values of current are stored in a byte array named ‘Current’, Values of voltage are stored a byte array named “Voltage” Part 1: Write a program that can calculate values Power and store them in a byte array called "Power" ?Use of MUL instruction not allowed. You should use repeated addition for multiplication (Hint » Power = Voltage * Current) Part 2: ‘We can get an idea of the energy by calculating a scaled value of energy as follow (assuming time interval between samples is small enough) * FE = ¥ Power () COMSATS University Islamabad Lahore Campus Computer Science Department eee [exes fot ee] a LL Fecarstome |S eee TT Read the quero sunwer the questions according to thelr statements. Provide your solutions on euawer boot only Do not use lead pencil in your solutions. Catealatorsand Mébile phones are not ‘Midterm Fall-2023 8 Marks Question 1 CLO: ; Bloom Taxonomy Level: Draw the block diagram of a personal computer showing its main components. Also, briefly describe the role of each component in computer system. Make use of appropriate headings. Question2 ae “LEEW Taxonomy Level: i. Calculate the physical address from the logical address given below. Show relevant working. 345BH:1ACOH yu? ii, Consider the following 8086 CPU assembly language instructions. Provide the physical address (in Hexadecimal) that is produced by the CPU when the last instruction is executed. Mov AX, 1234H (cod Mov Ds, AX Mov DI, @ABCDH Z mov (D1), BL ili. Identify the errors in the following set of 8086 CPU assembly language instructions ae fewrite these instructions after correcting them, F Note: You can correct the incorrect instruction using more than one inypaction Yeded ADD AL, BX SUB BH, 95 e Mov Ds, 34CoH Page lola a "WoV- ’ st, os Mov (st), [8x] Question 3 CLO: <3>; Bloom Taxonomy Level: Consider the following 8086 CPU assembly language code. What will bebe 3 and zero flag after the execution of each instruction? START: SUB AL, AL MOV AL, 34H ADD AL, 34 MOV BX, 34CCH ADD BH, BL MOV AH, AL ADD SI, @H sus ST, AX Al 2: Present you ‘table as shown below. g Marks of carry M188 Page2ota( [7 +15 +3 Marks] Question 1: m which determines the number of characters in a string A which do not exist in another Write a pre stnng B You are required to create a macro named inputString which takes input in a string from a) keyboard. b) Define at least one procedure named missing_In_B in order to mect the given requirements. ¢) Test your program in the main procedure. Sample Output: Enter String A:- MUGHEES Enter String B:. AHMAD Missing Elements in B: U,G,E, E, S Lan 2 Seren, Question? lWnte a recursive procedure reenrse witch takes # mingle tn sorren Where, recurse(0) = 3, 1) +9, fora > and recurse(n) = 5 * recurse(n- a) You are required to write the assembly code for the given recursive function. b) Test the recursive procedure in the main procedure. Sample Output: Enter Number: 1 Recurse (1): 24 eget argument ment yrinte the cree om ad Question 1. {00 eee ~ Se Write a sor 1. Declare the given var section + > Your code should include comments ag starement. This is MANDATORY, Without this, your p Jf plagiarized. 1c assembly code for the given decision structures. tialize with same values provid bles using type db and do i inst almost all lines explaining, the por aper will be considered hot of variable section after calculation at the end of 3. Do attach the screen s! solution. Show variables in signed representation. cae int A=2; int B=5; int C=4; into He if(A Cl] A6 and it is even, then print “even 2 se if n>6 and it is odd, then print “odd! Create at leastone procedure named IntRep is order to mect piven TEQuire mens yy {wEZjx sas yyeks xh ssents the interval, ie. [syd COMSATS University Islamabad, Lahore Campus — SPRING 2022 © Mid Term O Terminal Examination feos rt ficroprocessor and Assembly Language [eourse Code: Jesc321 ee 32,1) [Course Instnctois: os. Sheeza Zaheer ae Bscs ester. he wich: [FA20 Becti AB |Date= [5/10/2022 [Time Allowed: [1 li and 30 Minutes Maximum Marks: 0 itudent’s Name: Reg. No. | important Ins wns / ite your answers only in the space provided against each question, and write legibly to get any credit For rough work you can use extra sheets. Do attach any extra sheet you use with this question paper. All questions are compulsory. Manage time properly, and try to attempt easy problems first. Assume only assembly language is considered wherever applicable. Do show all intermediate steps while solving a question. ‘These instructions must be followed strictly. Failure to do so may result in serious grade loss. You are not allowed to: (© Talk to anyone once the exam begins. (© Leave the exam room and then return 0 Think in the air or see here and there. © You can use calculator. Cell phones not allowed. © This is a close-book and close-notes exam. You can’t share any resource. Best of Luck!!! Question No, | Obtained Marks | Maximum Marks 1 10 2 10 3 2 q 3 | 3 3 6 10 Total 0 Question O1: Identify the contents of register being used and SP after execution of each of the following instructions. Suppose that AX = 11C2h, BX = 123Ah, and SP=OOFEh [CLO-4] —— [Marks: 2*5 = 10] Assume that all instructions are executing in a sequence (i.e. dependent on previous register values) Instructions | Register Contents (in| SP : hex) A. | PUSH AX B. | PUSHBX Cc. POP CX D. | PusH cx E. | POPAX Question 02: Solve following instructions to give the destination register and CF values. Assume these initial values for each part: AX = 123Ch, BX = 040Dh and CF=0, Note: All instructions are NOT being executed in a sequence. {CLO-4] [Marks: 2*5 = 10) No. | Instructions _ | Destination Contents (in hexadecimal) CF A. | SARAX,2 B. | ROR BX, 2 c. |RCLAL,1 D. | ROL BX,2 FE. | XOR BX, 80h ‘Question 3: Show the physical address of a memory location given by 30FFh:1A10h [CLO-2]___[Marks: 2] Question 4: Show the signed and unsigned decimal representation for B2ACh? [CLO-1] [Marks: 3] Question 5: Explain basie steps involved if processor first wants to read data from main memory at a given address and then write some data to main memory at a given address. Explain with the help of some example. [CLO-1] (Marks: 5] ‘Question 6: Show execution of instructions stored from address 0300 to 0303 according to Instruction Fetch & Execute cycle for the given instruction set and memory contents. Consider a hypothetical machine which can process 16-bits instruction and data. Each instruction can be further divided into 4 bit op code and 12 bits address reference ‘The intemal registers it uses for instruction processing are PC, IR and AC. [CLO-1] (Marks: 10) Op code: 0001b Load AC from memory Op code: 0010 Store AC to memory Op code: 0101b Add AC to memory Memory CPU Registers Address | Contents 0300 | 1440 Instructions pc [0300 0301 | S441 0302__[ 5442 ac [0000 0303__| 2443 m®_ [0000 0430__[0002h 0441 | 03h a 0442 [000Ih 0443 | 0000h

You might also like