|
CSCI A348/A548 Final Examination Second Summer 2002 |
2. What is the primary function of a Web browser?
3. A web server is which of the following?
4. A web server can run on just about any type of machine, not just a huge, expensive server.
5. A browser utilizes which of the following technologies? (Choose all that apply).
6. Which of the following may be a reason for running a Web server on a port other than port 80?
7. A server can also be a client.
8. An HTML file contains
9. Which of the following types of tools cannot be used to create hypertext documents?
10. Mime types are important for which of the following reasons?
11. What is the MIME type of an HTML document?
12. Why is a simple text editor useful to a webmaster?
13. Which are the three parts of every HTTP transaction?
__________________________________________________________________
14. Name the three most widely used request methods.
__________________________________________________________________
15. What is the difference between a HEAD and a GET?
__________________________________________________________________
16. What header is sent by the server so that the browser can determine what type of content is being returned?
__________________________________________________________________
17. What is the first thing that is passed to the server when an HTTP transaction begins?
18. The GET method is the only method that retrieves information from the server.
19. To publish files to a Web server, you should have a user account.
20. If the permissions allow it, users can modify other user's files.
21. What is the difference between an absolute pathname and a relative pathname?
__________________________________________________________________
22. Which of the following are absolute paths? (Check all that apply).
23. Which of the following are relative paths? (Check all that apply).
24. Which of the following is a document root directory?
25. Directory indexing allows the Web server to generate a page containing a list of files in a directory automatically if no default document is specified.
Which of the following names have we used in this class for default documents?
26. Filenames are not important because users will always be accessing your site through Web pages, not by typing in filenames directly.
27. Directories are limited to the number of files they can contain, so you should put only a few files in each directory.
28. To access a file named "
A+WeirD&Filename.html" over the web you need to refer to it as:
29. The filename
MyFile.html is the same as myfile.html on a Unix server.
30. What features are attributed to the Apache web server? (Choose all that apply)
31. When testing Web servers, only a single server may be set up on a machine.
32. Free Web server software is not good enough to run Enterprise-class Web servers.
33. What is CGI?
34. Forms are part of CGI.
35. Forms are the only way that queries can be sent to a CGI program.
36. What is the benefit of using JavaScript code in an HTML document?
__________________________________________________________________
Consider the following JavaScript code:
function a(x, y) {
return x + y;
}
function b(x, y) {
return x * y;
}
// a = b;
document.write(a(a(3, 4), b(3, 4)));
Assume it's part of an HTML file, and is properly included in it with
<SCRIPT> tags in it. 37. (2 points) What will the browser display when you load the page in it.
__________________________________________________________________
38. How does the answer change if you uncomment the line currently commented?
__________________________________________________________________
39. (2 points) Consider the following JavaScript code:
function a(x, y) {
return y(x, x);
}
function b(x, y) {
return x - y;
}
document.write(a(b(2, 4), b));
What will the browser display when you load the page in it? __________________________________________________________________
40. (2 points) How do you find out if your server is running, from the Unix prompt?
__________________________________________________________________
41. (2 points) What's in the httpd.pid file?
__________________________________________________________________
42. (2 points) What's ENV and where did we use it? What does it contain?
__________________________________________________________________
43. (8 points) Here's a form:
<html>
<body bgcolor=white>
<form method="POST" action="/cgi-bin/alpha">
<input type=text name="a">
<input type=text name="c">
<input type="submit" value="Proceed">
</form>
</body>
</html>
Finish alpha that prints the values associated with a and b.
(Write the code that should go on the three missing lines plus one other spot).
if ($ENV{REQUEST_METHOD} eq 'GET') {
_________________________________
} else {
read(STDIN, _______, $ENV{CONTENT_LENGTH});
}
print "Content-type: text/html\n\n";
@in = _____________________________
foreach $e (@in) {
($name, $value) = split(/=/, $e);
__________________________________
$value =~ s/%(..)/chr(hex($1))/ge;
print $name, "=(", $value, ")";
}
44. What, in your own words, is the difference between the Internet and the World Wide Web (if any)? __________________________________________________________________
45. (2 points) Briefly explain the event handling mechanism in JavaScript.
__________________________________________________________________
46. (2 points) What is the output of the following simple Perl program?
47. (2 points) What is the output of the following simple Perl program?#!/usr/bin/perl @a = (1, 2, 3, 4); print $#a;
48. (2 points) What is the output of the following simple Perl program?#!/usr/bin/perl $a = "There's a tomato in every automaton."; $a =~ s/tomato/**/g; print $a;
49. (2 points) What is the output of the following simple Perl program?#!/usr/bin/perl $a = "My goodness!"; $a =~ s/(.)/($1)/; print $a;
Note the#!/usr/bin/perl $a = "My goodness!"; $a =~ s/(.)/($1)/g; print $a;
g at the end in this one! 50. (2 points) What is the output of the following simple Perl program?
51. (2 points) What is the output of the following simple Perl program?#!/usr/bin/perl $a = "hOoB!y"; $a =~ s/(.)(.)/$2$1/g; print $a;
52. (2 points) What is the output of the following simple Perl program?#!/usr/bin/perl $a = "12345"; $a =~ s/(..)/$1+1/g; print $a;
Again, note the extra#!/usr/bin/perl $a = "12345"; $a =~ s/(..)/$1+1/ge; print $a;
e at the end!
A348/A548.