CISC103 Fall 2005
Final Exam Review with Sample Questions

I. From Lecture Notes

Lecture Notes for 09/01

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:

For more sample questions, also see :


Lecture Notes for 09/06

Review material

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.

Questions

For each of the following file permission strings from the SSH Secure File Transfer, give the corresponding octal number:

-rwxr--r--
744
(example)
-rwxrwxr--
-r--r--r--
-rw-rw-r--
-rwxrw-r--
-rwx------
-rwxr-xr--

Lecture Notes for 09/08

Consider the following line of JavaScript:

window.alert("Hi");

Question Click Answer Explanation
True or False: window is a method of the alert object    
Fill in the blank: The parameter in this line of JavaScript is:    

Consider the following lines of JavaScript from start.html, with comments removed and line numbers added

  1
  2
  3
  4
  5
  x = 2; 
  if (x<5) 
    alert("purple");
  else
    alert("green");

 

Question Click Answer Explanation
Which line number contains an assignment statement?    
What will be the result of executing these five lines of JavaScript?    
Only one "variable" is referred to in these five lines of JavaScript; what is the name of that variable?    
What is the value of that variable (after the five lines have been executed)?    
What is the type of that variable (after the five lines have been executed)?    

 


Lecture Notes for 09/13

Consider the following lines of JavaScript from binaryTableWithAttributes.html, with comments removed and line numbers added

  1
  2
  3
  4
  5
  6
  7
  8
<table border="10" cellspacing="3" cellpadding="2">
      <tr> <th>Decimal</th> <th>Binary</th> </tr>
      <tr> <td>0</td> <td>0</td> </tr>
      <tr> <td>1</td> <td>1</td> </tr>
      <tr> <td>2</td> <td>10</td> </tr>
      <tr> <td>3</td> <td>11</td> </tr>
      <tr> <td>4</td> <td>100</td> </tr>

</table>

 

Question Click Answer Explanation
Q1: True or false: This example shows XHTML tr elements nested inside a td elements.    
Q2: Fill in the blank: the open tag of the table element shows that it has three ________s: border, cellspacing, and cellpadding    
Q3: True or false: the order in which border cellspacing and cellpadding appears is very important because changing the order can change the appearance of the table.    

Q4: True or False: in XHTML line 1 could also have been written as:
<table border=10 cellspacing=3 cellpadding=2>

   

Q5: True or False: in XHTML line 1 could also have been written as:
<table border='10' cellspacing='3' cellpadding='2'>

   

Q6: True or False: in XHTML line 1 could also have been written as:
<table border:"10" cellspacing:"3" cellpadding:"2">

   

Consider the following lines of JavaScript from 09.13.numberConversionTable.short.html (based on numberConversionTable.html, modified for brevity and with line numbers added).

  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
<html>
<!-- an example web page, P. Conrad for CISC103 -->
<head><title>Decimal to Binary</title></head>
<body>
<table border="10" cellspacing="3" cellpadding="2">
<tr> <th>Decimal</th> <th>Binary</th> <th>Octal</th> <th>Hexadecimal</th> </tr>
<script language="JavaScript" type="text/javascript">
var i;
for (i=0; i<=8 ; i++)
{
document.write("<tr>");
document.write("<td>" + i + "</td>"); // the value of i in base 10
document.write("<td>" + i.toString(2)); // converts i to binary (base 2)
document.write("<td>" + i.toString(8)); // converts i to octal (base 8)
document.write("<td>" + i.toString(16)); // converts i to hex (base 16)
document.writeln("</tr>");
}
</script>
</table>
</body>
</html> 
Question Click Answer Explanation
Q7: How many columns will be in this table?    
Q8: How many rows will be in this table (including the header row)    
Q9: True or false: write is a method of the document object.    

Q10: On line 12:
  document.write("<td>" + i + "</td>");
how many parameters are being passed to document.write?

   

 


Lecture Notes for 09/15

Q1: Consider the following segment of JavaScript code:

for (tempC = -10; tempC <= 40; tempC+=10)
{
  writeTableLine(tempC);
}

How many times will the function writeTableLine be called?

A1:

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)