link to prototypical exam questions

advertisement
CSCI110: Examination information. The exam for CSCI110 will consist of short answer questions. Most of them will require a
couple of sentences of explanation of a concept covered in lectures or practical classes, but
there will be a few that involve tasks such as





Defining a SQL “create table” statement;
Defining a SQL “select” statement;
Writing a short Javascript or PHP function;
“Debugging” a Javascript or PHP function;
Composing or interpreting a CSS style declaration or HTML fragment.
Note A question like “Explain how HTML‐forms/CGI‐programs can be used to process data entered by a user. How are the data entered by the user delivered to the processing program? How is the program's response returned to the user?” should be answered by explaining how 




the browser takes the user’s form input and composes a data string in form of name=value&…name=value pairs; these input data are sent as part of a GET/POST request to the web server; this request also containing the identifier of the CGI program or server‐side script that is to process the data; the web server starts the CGI program or script (possibly launching a sub‐process); the program reads the data from its environment variables and/or standard input, verifies the data and either sends an error response or processes the data; the results of processing the data are composed into a HTML response page that is returned via the web server to the browser; the browser displays the response page. You will not get marks for an answer that consists solely of some carefully memorised HTML purporting to represent a data entry form, and a chunk of PHP code that purports to do something with input from that form. The questions given below will vary in value from 1 to 5 marks. Example Questions Explain how a client and a server computer communicate across a packet‐switched network like the Internet. (4) What is an IP address? (1) What is a “port”? (1) Explain the use of each of the following communications protocols: IP, UDP‐IP, and TCP‐IP. (3) Explain the “domain name” for a computer. (1) How are “domain names” converted into IP addresses that can be used in computer‐to‐computer communications? (2) Explain the role and structure of a URL. (1) Fill all the gaps: “The core technologies for the Internet, the ‐‐‐ communications protocols and the ‐‐
naming mechanisms for host computers, were fully operative by the year ‐‐‐.” (1) Explain the typical roles of “client” and “server” in a client‐server computer system. (2) Explain the advantage of a web‐solution (browser/web‐server) over a custom client‐server application. (2) When and where did the http protocol and HTML language for the Web originate? Why was this hypertext system more successful than earlier attempts? (2) Netscape Corporation added a number of features to the HTTP protocol and related WWW technologies including “cookies” for state, client side scripting, and secure communications (Secure Socket Layer). Explain these features and why their introduction lead to the explosive growth of usage of WWW and the Internet. (4) Explain the importance of the DOCTYPE directive that should be included at the start of a HTML file. (1) What do you understand by “quirks mode” for a browser? (1) What data are typically included in the <head>…</head> section of a HTML file? (2) How are inter‐ and intra‐ document links defined in HTML? (1) Explain how documents are formatted when using a browser’s default “flow layout”. (1) Write the HTML markup and content text that will result in the tabular data display shown here: (2) The attributes of a <form> tag can include: method, name, action, onSubmit. Explain the use of each of these attributes. (2) Data from a HTML form can be sent to a server using either a GET or a POST request. Explain the differences in these requests. (2) Write the HTML and content text for a data entry form on a “rental properties” real‐estate web site that: 


Posts submitted data to the script “rentalproperties.php”; Allows the user to select one or more suburbs of interest (“Dapto”, “Albion Park”, “Mangerton”); Allows the user to enter a maximum weekly rental for properties of interest; (the form should not be displayed using the browser’s default flow layout). (2) Explain the Document Object Model (DOM) and its use by browsers. (2) Explain the purpose of HTML’s <div>…</div> tags. (1) Define the content text and HTML markup that will correctly display your favourite program, as shown below, in a web page displayed in a browser: int main(int argc, char** argv)
{
cout << "Hello World" << endl;
return 0;
}
(1) Explain the proper roles of HTML markup and CSS styling. (1) Explain how "styles" can be defined for HTML elements on a per‐element basis, per‐page basis, or document collection basis. (3) Explain how CSS style rules can be exploited to achieve “row‐striping” in a table – as illustrated here: (2) You need to display a document that has most of the content in English but some paragraphs in another European language. These paragraphs are to be displayed in a distinct style – indented, a different background colour, and a different font. How would you achieve this using CSS. (2) Explain how CSS allows the definition of styles that apply to unique designated HTML elements and styles that can apply to sets of similar elements. (1) Define CSS style rules that will cause H1, H2, H3, and H4 HTML elements to be displayed in red Verdana font, with H1 elements centred and H4 elements in small‐caps. (1) Explain what the following CSS styling rule will achieve: div#breadcrumbs {
background-color:#87aaae;
font-family: Arial,Helvetica,sans-serif;
font-weight: bold;
font-size: 0.9em;
padding-left:20px;
}
(1) Explain how CSS pseudo elements, such as :hover, can be used to achieve pop‐up menus, context sensitive help, and other localized information displays. (1) Explain how you can use multiple CSS stylesheets to produce outputs customized for different media such as PC‐screens and printers. (1) Explain how "events" can be coded in HTML tags and used to invoke Javascript functions. (2) Write the Javascript function, and the HTML markup, for the “monetary conversion” application used as an example in lectures: (3) The following Javascript function is associated with a text input element: <input type="text" id="input" name="input" value=""
onkeyup="docheckkey()" />
Javascript function function docheckkey() {
var field = document.getElementById('input');
var str1 = field.value;
var str2 = "";
var len = str1.length;
for(var i=0;i<len;i++) {
var ch = str1.charAt(i);
if((ch>='0') && (ch<='9')) {
str2 = str2 + ch;
}
}
field.value = str2;
}
Explain what the docheckkey() function accomplishes. (2) Explain the differences between Javascript classes and objects and the classes and objects that are defined in languages such as C++, and PHP (and Java, and C#, and Perl, and …). (3) What does AJAX technology attempt to achieve and why is it important? (2) Explain how you used AJAX in Assignment 3; include an outline version of your Javascript code. (3) Explain the following features of a browser: helper applications, plug ins, image maps. (3) Explain the mechanisms available in the HTTP protocol that support user/password access to a controlled realm. (3) Explain what “keep alive” means in relation to a HTTP connection. (1) Explain the “problem of state” in relation to the HTTP protocol. (2) Explain how “hidden fields” and “cookies” can provide means of maintaining state. (2) Why might cookies not be available? Explain how the alternative of URL rewriting works. (2) Explain how data are exchanged between a web‐server and a child CGI process. (3) “Client side checking catches fools. Server side checking catches villains.” Explain. (2) Outline the steps that are common to essentially all CGI server programs. (2) Explain PHP’s scope rules for “local”, “global” and “super global” variables. (3) Explain how PHP allows data values to be “interpolated” into output strings. (1) Explain “here documents” in PHP and their advantages in defining large blocks of output data. (1) Explain what the following PHP code fragment does: $jobs = array( "Tom" => "Manager", "Dick" => "Chief Programmer",
"Harry" => "Test and documentation",
"Sue" => "DBGuru");
(1) Write a PHP loop that will print out a HTML table listing person names and roles (using the data from the previous question). (2) Seems that this check() function isn’t working: Explain what is wrong with the code of the check() function. (1) PHP requires a small “hack” to deal with multi‐valued inputs (e.g. <select … multiple><option>…) in HTML forms. Explain the nature of the hack. (1) Explain one approach that can be used in PHP scripts that need to return a HTML page that contains embedded dynamically created pictures. (2) The first database systems used a “hierarchical” model. Briefly explain how data were organized and retrieved in such systems. (2) Explain briefly the contributions of Codd, Stonebraker, and Ellison to the development of the relational database model. (3) Explain the role of an “association class” and provide an illustrative example from a conceptual data design. (2) Explain how “keys” are used to express relationships among records in different tables in a relational database. (2) Explain your understanding of the following kinds of data table “primary key”: 


External key Composite key Surrogate key (3) [This is a long version of a “define table” exercise. Something in the actual exam would be similar but simplified in a significant way.] A real estate rentals agency is computerizing their system and will need data tables that contain records of the rental properties that they manage. They have decided that they will need tables to record details of owners, properties, tenants, and tenancies. They also wish to have photos for each property. The data required are: 




Owners o Record identifier o Owner name o Owner address o Owner phone Properties o Record identifier o Owner identifier o Property address o Weekly rental o Bond o Number bedrooms o Free text description o Status (available for rental, rented, undergoing maintenance) Tenants o Record identifier o Tenant name Tenancies o Record identifier o Tenant identifier o Property identifier o Start date o End date (NULL if a current tenancy) o Free text comments on payment issues, bond issues etc. Photos o Record identifier o Property identifier o Image data Complete the definition of the data (data types need to be defined for some elements, “name” and “address” data elements may need to be broken down into sub‐elements such as street address and suburb) and then define the SQL create table statements (MySQL dialect of SQL) for the tables. Continuing with the “rental properties” example, define SQL select statements for the following: 



Find all properties that are currently available and which have two or more bedrooms, a specified maximum weekly rental, and are located in a specified suburb. Retrieve the identifiers of all photos associated with a specified property. List the addresses of all properties owned by a person with a given name (do this using two or more select queries – you will learn how to do it with table joins in CSCI235) Retrieve data for a summary report on all past tenancy records associated with a specified tenant. Write a PHP script that will: 



Receive as input a posted “tenant identifier”. Will retrieve the tenant record associated with that identifier; if no such record exists, the script will return a simple error response page and terminate. If there is a record for that tenant, the script will generate partial response with the tenant details. The script will then determine if the tenant is currently renting a property; if there is a current tenancy, the script will print the property address and the start date for the tenancy. The script will complete the response page with necessary trailing markup. (5) Each specific web application requires its own data records. How are such data records defined using Drupal? (2) Explain the purpose of Drupal’s CCK (Content Construction Kit) module. (2) Explain the purpose of Drupal’s Views module. (2) Systems such as WordPress, Joomla, and Drupal all use a similar approach to storing and displaying content data. Summarize how these systems work. (3) Explain the purpose of an “.htaccess” file for Apache. (1) What is an “SQL insertion” attack? Explain how a hacker might attempt such an attack. (2) 
Download