SI110: Introduction to Cyber Security, Technical Foundations Fall AY2014 — 6-Week Exam

advertisement
SI110: Introduction to Cyber Security, Technical
Foundations
Fall AY2014 — 6-Week Exam
Individual work.
Closed book. Closed notes.
You may not use any electronic device.
Your answers must be legible to receive credit.
Each of the XX problems is worth 5 points.
On the front of every sheet, legibly write your
Name: _____________________________________, Alpha: _____________, Section Number: _____________
name: ________________________________________ alpha: _____________________ page 1
1. What is the hex representation of the byte 11100100?
2. What is the decimal representation of the byte 10111011? (Show work to maximize partial credit!)
The first four bytes of the file seal.jpg are:
bits: 10001001011100000100111001000111
hex:
89
50
4e
47
decimal: 137
80
78
71
3. What exactly would Notepad display if you used it to open seal.jpg?
4. What exactly would Frhed display if you used it to open seal.jpg?
5. What kind of file is seal.jpg? Justify your answer!
6. True or False: when you double-click on seal.jpg in Windows, the operating system looks at the
first 4 bytes of the file and selects the correct program to display it? Justify your answer!
name: ________________________________________ alpha: _____________________ page 2
7. 7) Architecture Consider the following diagram of
the basic architecture of a computer. Fill in the
blanks below with the proper letters:
i. Before the program is launched, its location is
_____
ii. When a program is launched, the program
instructions are copied to _____
iii. In the fetch/decode/execute cycle, the fetch copies the next instruction from ____ to ____
iv. In the fetch/decode/execute cycle, the decode and execute occur in ____
8. Modify the diagram in the previous problem so it represents a dual core processor similar ot
your laptops.
C:\
SI110Programs\
docs\
GPL.txt
aes.bat ssh.exe
Users\
m160000\
m169999\
GPL.txt
Windows\
Public\
addins\ ... winxsx\
GPL.txt
Desktop\
Downloads\
GPL.txt
GPL.txt cat.jpg
9. Write the absolute path for the file with the box around it.
10. Suppose your current directory is C:\Windows\addins. Give a command/commands for the Windows
shell that would change your current directory to Downloads.
11. Suppose your current directory is Downloads. Give a command/commands for the Windows shell that
would copy GPL.txt from the Desktop directory to the current directory.
12. Assume the account you are using does not have Administrator privileges on a computer. True or
False: By default, you do not have access to files the belong to other users _____
Explain one way you could gain access to a file belonging to another user if you did not have
access.
name: ________________________________________ alpha: _____________________ page 3
13. Fill in the following table with the types and values of variables a and r at the indicated
points during the execution of the program, assuming that the user enters 2 in the prompt box.
14. Consider the following fragment of Javascript code.
var t = prompt("enter num");
var x = "human";
if (t < 0)
a. Which input or inputs from this list results in x being "orangutan":
{
-10 , -5 , 0, 5, 10, none
if (t > 7)
{
x = "orangutan";
b. Which input or inputs from this list results in x being "marmoset":
}
-10 , -5 , 0, 5, 10, none
else
{
x = "bonobo";
}
c. Which input or inputs from this list results in x being "bonobo":
-10 , -5 , 0, 5, 10, none
else
{
if (t == -5)
{
d. Which input or inputs from this list result in x being "baboon":
x = "marmoset";
-10 , -5 , 0, 5, 10, none
}
else
{
x = "baboon";
}
}
15. The following program generates a 6 character password. Annotate the code to show how to modify
the program so that it gets the number of characters in the password from the user.
// Set A to the string of all characters that may appear in a password
var A = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
// Loop 6 times adding a random character to the password in each iteration
var pswd = ""; // The empty string!
var iter = 0;
while(iter < 6)
{
var i = Math.floor(A.length*Math.random());
pswd = pswd + A[i];
iter = iter + 1;
}
// Display password
alert(pswd);
name: ________________________________________ alpha: _____________________ page 4
16. What is the output of the following program:
var s = "a\\b\"c";
var out = "";
var i = 0;
alert(s);
while (i < s.length)
{
if(s[i]=="\\")
{
out = out + "/";
}
else
{
out = out + s[i];
}
i = i + 1;
}
alert(out); //"
17. Draw how
the browser <html>
renders the <body>
<b>Patches O'Houlihan:</b>
following
...the five d's of
html:
dodgeball:<br>
dodge,<br> duck,<br>
dip,<br> dive and
<u>dodge</u>!
</body>
</html>
18. Consider the following URLs:
http://www.ucsusa.org/news/press_release/new-jersey-bill-and-sandy-0402.html
http://www.alanwood.net/demos/ent4_frame.html
a. Put a box around the server names in each URL.
b. Circle the name of the html files the servers will send.
c. Underline the protocol parts of the URL.
name: ________________________________________ alpha: _____________________ page 5
19. Using the program nc, you connect to http://rona.cs.usna.edu, asking
for a file and you get back the following response. What kind of file did you get?
HTTP/1.1 200 OK
Date: Tue, 29 Jan 2013 15:40:38 GMT
Server: Apache
X-Powered-By: PHP/5.3.15
Content-Length: 4870
Connection: close
Content-Type: image/png
20.
Consider the following file, which is at: http://thrift.com/home.html
<html>
<body>
<img src="goofy.gif"> I dig <a href="http://www.nist.gov">weights</a> and
<a href="http://bach.org">measures</a>. <img src="http://teewanz.com/mug.jpg">
</body>
</html>
Assuming you entered the above URL in your browser and hit enter,
which diagram below represents a possible pattern of
communication between browser and server that could occur in getting
this page rendered?
a.
b.
c.
d.
Download