计算机专外Week4-Exercises

Week 4 > Software 1 Exercises > Problems


Q1: The CPU in the computer directly “runs” a sequence of what type of instruction?

Java Code
Machine Code - correct
C++ Code
Javascript Code

Q2: After a CPU runs an instruction, what does it most often do next?

Erases the instruction from RAM
Runs the previous instruction in the sequence of instructions
Runs the next instruction in the sequence of instructions - correct
Writes the instruction to disk

Q3: Suppose you double click Firefox.exe on a computer to run it. Which one of the following best describes what happens?

The operating system copies the instructions for Firefox from disk to RAM and then the CPU runs the instructions in RAM. - correct
The instructions for Firefox are translated into Javascript and then run by the browser.
The operating system copies the instructions for Firefox into RAM and then the RAM runs the instructions.
The operating system copies the instructions for Firefox from RAM to disk and then deletes the copy in RAM.


Week 4 > Software 2 Exercises > Problems


Q1: Which one of the following best describe what a C++ compiler does?

Translates machine code into Javascript code.
Translates C++ source code into Javascript code.
Translates machine code into C++ code.
Translates C++ source code into machine code. - correct

Q2: The CPU’s machine code has only simple, low-level instructions. A computer language (such as Javascript) adds high-level features, such as the for-loop we have used. Which one of the following is a low-level instruction?

Loop over all the pixels in in image.
Append two strings together.
Print a string to the screen.
Add two numbers together. - correct

Q3: Firefox is an open source program, so anyone can get access to the source code. Which one of the following is something that is possible because Firefox is open source?

Someone can run Firefox and note with a stopwatch about how quickly it can draw different web pages.
Anyone is free to run the compiler to produce and distribute their own version of Firefox.exe. - correct
Someone can double click Firefox.exe to run it on their computer.
A $5 fee is required to use Firefox.


Week 4 > Computer Network Exercises > Problems


Q1: Suppose a computer wants to send a packet on ethernet, as shown in lecture. The computer first waits for what?

Waits for its scheduled time in the predetermined transmission schedule.
Waits for the recipient computer to signal that it is ready.
Waits for the central ethernet controller to signal that transmission is now permitted.
Waits for the ethernet wire to be quiet. Waits for the ethernet wire to be quiet. - correct

Q2: Suppose we are using the same checksum scheme as in lecture: add up all the bytes, and take just the last two digits of the sum. What is the checksum of the following bytes: 101, 202, 103, 100, 210, 120

36

Q3: What is the purpose of a packet checksum?

Duplicate bytes to RAM to speed up the sending process on ethernet.
Compress sent bytes so they take up less space.
Encrypt bytes on the wire so they cannot be read by others.
Allow the recipient to detect if bytes received were corrupted in transit. - correct


Week 4 > Network 2 Exercises > Problems


Q1: Which one of the following is not a valid IP address?

42.257.99.11 - correct
11.250.3.4
45.67.212.100
1.2.3.4

Q2:Which one of the following is generally not true about routers?

Routers get packets from computers, forward them on
Routers check the central internet-map which shows routes for all packets - correct
Routers continuously monitor the status of their connections
Routers forward each packet one hop closer to its final destination

Q3: What does ping do?

Sends a “who is there” packet, getting back a detailed description of the recipient
Notifies the local router that the computer does not want any more packets
Notifies the local router that the computer wants more packets
Sends a “are you there” packet to a computer, getting back a “yes” packet - correct


Week 4 > Table Data Exercises > Problems


Q1: Write code to print the row for the name “Atticus”.

table = new SimpleTable("baby-2010.csv");
for (row: table) {
  // your code here
  if (row.getField("name") == "Atticus") {
    print(row);
  }
}

Q2: Write code to print the rows for the name “River”. In this case, there are two such rows, but the same basic code pattern as for question 1 works. This shows how the loop really is just testing every row.

table = new SimpleTable("baby-2010.csv");
for (row: table) {
  // your code here
   if (row.getField("name") == "River") {
    print(row);
  }
}

Q3: Write code to print the rows where the rank is less than (<) 10, i.e. ranks 1 through 9.

table = new SimpleTable("baby-2010.csv");
for (row: table) {
  // your code here
  if (row.getField("rank")<10) {
    print(row);
  }
}

Q4: Write code to print the rows where the rank is greater than 950.

table = new SimpleTable("baby-2010.csv");
for (row: table) {
  // your code here
  if (row.getField("rank")>950) {
    print(row);
  }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值