Download presentation
1
INTRODUCTION TO COMPUTERS
3rd exam solution
2
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: Note that even-parity check is adopted for each character.
3
Solution of Q1 Ans: Oopstw 11001111 →O 01101111 → o 11110000 → p
4
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?
5
Solution of Q2 Ans: I_love_NSYSU_#1?
I→ e→ S→ ?→ _→ _→ U→ l→ N→ _→ o→ S→ #→ v→ Y→ →
6
Question 3 The decimal value 105 is represented by the binary number Please store this number in 64 bits using the IEEE double- precision floating point format.
7
Solution of Q3 Ans: 0, ,
8
Question 4 Suppose the following 64 bits represent a number in the IEEE double-precision floating point format: What is the decimal value corresponding to the above bit sequence?
9
Solution of Q4 Ans: 100000000102=102610 =(-1)X (2) 1026−1023 X(1.11)2
=(-1110)2 =(-14)10
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:
11
Solution of Q5 Ans: 10 7 4 1
12
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:
13
Solution of Q6 Ans: 2 4 DONE WITH SECOND!
14
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:
15
Solution of Q7 Ans: 因While為無窮迴圈,網頁會無回應。
16
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:
17
Solution of Q8 Ans: num=4
18
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.
19
Solution of Q9 Ans:設inputBox的輸入為N則執行以下 function
20
Question 10(1/2) Consider the following program:
21
Question 10(2/2) Please show the page after the user types 5 in the startBox text box and pushes the button.
22
Solution of Q10
23
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:
24
Question 11(2/2)
25
Solution of Q11 Ans: 1 2 4 8 16 Finished!
26
Question 12(1/2) Consider the following machine language program stored in the memory: Memory address 0: Memory address 1: Memory address 2: Memory address 3: Memory address 4: Memory address 5: Memory address 6: Memory address 7: Memory address 8: Memory address 9: Memory address 10:
27
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?
28
Solution of Q12(1/2) 1000000100101001→R1=M[9] →R1=110
Ans: →RO=M[10] →R0=210 →R1=M[9] →R1=110 →R2=M[8] →R2=410 →R3=R0+R1 →R3=310 →R3=R2+R3 →R3=710 →M[7]=R3 →M[7]=710 →half
29
Solution of Q12(2/2) Ans: M[7]= , M[8]= , M[9]= , M[10]= ,
30
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?
31
Solution of Q13 Ans: LOAD R0 10 LOAD R1 9 LOAD R2 8 ADD R3 R0 R1
STORE 7 R3 HALT
32
Question 14 Please write an assembly-language program which stores the value 0 in memory address 5.
33
Solution of Q14 Ans: SUB R0 R0 R0;//把Register 0清成0
STORE 5 R0;//把Register 0的值寫入Mem 5 HALT;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.