INTRODUCTION TO COMPUTERS

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
05/03/2009CA&O Lecture 8,9,10 By Engr. Umbreen sabir1 Computer Arithmetic Computer Engineering Department.
SPIM and MIPS programming
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
MIPS Assembly Language Programming
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
ABNIAC The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found.
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Review Chpt 2 and 3 Five components of a computer Input Output Memory Arithmetic & Logic Unit (ALU) Control Two types of information Data and instruction.
Instruction Set Architecture & Design
The Analytical Engine Module 6 Program Translation.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
10/26/2004Comp 120 Fall October Only 11 to go! Questions? Today Exam Review and Instruction Execution.
Basic C Programming Data Types and Arithmetic Operations 01/30/15.
LAB 9 Simulator Chap 14 REED. Datapath Simulator accompanying the text is a datapath simulator a.k.a. the Knob & Switch Computer developed by Grant Braught.
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
Chap 4 & 5 LC-3 Computer LC-3 Instructions Chap 4 Homework – due Monday October 27 Chap 5 Homework – due Wednesday October 29 Project 2 Designs (Working.
Introduction to Computing Systems (1st Exam). 1. [10] What is the range of decimal integers that can be represented by the following given numbers of.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
CPS Computer Architecture Assignment 4: Multiplication, Division, Floating Point.
©2000 Addison Wesley IEEE 754 single precision floating-point number format.
Assembly & Machine Languages
Introduction to Computers -3rd exam- 授課教授:李錫智. Q1 What will the web page look like if the user type 100 、 20 in the numberbox1 、 numberbox2 respectively?
Machine Instruction Characteristics
1 Programming in Machine Language SCSC 311 Spring 2011.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
Computer Architecture and Organization
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
Assembly Language Friday, Week 5 Monday, Week 6. Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
Introduction to computers 103 學年度 上學期 Solution of Homework_ch12 授課教授:李錫智.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
INTRODUCTION TO COMPUTERS 2nd exam solution. Question 1 Suppose that you are given a group of non-negative numbers and you are asked to arrange them in.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
INTRODUCTION TO COMPUTERS 1st exam solution. Question 1 Please answer the following questions: [5%] Show the page before the user pushes the button. [5%]
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Introduction to Computers - 4 th exam- 授課教授:李錫智. Hints: ADD [DR] [SR1] [SR2] DR SR1 SR2 SUB [DR] [SR1] [SR2] DR.
Chapter 7: Low-Level Programming Languages Chapter 7 Low-Level Programming Languages Page 66 In order to execute instructions on a CPU, those instructions.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
Chapter 6 Programming Adapted from slides provided by McGraw-Hill Companies Inc., modified by professors at University of Wisconsin-Madison.
Programming in Machine Language
Microprocessor Systems Design I
Error Correcting Code.
MIPS Coding Continued.
EPSII 59:006 Spring 2004.
L7 – Assembler Directives
Data Representation – Instructions
The Processor and Machine Language
THE sic mACHINE CSCI/CMPE 3334 David Egle.
Computer Architecture
CSCE Fall 2013 Prof. Jennifer L. Welch.
MIPS Instruction Encoding
MIPS Instruction Encoding
Sequencing, Selection, and Loops in Machine Language
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
CSCI-N 100 Dept. of Computer and Information Science
CSCE Fall 2012 Prof. Jennifer L. Welch.
How Computers Work Part 1 6 February 2008.
It’s All (just) Bits 1) Numbers are bits 2) Text is bits
MIPS Coding Continued.
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

INTRODUCTION TO COMPUTERS 3rd exam solution

Question 1 Assuming that a string is stored as a sequence of ASCII codes corresponding to its individual characters, what string would be represented by the following bit pattern: 110011110110111111110000111100110111010001110111 Note that even-parity check is adopted for each character.

Solution of Q1 Ans: Oopstw 11001111 →O 01101111 → o 11110000 → p

Question 2 Assuming that a string is stored as a sequence of ASCII codes corresponding to its individual characters, and that odd-parity check is adopted for each character. How would the following string: I_love_NSYSU_#1? be represented?

Solution of Q2 Ans: I_love_NSYSU_#1? I→01001001 e→ 11100101 S→11010011 ?→ 10111111 _→11011111 _→ 11011111 U→11010101 l→11101100 N→11001110 _→11011111 o→11101111 S→11010011 #→00100011 v→01110110 Y→11011001 1→00110001 01001001110111111110110011101111011101101110010111011111110011101101001111011 001110100111101010111011111001000110011000110111111

Question 3 The decimal value 105 is represented by the binary number 01101001. Please store this number in 64 bits using the IEEE double- precision floating point format.

Solution of Q3 Ans: 0,10000000101,1010010000000000000000000 000000000000000000000000000

Question 4 Suppose the following 64 bits represent a number in the IEEE double-precision floating point format: 11000000001011000000000000000000000000 00000000000000000000000000 What is the decimal value corresponding to the above bit sequence?

Solution of Q4 Ans: 100000000102=102610 =(-1)X (2) 1026−1023 X(1.11)2 =(-1110)2 =(-14)10

Question 5 Suppose outputArea is a text box defined by <div id="outputArea"></div> Show the web page that would be produced by the following while loop:

Solution of Q5 Ans: 10 7 4 1

Question 6 Suppose outputArea is a text box defined by <div id="outputArea"></div> Show the web page that would be produced by the following while loop:

Solution of Q6 Ans: 2 4 DONE WITH SECOND!

Question 7 Suppose outputArea is a text box defined by <div id="outputArea"></div> Show what would be displayed in outputArea by the following codes:

Solution of Q7 Ans: 因While為無窮迴圈,網頁會無回應。

Question 8 Suppose outputArea is a text box defined by <div id="outputArea"></div> Show what would be displayed in outputArea by the following codes:

Solution of Q8 Ans: num=4

Question 9 Suppose N is a positive integer. Please write JavaScript codes, using while loop, to get the sum of all positive odd integers less than or equal to N.

Solution of Q9 Ans:設inputBox的輸入為N則執行以下 function

Question 10(1/2) Consider the following program:

Question 10(2/2) Please show the page after the user types 5 in the startBox text box and pushes the button.

Solution of Q10

Question 11(1/2) Suppose outputArea is a text box defined by <div id="outputArea"></div> Show what would be displayed in outputArea by the following codes:

Question 11(2/2)

Solution of Q11 Ans: 1 2 4 8 16 Finished!

Question 12(1/2) Consider the following machine language program stored in the memory: Memory address 0: 1000000100001010 Memory address 1: 1000000100101001 Memory address 2: 1000000101001000 Memory address 3: 1010000100110001 Memory address 4: 1010000100111011 Memory address 5: 1000001001100111 Memory address 6: 1111111111111111 Memory address 7: 0000000000000001 Memory address 8: 0000000000000100 Memory address 9: 0000000000000001 Memory address 10: 0000000000000010

Question 12(2/2) Note that instructions are placed at memory addresses 0 to 6, and data are placed at memory addresses 7 to 10. What are the content of memory addresses 7 to 10 after this program is executed?

Solution of Q12(1/2) 1000000100101001→R1=M[9] →R1=110 Ans: 1000000100001010 →RO=M[10] →R0=210 1000000100101001→R1=M[9] →R1=110 1000000101001000→R2=M[8] →R2=410 1010000100110001→R3=R0+R1 →R3=310 1010000100111011→R3=R2+R3 →R3=710 1000001001100111→M[7]=R3 →M[7]=710 1111111111111111 →half

Solution of Q12(2/2) Ans: M[7]=00000000,00000111 M[8]=00000000,00000100 M[9]=00000000,00000001 M[10]=0000000,000000010

Question 13 What sequence of assembly-language instructions corresponds to the instructions at memory addresses 0 to 6 of the machine language program of Problem 12?

Solution of Q13 Ans: LOAD R0 10 LOAD R1 9 LOAD R2 8 ADD R3 R0 R1 STORE 7 R3 HALT

Question 14 Please write an assembly-language program which stores the value 0 in memory address 5.

Solution of Q14 Ans: SUB R0 R0 R0;//把Register 0清成0 STORE 5 R0;//把Register 0的值寫入Mem 5 HALT;