Sie sind auf Seite 1von 5

2004-2005 SPRING SEMESTER

CMPE 418

SOLUTIONS TO FINAL EXAM QUESTIONS

Answer 1.

a) HonoredToPayTaxes.aspx GUI page has a log-in form with CitizenshipNo & OnlineAccessKey
fields for user entry. There is also a CustomValidator linked up to either field. Submit button
activates the CustomValidator_ServerValidate handler in the code-behind which fetches
OnlineAccessKey from DB corresponding to CitizenshipNo to verify identity. If not verified,
args.IsValid is set to false. If verified, validator sets FormsAuthentication.SetAuthCookie for
CitizenshipNo. Then adds CitizenshipNo into HttpSessionState Session object as verified. And,
server is Reditected to WhatCanIDoforYou.aspx page. Check figure 20.39, lines 76-end.
b) At WhatCanIDoforYou.aspx page there is nothing specific to do with respect to
authentication/authorization! Web.config configuration file handles the rest.
c) Web.config file must have authentication and authorization elements set as follows:
i. <authentication mode= Forms>
<forms name= OnlineAccessCookie loginUrl= HonoredToPayTaxes.aspx>
</authentication>
ii. <authorization>
<deny users= ?>
</authorization>

Grading:
a) 5 p
b) 5 p
c) 5 p.

Answer 2.
a) System.Data and its subspace System.Data.OleDb
b) Actions to create (VS .NET 2003):
i. Connection to data source:
1) View > Server Explorer
2) Right click on Data Connections
3) Double click on Add Connection
4) Click Provider tab in the Connection Properties window
5) Choose (double-click on) Data Provider for OleDb (VS .NET 2005)
6) Choose Microsoft Jet 4.0 OLE DB Provider
7) Click Connection tab
8) Provide UID/PW for DB and select the MyDB to connect to
9) Click OK.
ii. Data adapter:
1) Drag an OleDbDataAdapter from Toolbox Data Group and drop it onto the
design window
2) Data Adapter Configuration Wizard is displayed. Click Next.
3) Select Use SQL Statement,
4) Click Query Builder
5) Select table
6) Choose columns. Then OK.
iii. Data set:
1) Toolbox > Data > drag DataSet onto form
2) Choose Untyped DataSet (no schema).
iv. Using VS. NET 2005: use Data menu tab, Add DataSource, highlight DataSource and
choose table.
c) Code to:
i. fill data set in constructor: oleDbDataAdapter.Fill (dataSetName, table name);
ii. bind data to a grid in constructor: dataGrid.SetDataBinding (dataSetName, table name);
d) DB-Grid column correspondence: Use adapter.TableMappings.AddRange; to map ranges
System.Data.Common.DataTableMapping and System.Data.DataColumnMapping
constructors. Or, through Grid Options select Edit Columns.

Grading:
a) 2 p
b) 4 p
c) 2 p
d) 2 p.

Answer 3.

<?xml version= "1.0" ?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Answer to Final Question 3</title>
</head>
<body>
<table>
<caption style="text-align:center">
Table 4.5<br />
Learning nanagement systems market<br />
<em>(millions of dollars</em>
</caption>
<thead>
<tr>
<th>ESTIMATIONS BY:</th>
<th>2001</th>
<th>2003</th>
<th>2004</th>
<th>2006</th>
</tr>
</thead>
<tbody>
<tr>
<th>IDC</th>
<td>$800</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>$3'600</td>
</tr>
<tr>
<th>Simba Information</th>
<td>$200</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Lifelong Learning Report</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>$529</td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Bersin &amp; Associates</th>
<td>&nbsp;</td>
<td>$350</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</body>
</html>

Grading:
caption: 1
thead: 1
rows: 1
hd: 2
body: 2

Answer 4.

<?xml version= "1.0" ?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Answer to Final Question 4</title>
<link rel="Stylesheet" href="style.css" type="text/css" />
</head>
<body>
<!-- skipped parts -->
<p class="Gill">Other specifications ...:
<ul type="disc">
<li><a href="...">SVG</a> contains the CSS properties ....</li>
<li><a href="..." class="italic">Accessibility Features of CSS</a> is
a Note about ...</li>
</ul>
</p>
<!-- skipped parts -->
</body>
</html>
<!--
External style sheet style.css contains for this example the following:
.Gill {font-family: Gill Sans MT}
.italic {text-decoration: italic}
li {font-size: 1.5em}
-->
Grading:
rel link: 1
text: 1
CSS elems: 1

Answer 5.

Well, as year of a data point is not mentioned, the schema is not wholly correct for the table. You
could do one of a few things in this case:
i. Assume there is an attribute field for each estimate element and mark year there,
ii. Assume there is a year element in the estimate sequence and mark year there,
iii. Assume the table content is fixed, that is, for each source first estimate is for year 2001, 2nd for
2003, 3rd for 2004, and 4th for 2006.
iv. Other choices.

I took the (ii) choice as it produces an intelligible data file.

<?xml version="1.0" encoding="utf-8" ?>


<!-- Example XML data file for the final Exam Q.5 LMS-Estimates.xml -->
<LMS:estimates xmlns:LMS="http://cmpe.emu.edu.tr/aelci/lms/estimatelist">
<estimate>
<source>IDC</source>
<amountInUSD>800</amountInUSD>
<year>2001</year>
</estimate>
<estimate>
<source>IDC</source>
<amountInUSD>3600</amountInUSD>
<year>2006</year>
</estimate>
<estimate>
<source>Simba Information</source>
<amountInUSD>200</amountInUSD>
<year>2001</year>
</estimate>
<estimate>
<source>Lifelong Learning Report</source>
<amountInUSD>529</amountInUSD>
<year>2004</year>
</estimate>
<estimate>
<source>Bersin &amp; Associates</source>
<amountInUSD>350</amountInUSD>
<year>2003</year>
</estimate>
</LMS:estimates>

Grading:
<?xml : 1
ns: 1
root: 1
elements: 2
Answer 6.

a) Using VS .NET 2005 Beta:


If updated: Grades.asmx & Grades.asmx.cs;
otherwise: Service.asmx & Service.cs
b) <%@ WebService Language="C#" CodeBehind="~/Code/Service.cs" Class="Service" %>
Service may have been edited to read Grades.
c)
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
// ... others as needed

[WebService (Namespace = ., Description = ..)]


public class Grades : System.Web.Services.WebService {

[WebMethod]
public double GetCGPA ( . . . ) {

}
[WebMethod]
public double GetGPA ( . . . ) {

}
}

Grading:
a: 1
b: 2
c: 2