SI110: Introduction to Cyber Security, Technical Foundations Fall AY2013 — 6­Week Exam

advertisement
SI110: Introduction to Cyber Security, Technical
Foundations
Fall AY2013 — 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 25 problems is worth 5 points.
On the front of every sheet, legibly write your Name: _____________________________________, Alpha: _____________, Section Number: _____________
name: ________________________________________ alpha: _____________________ page 2
1) Digital Data
Show (as bits) the byte representing the number 78.
2) Digital Data
Write the decimal number represented by the byte 00011101.
3) Digital Data
What is the hex representation of the byte 01001101 ?
4) Digital Data
What ASCII character is represented by the byte 01001101 ?
5) Digital Data
Suppose you downloaded a file called foo.html to your computer.
The safest and most trustworthy way to identify the type of this
file is to open it with:
a. Notepad
b. Windows Photo Viewer
c. Google Chrome
d. Frhed
e. Microsoft Word
and then to ... _______________________________________________.
6) Architecture Identify the following pieces of PC hardware:
_______________ _______________ _______________ ______________ name: ________________________________________ alpha: _____________________ page 3
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) Operating Systems
Notepad is running on a computer. Within the Notepad program, the user tries to open a
file foo.txt but the operation fails — the file is there, but access is denied. What
must have gone wrong?
[ Note: Variations of "The user didn't have permission to access foo.txt" will not be
accepted as an answer. This wouldn't explain what circumstances must have led to not
having permission to access foo.txt. ]
For the next problems, consider the filesystem shown in the following diagram:
9) Write out the full absolute pathname for the folder or file marked ex.txt
10) In the diagram above, draw a circle around the folder or file named C:\SI110Programs\ex.txt
11) Suppose your current directory is C:\Users\wcbrown. Write a command to copy
the file qw.jpg into the directory C:\Users\wcbrown\Desktop.
12) Suppose the current directory is C:\Users\m169999\Downloads. Write the absolute path naming the directory you will be in after giving the command: cd ..\..
name: ________________________________________ alpha: _____________________ page 4
13) Suppose that a friend­of­a­friend­of­a­friend wanted to borrow your laptop to
write a paper. You have three options (assuming you want to say yes):
a. create a new regular user account for her
b. create a new administrator user account for her c. log her in on the regular account you already created for your roommate.
Rank this: best idea is _____, middle idea _____, worst idea is _____. Justify!
14) What is the difference between a Program and a Process?
15) Programs
var a = 10;
var b = "73";
var c = "0";
Value of a | Type of a | Value of b | Type of b
a = a + 2; ­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­
<­­­ | | | b = b + a; ­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­
<­­­ | | |
c = a; ­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­
<­­­ | | |
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
16) Programs
Consider the following program, whose output is shown to the right.
var wp = 0.08818490495171681;
var np = Math.ceil(130 * 16 / wp);
var d = np / 100;
alert("A 130 pound person weighs $" + d + " worth of pennies");
Annotate the program to show how you would modify it so that the target person's
weight is entered by the user. Note, the outputted text as a whole, not just the dollar value, must correctly reflect the value entered by the user.
name: ________________________________________ alpha: _____________________ page 5
17) Programs
Consider the following program:
var x = prompt("Enter a positive number ... please");
var y = Number(x);
if (isNaN(y) || y <= 0)
{
alert("blue");
}
else
{
alert("gold");
}
a. If the user enters ­5 and clicks OK, output is ________
b. If the user enters 0 and clicks OK, output is ________
a. If the user enters BEAT ARMY and clicks OK, output is ________
a. If the user enters 23 and clicks OK, output is ________
a. If the user enters one and clicks OK, output is ________
18) Programs
Consider the following program:
var s = prompt("enter a string");
var c = 0;
var i = 0;
while(i < s.length)
{
if (s[i] == 'x' || s[i] == 'X')
{
c = c + 1;
}
i = i + 1;
}
alert("There were " + c);
What message would the show in its final alert
box if the user entered: I was anxious about EXACTLY how much taxes I owed. name: ________________________________________ alpha: _____________________ page 6
19) Programs
If a user clicks OK in a prompt() box without having
typed anything, the prompt() function returns the empty string, "".
However, if a user clicks Cancel in a prompt() box, the prompt()
function returns the value null. In the following program, if
a user clicks Cancel in the prompt() box, the program crashes. Modify
the program so that it prints the message Error! when the user
clicks Cancel (just like the empty string case).
var s = prompt("Enter a non­empty string!");
if (s == "")
{
alert("Error!");
}
else
{
alert("The first character is: " + s[0]);
}
20) Programs
What is the output of "YODELTIME".charCodeAt(4)? ________________
What is the output of String.fromCharCode(56)? ________________
name: ________________________________________ alpha: _____________________ page 7
21) Web Intro
Which one or more of the below is/are actual uses of the world wide web?
a. You use the ssh command to login to rona, and cat the file
/home/si110/www/index.html.
circle one: is web / is not web
b. You type http://members.chello.nl/vleeschd/history.html in your browser's address bar and press enter.
circle one: is web / is not web
c. Dr. Hong at NC State e­mails vleeschd@members.chello.nl and asks him to send
back an e­mail with the file history.html as an attachment.
circle one: is web / is not web
d. You type https://navyfcu.org in your browser's address bar and press enter.
circle one: is web / is not web
e. You type file://C:/Users/m169999/Desktop/si110/www/index.html in your browser's address bar and press enter:
circle one: is web / is not web
22) Web Intro
In the following URLs, underline the protocol part, box the server
part, and circle the file path part.
a. file:///C:/Users/m169999/Downloads/art.pdf
b. http://intranet.usna.edu/AcCenter/faculty.php
c. https://tutortrac.usna.edu/
23) Web Intro & Build­a­webpage lab
Draw what the browser renders for the following html code:
<html>
<head></head>
<body>
To be or not to
be, <p>That is
the question.</p>
<p><u>Hamlet</u> Act 3, scene 1</p>
</body>
</html>
name: ________________________________________ alpha: _____________________ page 8
24) Web intro
Suppose the HTML source for http://rona.cs.usna.edu/~wcbrown/last.html looks like this:
<html>
<head></head>
<body>
I like <a href="http://espn.go.com/index.html">sports</a>
and cats.
<img src="http://www.flickr.com/photos/cat.jpg">
</body>
</html>
If all you did was enter the URL http://rona.cs.usna.edu/~wcbrown/last.html, which one or more of the following represents an order that your browser might send out GET requests in order to render the page:
answer:___________________________________________
a.
b.
GET espn.go.com /index.html
GET rona.cs.usna.edu /~wcbrown/last.html
GET www.flickr.com /photos/cat.jpg
GET www.flickr.com /photos/cat.jpg
c.
d.
GET rona.cs.usna.edu /~wcbrown/last.htmlGET rona.cs.usna.edu /~wcbrown/last.html
GET espn.go.com /index.html
GET espn.go.com /index.html
GET www.flickr.com /photos/cat.jpg
e.
f.
GET espn.go.com /index.html
GET rona.cs.usna.edu /~wcbrown/last.html
GET rona.cs.usna.edu /~wcbrown/last.htmlGET www.flickr.com /photos/cat.jpg
GET espn.go.com /index.html
25) Client­Side Scripting (Non Event Driven)
Describe what happens when this page is loaded.
<html>
<head></head>
<body>
<script type="text/Javascript">
var i = 0;
while(i < 10)
{
document.write("0");
document.write("<u>0</u>");
i = i + 1;
}
document.location = "http://google.com";
</script>
</body>
</html>
Download