Due at or before 7pm on Thursday Oct. 29, 1998.
+---+---+ | 0 | X | +---+---+ | | X | +---+---+
Use the <table> tag to create a 2x2 table (with border) in which the two cells on its right carry an X, the NW cell carries a 0, and one cell (SW) is empty.
<table>
2. What's the output for this simple Perl program:
#!/usr/bin/perl $i = 0; $j = 1; if ($i = 2) { print $i; } else { print $j; }
The answer is:
0 1 2 3
0
1
2
3
3. Which of the following is a valid way to embed an applet class named Q56 into a web page?
Select all right answers:
<applet class=Q56.class width=100 height=100> </applet> <applet code=Q56 width=100 height=100> </applet> <applet code=Q56.class width=100 height=100> </applet> <applet param=Q56.class width=100 height=100> </applet> <applet param=Q56 width=100 height=100> </applet>
<applet class=Q56.class width=100 height=100> </applet>
<applet code=Q56 width=100 height=100> </applet>
<applet code=Q56.class width=100 height=100> </applet>
<applet param=Q56.class width=100 height=100> </applet>
<applet param=Q56 width=100 height=100> </applet>
4. You're using GD.pm to draw pictures. What does the following code do (if anything):
$image->line(0, 10, 20, 30); draw a line from (0, 20) to (10, 30) draw a line from (0, 10) to (20, 30) draw the outline of a box whose left, top corner is at (0, 10) and that is 20 pixels wide and 30 pixels high nothing - this code does not compile because it does not provide the correct number of arguments nothing - this code does not compile because the arguments make no sense
$image->line(0, 10, 20, 30);
5. JavaScript code appears in between <SCRIPT> and </SCRIPT> tags. Is it necessary that the JavaScript code be placed inside the <HEAD> </HEAD> section?
<SCRIPT>
</SCRIPT>
<HEAD> </HEAD>
Yes, this is the required syntax, you have to do it this way. JavaScript needs to compile before the HTML page is loaded. It's not mandatory but it's good practive when using event handlers in web pages because objects that define event handlers need to appear inside <BODY> and </BODY> No, you can place it anywhere in the file, it doesn't matter.
<BODY>
</BODY>
6. Your Apache directory structure looks like this:
/---u---username---httpd---+---httpd* | +--logs | +--cgi-bin | +--conf | +--src | ... Where is httpd.pid located: /u/username/httpd/logs /u/username/httpd/cgi-bin /u/username/httpd/conf /u/username/httpd/src
/---u---username---httpd---+---httpd* | +--logs | +--cgi-bin | +--conf | +--src | ...
httpd.pid
/u/username/httpd/logs
/u/username/httpd/cgi-bin
/u/username/httpd/conf
/u/username/httpd/src
7. What does it contain?
Type your answer here:
8. Match the following configuration files with roles listed:
8.1 httpd.conf controls the behaviour of the server after it starts up provides directory-by-directory control over what hosts and users can retrieve documents from your server controls settings that are used when the server first starts up none of the above 8.2 srm.conf controls the behaviour of the server after it starts up provides directory-by-directory control over what hosts and users can retrieve documents from your server controls settings that are used when the server first starts up none of the above 8.3 access.conf controls the behaviour of the server after it starts up provides directory-by-directory control over what hosts and users can retrieve documents from your server controls settings that are used when the server first starts up none of the above
httpd.conf
controls the behaviour of the server after it starts up provides directory-by-directory control over what hosts and users can retrieve documents from your server controls settings that are used when the server first starts up none of the above
8.2 srm.conf
srm.conf
8.3 access.conf
access.conf
9. From /u/username/httpd/logs which of the following commands can be used to start your server (check all that apply).
starthttpd -k /u/username/httpd/httpd -d /u/username/httpd ./httpd -d . /u/username/httpd/httpd -d .. none of the above
starthttpd -k
/u/username/httpd/httpd -d /u/username/httpd
./httpd -d .
/u/username/httpd/httpd -d ..
10. What's the output of this simple Perl program:
#!/usr/bin/perl @a = ("camel", "bobac"); %a = ("camel" => "desert", "bobac" => "burrow"); print $a{$a[$a]}, "\n"; camel desert bobac burrow
#!/usr/bin/perl @a = ("camel", "bobac"); %a = ("camel" => "desert", "bobac" => "burrow"); print $a{$a[$a]}, "\n";
camel desert bobac burrow
11. Assume this crontab entry:
0 * * * 1 /u/username/bin/starthttpd
starthttpd
Then your server will be checked and if needed restarted
every Sunday at midnight every Sunday every hour every hour on Mondays only
12. Write an HTML form that contains:
http://tucotuco:19800/cgi-bin/database
POST
13. Here's the tucotuco:19800/cgi-bin/database script:
tucotuco:19800/cgi-bin/database
#!/usr/bin/perl use CGI; $query = new CGI; $function = $query->param('function'); $animal = $query->param('animal'); $habitat = $query->param('habitat'); print $query->header, $query->start_html; dbmopen($zoo, "/u/username/databases/zoo", 0644); if ($function eq 'add') { if ($zoo{$animal}) { $zoo{$animal} .= ":$habitat"; } else { $zoo{$animal} = $habitat; } print "Thanks for adding ($animal, $habitat)"; } elsif ($function eq 'search') { print $zoo{$animal}; } else { print "Command $function not implemented yet."; } dbmclose(%zoo); print $query->end_html;
What will the screen look like after the fourth call: desert new york new york:desert:desert desert:new york:desert :desert:new york:desert:
desert new york new york:desert:desert desert:new york:desert :desert:new york:desert:
14. Which of the following files contains the number of the port on which the server runs?
httpd.pid httpd.conf access.conf srm.conf none of the above
15. The CGI specifies an interface whereby a CGI script called with method POST should expect to receive the data from the server in:
STDIN $ENV{CONTENT_LENGTH} $ENV{QUERY_STRING} STDOUT $QUERY_STRING
16. You have a text file (called one.csv) which contains lines of the following format:
one.csv
camel,desert,new york,los angeles bobac,burrow moose,lindley hall,canada
What will this program print:
#!/usr/bin/perl $animal = $ARGV[0]; open (AB, "one.csv"); while ($line = <AB>) { if ($line =~ /^$animal,/) { print $line; # [1] exit; } } close(AB); print "Couldn't find $animal\n";
./program camel
./program CAMEL
./program moose
Subject: moose Has been seen in: - lindley hall - canada
17. In JavaScript which of the following events apply to radio buttons:
onSubmit onClick onBlur onFocus onChange onMouseOver onLoad
18. Assume the following program:
program
#!/usr/bin/perl $x = $ARGV[0]; while ($x =~ s/(\d+)//) { print ++$i, ". ", $1, "\n"; }
./program "123 abc 12.13 ;m3p23"
19. The CGI specifies an interface whereby a CGI script called with method GET should expect to receive the data from the server in:
20. Write a program that receives two strings on the command line and removes all occurrences of the first string from the second one and then prints what's left of the second string.
For example:
tucotuco.cs.indiana.edu% ./program "a" "Friday Saturday Sunday" Fridy Sturdy Sundy tucotuco.cs.indiana.edu% ./program "ay" "Friday Saturday Sunday" Frid Saturd Sund tucotuco.cs.indiana.edu%