Download Solutions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Value proposition wikipedia , lookup

Shareholder value wikipedia , lookup

Transcript
15110 PRINCIPLES OF COMPUTING – Post Exam 2 Practice Questions
1. [12 pts] This question concerns networking and the Internet.
1a. [2 pts] In IPv4, a company is assigned addresses of the form 143.17.___.___.
How many unique addresses can the company use with this assignment? ​256*256=2​16​=65536
1b. [2 pts] In IPv6, an address is given by eight 16-bit numbers usually
written in hexadecimal. For example, here is an IPv6 address:
3001:0DE5:CA14:AD0F:0000:0000:0000:0000.
How many unique addresses does IPv6 support overall?
2​128​ = 2​8*16​ = 65536​8
1c. [2 pts] What protocol is used to turn names, such as www.cmu.edu, into IP addresses? Circle your
answer.
(A) HTTP
(B) DNS
(C) SMTP
(D) SSH
1d. [4 pts] When a message is transmitted using packet switching and is split into packets what two
pieces of information must be stored in each packet (besides the data) based on the example done in
class?
1. ___ ​sequence number​______________________
2. ___ ​destination address​, (Also acceptable: ​sender address​, ​port number​, ​length​, ​check sum)
1e. [2 pts] What is the role of a router in the Internet protocol? Limit your answer to one sentence.
​A router forwards packets from one network link to another in the direction of the receiver.
2. [7 pts] This question concerns security and privacy.
2a. [2 pts] What is a Distributed Denial of Service Attack?
Adversaries intentionally sends a flood of requests to servers so that servers are unable
to respond to user requests, making the site seem as though it is down.
2b. [4 pts] Briefly describe the difference between a symmetric encryption system and an asymmetric
encryption system.
1
15110 Exam 3A, Fall 2013
In a symmetric encryption system the two parties share a secret key, which is used to
encrypt and decrypt messages. In an asymmetric system different keys are used to
encrypt and decrypt and only the one key needs to be secret.
2c. [3 pts] Alice wants to send her patent application to Bob. To ensure that she keeps the rights to
her intellectual property, she plans to authenticate it to prove the message is from her. Using a public
cryptographic system, which key should Alice use to encrypt her message? Explain.
a)
b)
c)
d)
Alice’s public key
Alice’s private key
Bob’s public key
Bob’s private key
b) She should use Alice’s private key so that anyone can use her public key to
decrypt her message. Only Alice has access to her private key, so she is the only
one who could have encrypted the message that can be decrypted with her public
key.
3. [16 pts] This question concerns concurrency.
Suppose that two programs ​A​ and ​B​ have access to the same variable ​x​ in memory, and they can use
actions ​read(x)​ and ​dec(x,c) ​, which represent, respectively, reading from the location ​x​ and
decreasing the value in location ​x​ by the value ​c​. The program steps for ​A​ and ​B​ are given below.
Note that the programs are presented in pseudocode, that is, in no particular language.
3a. [4 pts] Suppose that ​x​ initially contains the value 4, and Program ​A​ and Program ​B​ are executed
sequentially such that the program steps are executed in the following order: ​A1, A2, B1, B2 ​.
What will the memory location ​x ​contain at the end of the execution?
2
15110 Exam 3A, Fall 2013
After step​ A1​, the value of ​x​ is: ​4
After step ​A2​, the value of ​x​ is: ​0
After step ​B1​, the value of​ x​ is: ​0
After step ​B2​, the value of ​x ​is: ​0
3b. [4 pts] Suppose that the programs ​A​ and ​B​ are executed by two different processors that have
access to a shared memory containing the variable ​x​. This means that the steps of the two programs
may be interleaved. Now, assume that the memory location ​x​ initially contains the value 4 as in the
previous question. Give a 4-step execution sequence that starts with the step ​B1 ​such that the
resulting value of ​x​ is negative.
____​B1, A1, B2, A2​
or ​B1, A1, A2, B2​ ________________________
3c. ​[​4 pts] In the simple circuit switching network below, there are two switches shown in gray, X and
Y, between two phones shown in white, A and B. To establish a connection between the two phones,
a switch must establish a connection with each of the phones, one at a time, to form a complete path
between the phones. Once a switch establishes a connection with a phone, it does not drop the
connection until after a complete circuit is established. If a phone is already connected to another
switch, the switch waits until that pre-existing connection to that other switch is dropped. Explain ​in
at most two sentences ​how this network can become deadlocked.
A calls B, obtaining edge A-X; B calls A, obtaining edge B-Y. X waits for B to drop
B-Y, and Y waits for A to drop A-X.
3
15110 Exam 3A, Fall 2013
3d. [4 pts] Pipelining is used in computers to speed up execution of instructions. A 5-staged pipeline
for executing an instruction uses the stages Fetch (F), Decode (D), Read(R), Execute (E), Write (W).
How many stages would it take to have 4 instructions to be completed using pipelining? Show your
work.
1
2
3
4
5
6
1 F
2
3
4
D
F
R
D
F
E
R
D
F
W
E
R
D
W
E
R
7
8
9
4
​ instructions in 8 cycles
W
E
W
4. [10 pts] This questions concerns the limits of computation
4a. [4 pts] Name a problem that is undecidable. Is this problem undecidable for all instances of
the problem? Explain.
The halting problem is undecidable, because no program can decide for all programs
whether it halts or not. In some instances the problem is decidable, for example, a program
that simply prints a string is a program that always halts.
4b. [4 pts] In the Bin Packing problem you have ​n items and ​m bins. Item ​i weighs ​wi ​pounds and
each bin can hold at most W pounds. Can you pack all ​n items into the ​m bins without violating
the weight limit of each bin. Is problem in P or is it NP? Explain how you can either find a
solution or verify a positive solution to justify your answer.
It is in NP and, in fact, it is NP complete. To verify a positive solution you can add the
weights of all the items in bin ​i to check that the sum is less than ​wi. This test verifies that the
weight limits are not violated. In addition, you need to check that every item is in some bin:
For each item in the bins, find it in the input list of items and mark that item as found. Then
check that every item in the input list is marked. You can do all these steps in polynomial
time.
5. [10 pts] This question concerns machine learning.
5a. [4 pts] Which of the following problems could be solved with a classifier? (circle all that apply):
a. Spam filtering
4
15110 Exam 3A, Fall 2013
b. Diagnosing gastric carcinomas
c. Automatic music genre recognition
d. Finding rules or trends in marketing data (e.g. people who buy x and y also buy z)
5b. [6 pts] Suppose CMU wants to use a neural network to select applicants for admissions. CMU has
historical data for GPA, SAT, class rank, honors, citizenship at the time of application, as well as information
on their GPA and other performance at CMU. Identify or describe the following:
a. Training Data: __ ​The historical data + performance at CMU.​ ​_________
________________________________________________________________________________
b. Features: ___ ​GPA,
c.
SAT, class rank, honors, citizenship ​______
to admit (Boolean) ​(or ​numerical rating ​or
estimate or expected performance at CMU​ are acceptable answers)
Neural Network Output: ___ ​decision
5
15110 Exam 3A, Fall 2013