Q1: Matching:
binary |
base 2 | |
decimal |
base 8 | |
hexadecimal |
base 10 | |
octal |
base 16 |
A1:
Q2: Short answer: List one "practical reason" that web designers need to understand hexadecimal.
A2:
Q3: Short answer: List one "practical reason" that web designers need to understand octal.
A3:
When using the SSH file transfer program one has to be able to interpret the "file permissions" strings in order to make files readable on the web.
Click here to bring up an image of the SSH file transfer program. In this image, file permission strings have the following form: -rwxrwxrwx, and directory permission strings have the form drwxrwxrwx.
The letter r means "read", the letter "w" means "write" and the letter "x" means execute. (In the context of web pages, x is significant only for directories, and means you can "move through" that directory to find a file.)
Reading left to right, the first group of rwx represents the file owners permissions, the second group represents "group" permissions (e.g. if a group of web designers shares joint responsibility for a page), and the final group represents what permissions regular users of the system have (including web users.) Hyphens are used to represent permissions not granted—for example, rwxr-xr-x means that group and regular web users do not have write permission.
In the image, we can also see that the file test2.html is not accessible to web users: its file permissons are -rw-------, which corresponds to the octal number 600. To make it readable, we would need to change it to a number such as 644 (-rw-r--r--) which gives web users read permission, or 755 (-rwxr-xr-x) which gives web users read and execute permission.
Note that these strings such as "drwxr-xr-x" aren't just a "copland.udel.edu" thing; the same strings are used by commercial web hosting companies such as "www.5dollarhosting.com" in their web interface.
For each of the following file permission strings from the SSH Secure File Transfer, give the corresponding octal number:
Consider the following line of JavaScript:
window.alert("Hi");
Q2: Consider each of the following for loops. How many times will the body of the for loop be called, and for what value of i?
Hint: the correct answer to at least one of these questions is "zero times, i.e. for no values of i". This occurs when the condition is false immediately after the increment, for example in the following loop:
for (i=10; i<5; i++).
Question | for loop | Click | Answer | Explanation |
Q2 | for (i=0; i<5; i++) |
|||
Q3 | for (i=5; i>0; i--) |
|||
Q4 | for (i=5; i<0; i--) |
|||
Q5 | for (i=0; i<=10; i+=2) |
|||
Q6 | for (i=9; i>=1; i-=3) |