Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computers -1 st exam- 授課教授:李錫智. 1. Given 12 bits, (a).How many different distinct combinations can we get from these bits? Ans: 2 12 =

Similar presentations


Presentation on theme: "Introduction to Computers -1 st exam- 授課教授:李錫智. 1. Given 12 bits, (a).How many different distinct combinations can we get from these bits? Ans: 2 12 ="— Presentation transcript:

1 Introduction to Computers -1 st exam- 授課教授:李錫智

2 1. Given 12 bits, (a).How many different distinct combinations can we get from these bits? Ans: 2 12 = 4096 (b). What is the largest unsigned integer we can get from these bits? Please write it out in decimal representation. Ans: = 4095

3 1.Given 12 bits, (c). What is the smallest unsigned integer we can get from these bits? Please write it out in decimal representation. Ans: 0 (d). John wrote a book consisting of 2097 pages. Each page contains 500 characters. Suppose each character is represented by a byte. John wants to store his book in a 1 MB memory. Is the memory big enough for the book? Why or why not? Ans: 1MB = 2 20 Bytes = 1048576 Bytes 2097*500*1 = 1048500 < 1MB, so it’s enough.

4 1-(e). Mary wants to represent any integer between -16 and 15. How many bits does Mary need to use? Ans: -16~15 There have 32 integers, so it just need 5 bits to repersent them.

5 2. What does Var represent in each case: (a). Var = 10 + 24 + “ is the sum”; (b). Var = 10 + “ is the sum” + 24; (c). Var = “The sum is “ + 10 + 24; (d). Var = “The sum is “ + (10 + 24); (e). Var = “” + 10 + 24 + “ is the sum”; Ans: (a). 34 is the sum ( b). 10 is the sum24 (c). The sum is 1024 (d). The sum is 34 (e). 1024 is the sum

6 3. Suppose the speed of instruction execution is proportional to the clock rate of the CPU. If a program is run by a 1.5GHz CPU in 30 minutes, how soon will it be run by a 2.5GHz CPU? Ans:, X=18

7 4. What does the following web page look like on the screen? How Great is HTML Hello! EE-NSYSU http://www.ee.nsysu.edu.tw Freshmen 200 Senior 20 How wonderful the department is!

8 Ans:

9 5. Write a web page to show the following table on the screen. Ans: Tuesday Chinese 0910-1200 Physics 1410-1700 TuesdayChinese0910-1200 Physics1410-1700

10 6. Create a web page that can be used to compute a student’s overall average for a course. Your page should prompt the user to enter his or her homework score, test 1 score, test 2 score, test 3 score, and test 4 score, and compute and show the overall average on the screen as shown below (Assume the grade weightings for homework is 10%, test 1 20%, test 2 20%, test 3 25%, and test 4 25%.) Homework score: 80 Test 1 score: 40 Test 2 score: 60 Test 3 score: 80 Test 4 score: 100 Overall average: 73

11 Ans: temp=prompt("Enter the homework score: ", ""); hw=parseFloat(temp); temp=prompt("Enter the test1 score: ", ""); t1=parseFloat(temp); temp=prompt("Enter the test2 socre: ", ""); t2=parseFloat(temp); temp=prompt("Enter the test3 score: ", ""); t3=parseFloat(temp); temp=prompt("Enter the test4 socre: ", ""); t4=parseFloat(temp);

12 avg=(hw*0.1)+(t1*0.2)+(t2*0.2)+(t3*0.25)+(t4*0.25); document.write("Homework score: "+hw+" "); document.write("Test 1 score: "+t1+" "); document.write("Test 2 score: "+t2+" "); document.write("Test 3 score: "+t3+" "); document.write("Test 4 score: "+t4+" "); document.write(" "); document.write("Overall average: "+avg);

13 7. What does the following web page look like on the screen (Suppose the user types in 12)? Compute Square Var = prompt(“Enter the input:”, “”); Var = parseFloat(Var); document.write(“ ”); document.write(Var + “*” + Var + “ = “ + Var*Var); document.write(“ ”);

14 Ans:


Download ppt "Introduction to Computers -1 st exam- 授課教授:李錫智. 1. Given 12 bits, (a).How many different distinct combinations can we get from these bits? Ans: 2 12 ="

Similar presentations


Ads by Google