Clean-up and Review - TerpConnect
Download
Report
Transcript Clean-up and Review - TerpConnect
INFM 603: Session 11
Review
Paul Jacobs
The iSchool
University of Maryland
Thursday, Nov. 17, 2016
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States
See http://creativecommons.org/licenses/by-nc-sa/3.0/us/ for details
Today’s Topics
Highlights of the Class
A Look Forward at Related Courses
Preview of Final Exam
Q&A
iSchool
Some Things You Probably
Know
What is HTTP? How does it relate to TCP? To IP? What is a DNS? How does a
web server communicate with your browser? What is HTML and its relationship to XML
and SGML? What is a style sheet? Why would one use a “linked” style sheet? What
does “cascading” mean? What is a “tag”? Why would we use a tag such as <DIV> or
<SPAN> that doesn’t directly tell the browser what to display? What are some examples
of features controlled by styles? What is special about the <FORM> tag? What is the
difference between “submit” and “clear”?
What is the difference between client-side and server-side scripting? What is special
about JavaScript? What is a data type? An expression? A control structure? A data
structure? What is a “for” loop? Why do we need curly braces {} in our code? Why do
we need parentheses? What is the difference between + and ++? Between = and ==?
What is a function? What is an argument (to a function)? How are variables used?
Why do we use functions instead of just writing longer scripts? What is an “event” in
JavaScript? What are some examples of events? What is the DOM? How is the
DOM used? When we see “window.prompt” or “document.write”, what does the word
before the dot (“window” or “document”) signify and what does the word after (“prompt” or
“write”) signify? How about in document.getElementByID(“thisid”).innerHTML?
What is a database? What are some features of “relational” databases? Some
examples? How do “objects” in programming languages relate to databases? What is
“normalization”? Why do we need to normalize a database? What is a “schema”?
How do we communicate a database schema? Why is it important? What is SQL?
What is the difference between “DROP” and “DELETE” in SQL? What is a “join” and why
do we need “joins”? What is a “key”? A “foreign key”? What is the relationship
between SQL and PHP?
iSchool
Some Things You Probably
Know (cont’d)
What is PHP? Why doesn’t my PHP script work on my Mac? Where does it work?
Where does a PHP script typically get its input? What is (typically) its output? What
does PHP do with HTML? Can a PHP script access the DOM? Why not? How does a
PHP script interact with a database?
What is an array in programming? What are two ways of accessing an array? What is
the relationship between an array and the result of a SQL query in PHP? What is
“recursion”? Why/how would you write a recursive program? What is AJAX? Why
has AJAX become important in “Web 2.0” programming? Can the user always tell
whether a form is using AJAX or PHP (or both)? How might you tell?
What is “responsive” design? How do web sites today become responsive? What is a
CMS “theme”? A “template”? How would I typically create/change a theme? A
template? What are the advantages/disadvantages of using a CMS for my site? How
should I choose a CMS?
What are some examples of software engineering “methodologies”? What are some
differences between the “waterfall” model and “Agile”? What is “iterative” development?
What are some changes that have occurred in technology development since its “early”
years (say, the moon landing)? Are there any disadvantages of Agile? Does anyone
still use the “waterfall” model? Does anyone still program in “FORTRAN”? In
“assembly language”? What are some examples of “cloud” applications today? What
are some advantages/disadvantages to the “cloud”? Did we use the “cloud” in this class?
How?
iSchool
Some Scenarios I Hope You’ll
Be Able to Handle Better Now
You manage a team; your developer tells you “I’ll
have the server-side scripting done by next
week”
Your team has to choose a CMS (or CRM, or
HRMS); your boss says she’d like to use
Microsoft because she’s heard they’re the best
(or Joomla, because she’s heard they’re free)
Your web designer says he builds all his HTML
pages “from scratch” because he doesn’t “like the
look” of WordPress/Drupal/Joomla/… pages
iSchool
Some Scenarios I Hope You’ll Be
Able to Handle Better (cont’d)
Your engineer says, a “cloud” solution is out
because of security concerns
The sales rep says their vendor solution is the
best for your needs because it meets all of your
requirements and you get a special price since
it’s the end of the quarter
75% of your budget for the project is committed
to the cost of software, consulting and
engineering
iSchool
Information, data, and life
wisdom
knowledge
information
data
data
iSchool
Examples – How We Use Data
Data
Information
“The letter ‘A’ ”
My bank balance
Knowledge
1000001
“When you make a withdrawal, you subtract the
withdrawal amount from your account balance”
“A person’s age must be lower than that of his/her
biological mother”
Wisdom
“Neither a borrower nor a lender be”
“Spend less than thou earnst”
iSchool
iSchool
Client
Web
browser
Web
server
Application
logic
Databases
and DBMS
Application partition
iSchool
Common
gateway
interface
HyperText Transfer Protocol
(HTTP)
Send request
GET /path/file.html HTTP/1.0
From: [email protected]
User-Agent: HTTPTool/1.0
Server response
HTTP/1.0 200 OK
Date: Fri, 31 Dec 1999 23:59:59 GMT
Content-Type: text/html
Content-Length: 1354
<html><body> <h1>Happy New Millennium!</h1> …
</body> </html>
iSchool
HyperText Markup Language
(HTML)
Simple document (page) structure language for Web
Historically based on SGML (Standard Generalized
Markup Language, for publishing)
Advantages
Adapts easily to different display capabilities
Widely available display software (browsers)
Disadvantages
Does not directly control layout
Does not formally specify data structures (ergo XML)
iSchool
What is HTML (more)?
HyperText Markup Language
Standard language for transmitting web
pages/web content
The input that allows web browsers to function
The framework within which many scripts are
written
The output of many scripts
iSchool
Embedding Images in HTML
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Picture.html
<!-- Fig. 4.7: picture.html
-->
<!-- Adding images with XHTML -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Internet and WWW How to Program - Welcome</title>
</head>
The value of the src attribute of
the image element is the location
of the image file.
<body>
<p><img src = "xmlhtp.jpg" height = "238" width = "183"
alt = "XML How to Program book cover" />
<img src = "jhtp.jpg" height = "238" width = "183"
alt = "Java How to Program book cover" /></p>
</body>
</html>
© Prentice Hall
The value of the alt attribute gives a
description of the image. This
description is displayed if the image
cannot be displayed.
The height and width attributes
of the image element give the
height and width of the image.
iSchool
HTML Forms
1
<?xml version = "1.0"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5
<!-- Fig. 5.3: form.html
-->
Form.html
6
<!-- Form Design Example 1 -->
Each form must begin and
7
end with form tags.
8
<html xmlns = "http://www.w3.org/1999/xhtml">
9
<head>
10
<title>Internet and WWW How to Program - Forms</title>
11
</head>
The method attribute specifies how the
12
13
<body>
form’s data is sent to the Web server. The
14
post method appends form data to the
15
<h1>Feedback Form</h1>
browser request.
16
17
<p>Please fill out this form to help
18
us improve our site.</p>
The value of the action attribute
19
20
<!-- This tag starts the form, gives the method of --> specifies the URL of a script on the
21
<!-- sending information and the location of form
-->
Web server.
22
<!-- scripts. Hidden inputs contain
-->
23
<!-- non-visual information
-->
24
<form method = "post" action = "/cgi-bin/formmail">
25
Input elements are used to send data to the
26
<p>
value = "main.html" />
script that processes the form.
33
</p>27
<input type = "hidden" name =
© Prentice Hall
"recipient"
28
value = "[email protected]" />
29
<input type = "hidden" name = "subject"
30
value = "Feedback Form" />
31
<input type = "hidden" name = "redirect"
A hidden value for the type attribute sends data
32
that is not entered by the user.
iSchool
Some Other Form Elements and
Attributes
<select> [element] - drop down list with
<selected> attributes
checkbox [attribute, e.g. <input name =
“instructor” type = “checkbox” value = “Jacobs”>]
radio [attribute] - radio button, e.g. <input name =
“heardaboutus” type = “radio” value = “friend”>
Password [attribute]
Forms go with scripts (to come later; the input name
and value “posts” to the script as a variable value)
iSchool
How Are Web Pages Created?
Static pages using text editors (Notepad,
Wordpad, Notepad++, emacs, VI, . . .)
Static pages using HTML editors (esp.
WYSIWYG) like DreamWeaver, KompoZer
Good for practice
Can be good for programming (e.g., Notepad++)
Much faster for certain features, like layout, images
Still allows hardcore HTML editing and programming
Can support site publishing and site management
Content Management Systems like Drupal,
Joomla, WordPress
Better for re-use, large scale site creation
Can be harder to customize, program
iSchool
Cascading Style Sheets (CSS)
Separating content and structure from
appearance
Rules for defining styles “cascade” from broad to
narrow:
Browser default
External style sheet (also called “linked” style sheet)
Internal style sheet (also called “embedded” or “pagelevel” style)
Inline style (also called “local”)
iSchool
External (Linked) Style Sheet
Example – HTML file
<!DOCTYPE html>
<html xmlns="•
http://www.w3.org/1999/xhtml•
"
dir="•
ltr•
" lang="•
EN•
">
<head>
<meta http-equiv="•
content-type•
" content="•
text/xml;"
charset="utf-8">
Notice that there are no styles at all on
<title>SimpleLinkedStyle.html</title>
this page – only the link
<link rel="stylesheet" type="text/css"
href="SimpleStyle.css">
</head>
<body>
<h1>This is the headline using the linked style sheet</h1>
<p> This is some text using the linked style sheet </p>
</body>
</html>
iSchool
External (Linked) Style Sheet
Example – CSS file
/* Generated by KompoZer – SimpleStyle.css */
body {
color: #ffffff;
background-color: #9999ff;
}
h1 {
color: #ffff33;
The .css file contains only the style
definitions
text-align: center;
font-family: fantasy;
font-style: italic;
font-variant: normal;
font-weight: normal;
Notice that this is not an HTML file –
font-size: 200%;
CSS files are in a different language
...
with different syntax from HTML!
}
p{
border: 3px groove #ffff33;
background-color: #ffff33;
color: #333300;
text-align: right;
}
iSchool
Using Style IDs
...
<title>Quote.html</title>
<style type = ”text/css”>
#quote {
font: bold italic 130% Garamond, Comic Sans MS, fantasy;
text-align: center;
The .# selectors give the style sheets
}
for the “quote” and “attribution” ids
#attribution {
font: 80% monospace;
text-align: right;
}
</style>
</head>
<body>
<h1>Literature Quote of the day</h1>
<p>
How to tell somebody off the classy way:
These ids can be applied within
</p>
different <p> tags
<p id = ”quote”>
Thou] leathern-jerkin, crystal-button, knot-pated,
agatering, puke-stocking, caddis-garter, smooth-tongue, Spanish pouch!
</p>
<p id = ”attribution”>
-William Shakespeare (Henry IV Part I)
</p>
</body>
iSchool
Goals for JavaScript Session
Understand how JavaScript and HTML/CSS
interact in designing and implementing web sites
Learn the basics of JavaScript so that you are
able to write programs and learn more
Use JavaScript to help understand the
foundations of computer programming
Algorithms
Control structures (such as program steps, different
types of loops, conditional statements)
Data structures (variables, data types, structures,
arrays)
Object oriented principles (modularity, encapsulation,
inheritance, etc.)
iSchool
Where do we See JavaScript at
Work?
Form validation – JavaScript programs check
user inputs on web pages – e.g., “Please enter
the date in the format MM/DD/YYYY”
Navigation tools – JavaScript has events like
“onmouseover” and “onclick” that can be used to
introduce “drop downs” and other menu tools
Autocompletes, such as in search boxes
Animations, information that changes frequently
(temperature, stock tickers, time), numerous
other dynamic page features
Simple lookups and calculations
iSchool
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Fig. 7.6: Addition.html -->
<!-- Addition Program
-->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>An Addition Program</title>
<script type = "text/JavaScript">
The window method prompt displays a prompt
<!-var firstNumber,
// first string
entered
user with a message and a text
dialog
in the by
browser
secondNumber, // second string entered by user
fieldtoforadd
input.
number1,
// first number
The first
argument passed to method
number2,
// second number
to add
sum;
// sum of number1
andisnumber2
Thetosecond
argument is the
prompt
the message
be displayed.
// read in first number from user as a string
firstNumber =
window.prompt( "Enter first integer", "0" );
default value for the text field.
// read in second number
from user
as a string
Function
parseInt
converts
secondNumber =
to an integer.
window.prompt( "Enter second integer", "0" );
// convert numbers from strings to integers
number1 = parseInt( firstNumber
); adds the two
The + operator
number2 = parseInt( secondNumber );
its string argument
numbers input by the user.
// add the numbers
sum = number1 + number2;
iSchool
For Loop with HTML/CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version = "1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- Fig. 9.2: ForCounter.html
-->
<!-- Counter-Controlled Repetition with for structure -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Counter-Controlled
Repetition</title>
Initialization
Repetition condition
<script type = "text/JavaScript">
Incrementing
<!-// Initialization, repetition condition and
// incrementing are all included in the for
// structure header.
for ( var counter = 1; counter <= 7; ++counter )
document.writeln( "<p style = \"font-size: " +
counter + "ex\">XHTML font size " + counter +
"ex</p>" );
// -->
</script>
</head><body></body>
</html>
iSchool
What is a Database?
A database is a mechanism (or system) for
organizing and storing information.
Within applications, databases are modules (also
known as a “tier”) that provide storage and
access to widely-used objects
Within implementations, databases represent a
layer that takes care of, and hides, many aspects
of dealing with large quantities of information
iSchool
Why do Applications Need
Databases?
Persistence - In your code, data exists only
when the program is running
Sharing – Information in a database can be used
by different programs, applications
Many other features that go along with all that –
Access control and security, concurrency control,
data backup, etc.
iSchool
Relational Database Concepts
to Know
Schema – the overall design, organization and
relationships in a database
Tables – the names of data entries and their relationships
Fields and columns – the types of entries themselves
Records and rows – the individual entries (instances)
Keys – fields that uniquely identify a record
Relationships – structures or groupings between fields
Data types – constraints on fields, such as strings,
numbers, dates, etc.
iSchool
Database Schema Example
iSchool
Relating Different Terms
Class
Table (Entity)
Object
Record (Row)
Attribute
Column (Field, Attribute)
Association
Relationship
…
iSchool
What is Normalization?
A method for organizing data elements into
tables.
Done in order to avoid
Duplication of data
Insert anomaly
Delete anomaly
Update anomaly
Database designs can be in first normal form
(1NF), second normal form (2NF), and third
normal form (3NF) – ideal is 3NF
iSchool
What is SQL (Structured Query
Language)?
The “interlingua” of relational databases (e.g., Oracle,
SQLServer, MySQL, Postgres, DB2, etc.)
An international standard (ISO 9075)
A common method of building and querying databases
A common method of building database interfaces (e.g.,
using ASP, JSP, PHP)
A common method of building connectors from applications
to databases (e.g., using XML, SOAP and ODBC/JDBC)
iSchool
PHPMyAdmin Output - Join
iSchool
Goals for PHP Session
Revisit and understand the role of server-side
scripts in web-based applications
Understand how to integrate PHP with XHTML
Understand how to use XHTML forms with PHP
Embedding PHP code into HTML
Generating HTML from PHP to display on the client
Using variables and other constructs
Revisiting the “post” action
Getting values from form input
Displaying resulting XHTML
Understand how to integrate with MySQL –
Accessing and updating databases
iSchool
Why Server-Side Scripts?
“We” meaning app. developers, have control over
the environment (software installed, data,
security, etc.) – not dependent on clients/users
Scripts can access a huge range of data and
applications that may be inaccessible to clients
directly – control the interface
Many different scripting languages are available
(PHP, Ruby, Perl/Python, Java, . . .) depending
on needs, programming resources
iSchool
PHP – MySQL – Pet Form
Example –WhenPHP
Code
posting to PHP,
you usually just get all
the variable data from the form
<?php
extract ( $_POST );
?>
<!-- petupdate.php
-->
<!-- Read information sent from input form -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Pet Form Validation and Database Update</title>
</head>
<body style = "font-family: arial,sans-serif">
<p>Hi
<span style = "color: blue">
<strong>
<?php print( "$petname" ); ?>'s owner
</strong>
</span>.
Thank you for telling us about
<?php print ("$petname"); ?>
.<br />
He/she has been added to the
<span style = "color: blue">
<strong>
<?php print( "$petbreed " ); ?>
</strong>
</span>
database.
</p>
iSchool
PHP – MySQL – Pet Form
Example – PHP Code (cont’d)
<?php
// Create MySQL connection
$database = new mysqli("localhost", "testuser1", "*********",
"testuser1_pets");
// Check connection
if ($database->connect_error) {
die("Connection failed: " . $database->connect_error);
}
if ( !( $result = $database->query ( "SELECT ID FROM Petfoods WHERE Name
This gets the key ID of the chosen pet food.
= '$petfood'") ) )
print ("Warning!
could not execute food query <br />" );
$row = $result->fetch_assoc();
$foodid = $row["ID"];
if (! ( $result = $database->query ( "SELECT OwnerID FROM PetOwners
WHERE Name = '$ownername'") ) )
print ("Warning!
could not execute owner query <br />" );
$row = $result->fetch_assoc();
if ( $row["OwnerID"] == 0 ) // if the owner isn’t already there
{
$database->query ("INSERT INTO PetOwners " .
" ( Name , TelNo , Email ) " .
"VALUES ( '$ownername' ,
'$ownertelno' , '$owneremail' )");
$ownerid = $database->insert_id;
}
iSchool
Some Advanced Data Structures
Arrays (also can be seen as vectors, matrices) –
generally used to keep fixed sets of like objects –
e.g., a deck of cards [52] or [4][13], a chess board
[8][8]
Queues – similar to arrays, but can be of variable
length, and keep track of position – First In, First
Out (FIFO).
Stacks – like queues, but Last In, First Out
(LIFO). “Push” means add to the “top” of a
stack, “Pop” means get the last (top) element.
Other objects and structures, pointers
iSchool
Objects (JavaScript)
Var person = {firstName:"John", lastName:"Doe", age:50,
eyeColor:"blue"};
Objects written as name value pairs are similar to:
Objects can have “constructor” functions, e.g.
Associative arrays in PHP
Dictionaries in Python
Hash tables in C
Hash maps in Java
Hashes in Ruby and Perl
person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
}
“this” is a special keyword – similar to a variable – that refers to
the object that “owns” a particular function
iSchool
Object Methods (JavaScript)
Methods are functions that apply to objects. For example,
document.writeln is a method that applies to the document object.
fullName
function() {return this.firstName + " "
+ this.lastName;}
Is a method that could apply to the person object.
var person = {
firstName: "John",
lastName : "Doe",
id
: 5566,
fullName : function() {
return this.firstName + “ " + this.lastName;
}
};
iSchool
The HTML DOM (Document
Object Model)
Allows Javascript to interact with the web page
being displayed
Supports dynamic HTML, interactive pages (often
described as part of “Web 2.0”
We’ve already used DOM a bit in class:
document.getElementById() is a DOM method
.innerHTML is a DOM property (or attribute)
onclick, onkeyup, onchange, onmouseover are DOM
events
iSchool
AJAX
Asynchronous JavaScript And XML (but not
always XML!)
Used to get dynamic content from the server
without re-loading the HTML page (as compared
with PHP, for example)
Asynchronous means other actions don’t have to
wait (not synchronized), faster, but this can be
tricky
Now the basis for many other cool interactive
layers and libraries
iSchool
Typeahead w/PHP/MySQL
Load the same scripts
<head>
<title>Example of using JQuery to Get Typeahead from Database</title>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/typeahead.bundle.min.js"></script> -->
<script type="text/javascript">
prefetch just says get the list of pet names from
database
match using PHP script
theand
database
// fetch the pet names from the
var petnames = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
limit: 20,
prefetch: 'lookaheadpetname.php'
});
The typeahead uses the list of pet names
//populate the typeahead
// passing in `null` for the `options` arguments will result in the default
// options being used
$('#my-input .typeahead').typeahead(null, {Showpetinfo() runs when the pet name entry
name: 'petnames',
changes, gets it from the DOM and then
source: petnames,
});
fetches database results from DB to put back
in the DOM
function showpetinfo () {
// print out info from database about that pet
petchoice = $('#petname').val();
$('#results').load("getpetinfo.php", {'petname' : petchoice});
}
</script>
</head>
iSchool
Overview – Content
Management Systems (CMS)
What are they?
A layer that uses CSS to provide a unified, stylized feel
to a web site
A set of administrative tools for organizing and
managing sites (e.g., including login, adding/removing
pages, personalization, etc.)
An extensible framework for managing dynamic (and
potentially customized/personalized pages) built upon a
database structure
Some examples
Open-source (free) – WordPress, Joomla, Drupal
(maybe 100 others)
Proprietary – OpenText TeamSite, Webpop (Saas),
many others
Related – prototyping (Wix, Weebly), portals
iSchool
Overview – CMS (cont’d)
Why do we need a CMS?
Provides numerous features (e.g. site management,
managing CSS, etc.) that can be laborious “reinventing
the wheel” without them
Opens access to shareware/design community
providing additional features and themes (e.g., nearly all
themes today are responsive)
Can provide tools to allow ordinary people to build/add
pages to a site without messing everything up
What could go wrong?
Learning curve, many tough choices (e.g. cloud/hosted,
proprietary, open source)
Loss of control (you always get more power by using
lower-level tools)
iSchool
iSchool
iSchool
Overview of Business Issues
Technology Only “Works” When It is Accepted
Has to meet business and user needs, get “buy in”
Has to be affordable, doable, on time
People have to be able and willing to use it
“IT and Organizational Context” - The
Information Ecology:
Business goals, funding,
politics, culture, technology,
human resources
Context
Content
Data types, content objects,
metadata, volume, existing
structure
Users
Audience, tasks, user
behavior, experience,
vocabulary
iSchool
IT in the “Real World”
What is the Real World?
Anywhere where our work affects profits, social justice,
public service, organizational efficiency, …
Companies, universities, nonprofits, government
services, …
Almost anywhere but here! (Not class, not research)
What’s the same (between the Real World and
our in-class “textbook” experience)
Fundamentals (concepts, web technology)
Most of the methods (e.g. organization/navigation, card
sort, blueprints, wireframes, …)
iSchool
The Waterfall Model
Requirements
Specification
Software
Test Plan
iSchool
Agile Methods
iSchool
Where to Go From Here
Foundations (including this)
Technology (follow-ons)
INFM700 – Information Architecture
INFM747 – Web Enabled Databases
INFM743 – Devel. Of Internet Applications
INST733 – Database Design
More Management
INFM600 – Information Environments
INFM605 – Users
INFM612 - Management
INFM706, INFM620, others
More Technology (but not exactly follow-on)
INST 631,702, 734, 735-6, 737, 767
iSchool
Some Basics about the Final
Overview and Rules
Closed book, closed notes
You’ll be asked to sign the Honor Pledge
You’ll be expected to write directly on the test, but you
can use extra (blank) paper if you need to
It will be designed to take an hour or less, but you can
have more time if you like
Types of Questions
Almost entirely multiple choice
Focus will be on key concepts, though it may not look
that way
Read very carefully!
There may be some short answers, particularly about
the projects, but it’s not a rote memory test
iSchool
Sample Test Question (Choose
The Answer That Fits Best)
93. In writing good HTML, it is important
(a) to include a tag, such as <div> or <p>, for each line
(b) to use XHTML version 5.0
(c) to avoid including absolute measurements, such as font size and table
width, in the body of the HTML
(d) to make sure always to have a “submit” element with each form element
94. Your database designer tells you, “I can’t show you my schema yet
because I’m not done building the tables”. You respond
(a) “The schema is a design document that I need to review and share with
the rest of the team before you finish the tables. In what format do you think
you can share it?”
(b) “Just print out what you’ve done so far”
(c) “I’ll finish the tables for you while you work on the schema”
(d) “Fine, but I need it done by Friday”
iSchool
Sample Test Question (code)
Questions 231 – x refer to the sample of PHP code below
$petname = $_REQUEST['petname'];
// first query - get the data, ownerID and FoodID from the Pets table
if ( !( $result = $database->query ( "SELECT Breed,Eats,OwnerID FROM Pets
WHERE Name = '$petname'") ) )
print ("Warning! could not execute query <br />" );
$row = $result->fetch_assoc();
$foodid = $row["Eats"];
$petbreed = $row["Breed"];
$ownerid = $row["OwnerID"];
// Now get the owner info (name, tel. and e-mail)
if ( !( $result = $database->query ( "SELECT Name,TelNo,EMail FROM
PetOwners WHERE OwnerID = '$ownerid'") ) )
print ("Warning! could not execute query <br />" );
$row = $result->fetch_assoc();
$ownername = $row["Name"];
$ownertelno = $row["TelNo"];
$owneremail = $row["EMail"];
iSchool
Sample Test Question (code)
231. You test the form that “posts” to this PHP script and hit the “submit”
button. The script seems to execute but the screen is blank – nothing is
printed, no errors. Your best next step is:
(a) Insert an “else” in the line after each print command, surround the next
four lines in curly braces {}, and try it again.
(b) Look for a missing semicolon somewhere in the script
(c) Check the database using the PHPMyadmin interface to see if the script
changed any of the tables (e.g., Pets or PetOwners)
(d) Insert print statements such as print(“Owner id is $ownerid<br>”);
print(“Owner name is $ownername<br>”); after each query to try to make sure
everything is working as expected.
232. One line of the script is $petname = $_REQUEST['petname']; the
purpose of this line could be
(a) To update the Name field in the Pets table of the database
(b) To set the value of the variable $petname to the text string entered in the
corresponding form for an <input> element with name = “petname”
(c) To create a pull-down menu of pet names from the database
(d) To open the petname database
iSchool
Questions?