االختبار النهائي 1434/1435 للفصل الدراسي الثاني للعام الجامعي 225 CS Computer Organizations & Assembly Lang. Prog. 709 :شعبة ساعتان:الزمن 4:المستوى درجة50 :الدرجة العظمي جامعة سلمان بن عبد العزيز كلية اآلداب والعلـوم بوادي الدواسر قســـم علوم الحاسب و المعلومات Note: Answer all questions. Part A: (Knowledge Base Questions) [10*2=20M] 1. Differentiate between computer architecture and computer organization? Answer: Organization is how features are implemented – Control signals, interfaces, memory technology. – e.g. Is there a hardware multiply unit or is it done by repeated addition? Computer organization is a study of a Computer Architecture. E.g. Memory, Registers, RAM, ROM, CPU, ALU, 16 bit/ 32 bit/ 64 bit architecture, what different parts makes a computer, etc. Computer Architecture: Refers to specification of the relationship between different hardware components of a computer system. It defines high and low level of abstractions. At high level CPU is presented and low level its parts like ALU, MU, CU represented 2. Define the following terms a. Compiler: b. Interpreter. c. Assembler. Compiler: This converts high level language program written in English to low level language program written in binary 1’s & 0’s. Interpreter: This converts high level language program to low level language. Difference between compiler & Interpreter Compiler converts whole program one at a time but whereas interpreter converts line by line. Assembler: It is used to translate assembly level language into low level language. Assembly language written in mnemonics. 1|Page P.T.O. 3. Write the full form of the following instructions a. BIU: Bus Interface Unit b. INTR: Interrupt c. JNZ: Jump No Zero d. SF: sign Flag 4. List few addressing modes sets available in Intel X86 PC? Answer: Addressing modes. Input Output Figure 1.3. Memory Single-bus structure. Implied Register Immediate Direct Register indirect Based Indexed Based Indexed Based Indexed with displacement Processor 5. Outline the structure of computer bus? Answer: Computer Bus Structure 6. Name some word processing operations? Answer: Word Processing Operations Crating new document, saving the document, modifications, templates, inserting graphics, several of data, forms reports generations. 2|Page P.T.O. 7. Describe about parameter passing mechanisms using stacks? Answer: In STACK PUSH operation is made to push the contents of registers over the top of the stack. While deleting also the contents of top of stack will be POPed in to the registers. But in assembly languages there is no concept of parameter passing mechanisms however to communicate the input values to be sent or receive will be done by storing in various storage devices. Input: Stacks which receive information Output: This stack produces some information Uses: Which registers to used. 8. State following statements are true or false a. The jump instructions can be divided into conditional and unconditional Jumps. [True] b. Computer bus used to transfer the data between input & output peripherals of [True] Computers. c. The five logical instructions are AND, OR,NOT,EX-OR, NOR [True] d. Queue allows First in First out (F.I.F.O.) process. [True] 9. Discriminate between high and low level languages? Answer: High Level Language: High level languages are written in English language which the user can understand. Where as the low level languages will be written in only binary language which only computer can understand. 10. Write the format for IF ELSE, REPEAT, FOR loop used in assembly language programming? Answer: END_FOR MOV CX,80 ; number of stars to display MOV AH,2 ;Display character function MOV DL,’*’ ;Character to display TOP: INT 21H ;Char to display star LOOP TOP • MOV AH,1 3|Page P.T.O. • REPEAT: • INT 21H CMP AL,’ ‘ JNE REPEAT MOV Dx,0 ;DX counts the chars MOV AH,1;Prepares to read INT 21H ;chars in AL WHILE_: CMP Al,0DH ;CR? JE END_WHILE; yes, exit INC DX ;not CR increment INT 21H JMP ; read a character WHILE_ ; loop back END_WHILE IF_ElSE LOOP – Program to display the AL, BL values MOV AH,2 ;Display to prepare CMP AL,BL ;If AL>=BL JNBE ELSE_ ;NO display char if BL MOV DL,AL JMP DISPLAY;Go to Display MOV DL,BL PART B: Interpersonal Skills & Responsibility [ 4*2.5=10M ] 11. Sketch the neat diagrams for interrupts used by the processor? Answer: 4|Page P.T.O. 12. Illustrate the neat architecture of internal organization of Intel x86 PC? Answer: 13. Show the neat architecture for Slice coding interface with languages such as Supreme language CNN? Answer: 5|Page P.T.O. 14. Evaluate the following addressing modes with a neat architecture a. SUB (BX). [ Register Indirect addressing modes] b. ADD AX [ Direct Addressing mode] Answer: SUB (BX). C.f. indirect addressing EA = (BX) First referencing BX conatains the address of CX which contains the value. The content of CX added with AX and result stores in the AX. AX AX+CX Operand is in memory cell pointed to by contents of register R Large address space (2n) One fewer memory access than indirect addressing ADD AX [ Direct Addressing mode] 6|Page Address field contains address of operand Effective address (EA) = address field (A) e.g. ADD A P.T.O. Add contents of cell A to accumulator Look in memory at address A for operand Single memory reference to access data No additional calculations to work out effective address Limited address space PART C: Cognitive skills [ 4*2.5=10M ] 15. Interpret following instruction and write the result a. CMP AL, BL. [ AL = 5, BL=5]. If AL>=BL NO display char if BL a. CASE AX [AX=4] . Answer: – Program to display the AL, BL values • MOV AH,2 ;Display to prepare • CMP AL,BL ;If AL>=BL • JNBE ELSE_ • MOV DL,AL • JMP DISPLAY;Go to Display • MOV DL,BL ;NO display char if BL 16. Design the architecture for Indirect Addressing modes? Answer: 7|Page P.T.O. 17. Design CALL & RET operations for below given procedure and represent with a neat architecture? Before CALL Offset Address Code Segment MAIN PROC Stack Segment Offset Address 0010 I.P0012 CALL PROC1 Next Instruction 00FC PROC 1 0200 00FE First Instruction 0100 S.P. RET 8|Page P.T.O. After CALL Offset Address Code Segment MAIN PROC Stack Segment Offset Address 0010 I.P0012 CALL PROC1 Next Instruction 00FC PROC 1 00FE 0012 S.P. First Instruction 0200 0100 RET Before RET Offset Address Code Segment MAIN PROC Stack Segment Offset Address 0010 0012 CALL PROC1 Next Instruction 00FC PROC 1 00FE 0012 S.P. First Instruction 0200 0100 RET I.P. 0300 After RET 9|Page P.T.O. Offset Address Code Segment MAIN PROC Stack Segment Offset Address 0010 I.P. 0012 CALL PROC1 Next Instruction 00FC PROC 1 00FE First Instruction 0200 0100 S.P. RET 18. Predict the use of following instruction sets a. SAL & SAR: Shift Arithmetic Left & Shift Arithmetic Right. b. JA & JAE: Jump if Above & Jump Above or Equal. c. CAL & RET: CALL & RETURN of procedures. d. MOVSB & MOVSW: Move Store Byte & Move Store Word. PART D: Communication, Information Technology Numerical skills [ 4*2.5=10M ] 19. Calculate following number base conversions. a. (1F0C)16 = (0011 1111 0000 1100 )8 b. (10101)2+(11001)2=(X)2 10101 21 + 11001 + 25 101110 46 20. If the String 1 =”Hello” & String 2 =”World”, then find then length of both the strings? Answer: String1= Hello String 2 = World Strcat= String1+ String 2 Hello+World= HelloWorld 10 | P a g e P.T.O. 21. If a magnetic disc has 100 cylinders, each containing 10 tracks of 10 sectors, and each sector can contain 128 bytes, what is the maximum capacity of the disk in bytes show with the help of a neat architecture? Answer: Magnetic disc has 100 cylinders. Each containing 10 tracks of 10 sectors. Sector can contain 128 bytes What is the maximum capacity of the disk in bytes? 100 * 10 * 10 * 128 =280000 22. Write the program for implementing the stack applications for reversing a given integer? Answer: ; .MODEL SMALL .STACK 100h .CODE MAIN PROC ; display user prompt MOV AH, 2 ; prepare to display MOV DL, '?' ; char to display INT 21h ; Display '?' ; initialize counter XOR CX,CX ; count = 0 ; input a character MOV AH,1 ; read character function INT 21h ; character into AL ;while char is not a carriage return do while1: cmp al, 0dh ;CR? je ewhile ; yes exit loop ; save character on the stack 11 | P a g e P.T.O. push ax ; push it on stack inc cx ; count = count + 1 ; read a character int 21h jmp while1 ewhile: ; goto new line mov ah,2 mov dl,0dh int 21h mov dl, 0ah int 21h jcxz exit ; CR LF ;exit if no char read ; For count times do TOP: ; pop a character from the stack pop dx ; display it int 21h loop top ;end for exit: MOV AH,4CH INT 21h MAIN END ENDP MAIN Course Instructor 12 | P a g e Supervisor of Department P.T.O. Lecturer: Mujthaba Gulam Muqeeth Signature: ……………. Dr. Saied M. Abd –El –atty Signature: ……………. ------Wish U Best of Luck------ 13 | P a g e P.T.O.