What is a client?
The requesting system in a client/server relationship, e.g., the user of an organization system making client requests for records from the server.
What is a server (general definition)?
A special computer that provides services to other computers in the same or other computers.
List the specifications to consider when choosing a server.
Most powerful processor; operating systems supported (Windows Server 2008); appropriate number of licenses; appropriate memory; UPS with software to perform proper shutdown.
What is a web browser? Give examples.
The web client: software that allows you to interact with information available on the Internet, e.g., Netscape Navigator, MS Explorer and Firefox.
What is HTML, and why is it a standard?
A tagging language used to compose documents viewed by a web browser. It is a standard so that, whatever computer platform is used, the browser knows how to display the document.
Web page vs. web site
Web page: a mixture of text, graphics, sound and animation in HTML format. Web site: a collection of web pages connected (linked) by hypertext clickable links.
What is web site storage/hosting?
After a web site is designed, it must be stored on a computer that can be accessed through the Internet and the World-Wide Web.
Define protocol.
A set of conventions governing the processing and especially the data in an electronic communications system.
What is TCP/IP, and which basic services does it provide?
A set of protocols developed to allow cooperating computers to share resources across a network. Basic services: file transfer, electronic mail, remote logon, etc.
What is HTTP? What does the "s" in HTTPS stand for?
HTTP: the set of rules for exchanging files (text, graphic images, sound, video, other multimedia) on the World Wide Web; an application protocol. The "s" stands for security: HTTPS works the same way as HTTP but is used securely.
Which protocol does e-mail use, and what is it?
SMTP (Simple Mail Transfer Protocol): the standard protocol used to exchange Internet mail between TCP/IP hosts.
What is FTP, and why can almost any computer use it?
The standard used to transfer (copy) any kind of file over the Internet. It is not platform-specific, so any computer (DOS, Macintosh, Unix, etc.) connected to the Internet can copy files.
What is Telnet?
The way you can access someone else's computer, assuming they have given you permission.
What is a URL, and what general form does it take?
A "standard" way of easily expressing the location and data type of a resource. General form: "protocol://address" (protocol e.g. HTTP, FTP, telnet; address = the server name of the resource or page).
What does DNS do? Give an example.
A network service that associates host names (alphanumeric) with their equivalent TCP/IP address using a standard look-up table, e.g., translating http://www.afterzed.com/ into 65.108.17.93.
What is a domain on the Internet?
A registration category identifying geographic or purpose commonality.
Name the seven top-level domains currently in use.
com, edu, gov, int, net, org, mil.
Which two top-level domains are strictly reserved for the U.S.? Which is the largest?
gov (a branch of the U.S government) and mil (a branch of the U.S military) are strictly reserved. com is the largest domain extension currently used.
Outside these top-level domains, what does the final part of a domain name often represent?
The country in which the server is located, like sd for Sudan.
What technically distinguishes the Internet, and where does the term come from?
Its use of a set of protocols called TCP/IP. The term "Internet" comes from the concept of "internetworking".
How is the WWW distinguished from the Internet it runs on?
They are not the same. The WWW is a pair of software applications that allow distribution of and access to information on the Internet; it is a means of distributing and accessing the information that is on the Internet.
Who started the Internet's early projects, and what changed in 1991?
The US military in the early 1960s (DARPAnet). In 1991 the National Science Foundation backed off its subsidy of the backbone network and allowed commercial access.
What does a web server do? Give examples.
It stores and transmits web documents (files), using the HTTP protocol to connect to other computers and distribute information. Examples: IIS, Apache, Sun Java System Web Server.
What is an ISP?
A company that provides individuals and other companies access to the Internet and other related services such as web site development and hosting.
What is a firewall?
A program, usually an Internet gateway server, that protects the resources of one network from users from other networks.
Name two screening methods a firewall can use.
Check requests come from acceptable domain names and IP addresses; or do not allow Telnet access except for your own users.
What is e-commerce?
The buying and selling of goods and services on the Internet, especially on the World-Wide Web.
What is a Java applet, and what is its advantage?
A small program run on the Web using Java (object-oriented). Sent along with a web page, it can perform interactive animations and immediate calculations without sending the user's request back to the server.
Who can use XML, and who recommends it?
Any individual, group or company that wants to share information in a consistent way. It is a formal recommendation from the World-Wide Web Consortium (W3C).
How are XML and HTML similar, and what is HTML's limitation?
Both contain markup symbols to describe the contents of a page or file. HTML describes a page's content only in terms of how it is to be displayed and interacted with (e.g., <P> starts a new paragraph).
What is e-mail, and how important is it on the Internet?
The exchange of computer-stored messages by telecommunication. One of the first uses of the Internet and probably still the most widely used application; a large percentage of Internet traffic is e-mail.
Search engine vs. meta-search engine
Search engines store information in databases and return a list of sites as hyperlinks. Meta-search engines keep no database; they combine results from multiple search engines.
Define intranet.
Private corporate information and collaboration systems that use Internet software and standards.
Give four reasons for a company to use an intranet.
Any four from the slides: increases market share, profitability and efficiency; ideal for publishing continuously updated corporate information; not expensive, information anywhere at any time; usable across WANs; easy to install and inexpensive to administer; eliminates printing and out-of-date information.
Define extranet.
A collaborative network that uses Internet technology to link businesses with their suppliers, customers or other businesses that share common goals.
Two ways an extranet can be viewed
As part of a company's intranet that is made accessible to other companies, or as a collaborative Internet connection with other companies.
Give two extranet applications and what an extranet usually requires.
Any two: private newsgroups; shared training programs; shared product catalogs for wholesalers; project management and control for companies in a common project. It usually requires a degree of security and privacy from competitors.
What does HTML5 specify?
The structure and content of documents that are displayed in web browsers.
Name the four "more sophisticated" HTML5 techniques listed in the introduction.
Tables, forms, internal linking, and meta elements.
Which filename extensions are used for HTML5 documents?
.html or .htm
Why is the DOCTYPE required in HTML5 documents?
So that browsers render the page in standards mode. (Some browsers use quirks mode for backward compatibility with pages that are not up-to-date.)
How do HTML5 comments start and end? Does the browser show them?
They start with <!-- and end with -->. The browser ignores comments when rendering.
head section vs. body section
head: information about the document (character set, title; can also hold CSS3 style sheets and scripts). body: the page's content, which the browser displays.
What is UTF-8?
The most popular character-encoding scheme for the web (the character set given in the head section).
Start tag, end tag and void element
Start tag: element name in angle brackets, e.g. <html>. End tag: name preceded by a forward slash, e.g. </html>. Void elements do not have end tags.
How is an attribute written?
In a start tag, as a name and a value separated by an equals sign (=).
Where does the title appear, and how do search engines use it?
In the browser's title bar/tab and as the text identifying a bookmark. Search engines use the title for indexing purposes and when displaying results.
What does a validation service such as validator.w3.org do?
It ensures that an HTML5 document is syntactically correct (syntactically correct documents are guaranteed to render properly).
How many heading elements are there, and which is the most significant?
Six (h1 through h6). h1 is the most significant and is rendered in the largest font; each successive heading is progressively smaller.
How do browsers display text hyperlinks by default?
Underlined and colored blue.
What does the strong element indicate?
That the content has high importance (browsers typically render it in bold).
What can the href attribute of an anchor point to?
A web page or a location within a web page, a file, or an e-mail address.
What happens when a URL names no specific document, and when the document cannot be found?
No document: the server returns a default web page, often index.html. Not found: the server returns a 404 error and the browser shows an error page.
How do you link to an e-mail address?
With an anchor whose href is a mailto: URL, e.g. <a href = "mailto:deitel@deitel.com">…</a>. Clicking it typically opens the default e-mail program.
What are the most popular image formats used by web developers?
PNG (Portable Network Graphics) and JPEG (Joint Photographic Experts Group).
img: what do src and alt do, and is alt optional?
src specifies the image's location. alt (required on every img) contains text displayed if the client cannot render the image; speech synthesizers read it, so it should describe the image.
Are width and height required on img? What unit?
No, they are optional; if omitted the browser uses the image's actual width and height. Images are measured in pixels.
What is a void element? Give an example and how it can be terminated.
An element that contains only attributes and does not mark up text, e.g. img (or br). It can be terminated with a forward slash inside the closing angle bracket: <img … />.
What form do character entity references take, and what can the code be?
&code; — the code can be a word abbreviation or a number (decimal or hexadecimal).
Entity references for ©, &, < and non-breaking space
© = © & = & < = < non-breaking space =
Which elements give subscript, superscript and strike-through text in Fig. 2.9?
sub (subscript, e.g. x<sub>1</sub>), sup (superscript, e.g. 10<sup>2</sup>), del (strike-through).
ul vs. ol
ul (unordered list): each item begins with a bullet symbol (typically a disc). ol (ordered list): each item begins with a number. Each entry in both is an li element.
Why nest lists?
To represent hierarchical relationships, as in a multi-level outline.
What do the table's caption element and summary attribute do?
caption: specifies the table's title. summary: summarizes the table's contents; used by speech devices to make the table accessible to users with visual impairments.
Three sections of a table and what each holds
thead: table titles, column headers. tbody: primary table data. tfoot: calculation results, footnotes — written above the body in the code but displayed at the bottom.
tr, th and td
tr defines a table row; th defines a header cell; td contains table data.
What do rowspan and colspan do, and where can they go?
They merge cells: their values give the number of rows or columns the cell occupies. They can be placed inside any data cell or table header cell.
Why should br and hr be avoided?
They are considered legacy formatting elements; in general, formatting should be specified using CSS.
method="post" vs. method="get"
post appends the form data to the browser request (which contains the protocol and the requested resource's URL). get appends the form data directly to the end of the URL, where it is visible in the browser's Address field.
What does the form's action attribute specify?
The script to which the form data will be sent (the form handler).
What are hidden inputs?
Nonvisual form components that store any data you specify, such as e-mail addresses and HTML5 document file names that act as links.
In a text input, what do label, size and maxlength do?
label: tells users the input element's purpose. size: number of characters visible in the field. maxlength (optional): limits the number of characters input.
submit vs. reset
submit: sends the form's data to the location in the action attribute (value sets the button text). reset: returns all form elements to their default values.
textarea: rows and cols
textarea inserts a multiline text area; rows sets the number of rows and cols the number of columns (characters per line).
What does the password input send to the server?
The actual value typed — not the asterisks that mask the input on screen.
checkbox vs. radio
Checkboxes can be used individually or in groups (same name), and several can be checked. Radio buttons: only one in a group can be selected; all have the same name but different values.
How is a drop-down list made?
With select (its name attribute identifies the list); option elements add the items.
How do you link to a section of the same page?
Give the target element an id and use the syntax #id as the link's href.
keywords vs. description meta elements
keywords: content lists words describing the page, compared with words in search requests. description: content gives a three- to four-line description of the site in sentence form, used to catalog it and sometimes shown in search results.
What does the color input type let the user enter, and how did most browsers render it at the time of writing?
A color. Most browsers rendered it as a text field for a hexadecimal code or a color name (a color picker was expected in the future).
What does autofocus do, and how many elements on a form can use it?
It automatically gives the focus to the input element so the user can begin typing immediately. It is optional and can be used in only one input element on a form.
Three benefits of self-validating HTML5 input types
No need for complicated JavaScript validation code; less invalid data submitted; less Internet traffic between server and client to correct invalid input.
If inputs validate themselves on the client, should the server still validate?
Yes — the server should still validate all user input.
How do you bypass HTML5 validation when submitting?
Add the formnovalidate attribute to the submit input: <input type = "submit" value = "Submit" formnovalidate />
In what format does the date input expect a date?
yyyy-mm-dd, e.g. 2012-01-27.
datetime vs. datetime-local
datetime: date, time and the time zone set to UTC. datetime-local: date and time in a single control (year, month, day, hour, minute, second, fraction of a second) — no UTC time zone mentioned.
Formats of the month and week input types
month: yyyy-mm (e.g., 2012-01). week: yyyy-Wnn where nn is 01–53 (e.g., 2012-W01 = first week of 2012).
What must a time value contain according to the HTML5 specification?
Two digits for the hour, a colon (:), and two digits for the minute; optionally a colon and two digits for seconds and a period followed by one or more digits for a fraction of a second.
Does the email input type check whether an address really exists?
No. HTML5 only validates that the e-mail address is in the proper format. (With the multiple attribute it accepts a comma-separated list.)
What is placeholder text, and what happens to it on focus and on submit?
Temporary (usually light gray) text showing an example of what/how to enter. It disappears when the focus is placed in the field and is not submitted (unless the user types the same text).
For which input types does HTML5 support placeholder text?
Only six: text, search, url, tel, email and password.
What does the required attribute do, and which input types can use it?
It forces the user to enter a value before submitting the form. It can be added to any of the input types.
number input: min, max, step and value
min = minimum valid number; max = maximum valid number; step = increment in which numbers increase; value = initial value displayed.
How does range appear, and why is it inherently self-validating?
As a slider control. It is self-validating because the user cannot move the slider outside the minimum or maximum bounds.
How does the search input type compare with a text input?
It is functionally equivalent to an input of type text (Chrome and Safari show an X to clear it).
Does HTML5 self-validate the tel input type? How did the example enforce a format?
No. The example added a pattern attribute with a regular expression requiring the format (555) 555-5555.
Is www.deitel.com a valid value for a url input? What does HTML5 check?
No — the proper format is http://www.deitel.com. HTML5 checks only that the URL is in the proper format, not that it is valid/exists.
What does autocomplete do, and where would you turn it off?
Automatically fills in the user's information based on previous input (name, address, e-mail). It can be on for a whole form or specific elements; set it "off" for credit card and password inputs for security.
What does the datalist element provide, and how is it connected to the input?
Input options for a text input element. The input's list attribute names the datalist's id (Fig. 3.17: list = "months" and <datalist id = "months">).
header: what can it contain, and how often can it be used?
Text and graphics — headings (h1–h6), navigation, images and logos. It can be used multiple times on a page.
time and nav
time identifies a date, a time or both (it does not need to be inside a header). nav groups navigation links.
figure and figcaption
figure describes a figure (image, chart or table) so that it could be moved to the side or another page; figcaption provides its caption.
What is an article element? Can articles be nested?
Standalone content that could be used or distributed elsewhere (news article, forum post, blog entry). Yes — e.g., reader comments nested as an article within a magazine article.
Which element displays a right-pointing arrow next to a summary, and what happens when it is clicked?
The summary element. When clicked, the arrow points downward and reveals the content in the details element.
section vs. aside
section: a section of a document, usually with a heading (can be nested, also inside an article). aside: content related to the surrounding content but somewhat separate from the flow of the text (e.g., background history in a news story).
What does meter render? Give example values.
A visual representation of a measure within a range. Example: min = "0", max = "54" (total survey responses), value = "14" (people who answered yes).
What does footer describe, and what did the example put in it?
Content that usually appears at the bottom of the content or section element; the example used it for the copyright notice and contact information.
mark vs. wbr
mark highlights the text enclosed in it. wbr indicates the appropriate place to break a word when text wraps (to avoid an awkward break).
What are Cascading Style Sheets 3 (CSS3) used for?
To specify the presentation of elements separately from the structure of the document.
What is an inline style?
A style that declares an individual element's format using the HTML5 style attribute, e.g. <p style = "font-size: 20pt;">.
How are CSS property declarations written?
Each property is followed by a colon and its value; multiple declarations are separated by a semicolon.
Where is an embedded style sheet placed?
In the HTML5 document's head section, inside a style element.
Which MIME type do style sheets use?
text/css (the style element's type attribute).
MIME types: text/javascript, text/plain, text/html, image/png, image/jpeg
text/javascript = JavaScript markup; text/plain = plain text; text/html = HTML markup; image/png = PNG images; image/jpeg = JPEG image (and text/css = CSS documents).
Which property sets boldness? Give its values and numeric equivalents.
font-weight: bold, normal (default), bolder, lighter, or 100–900 in multiples of 100; normal = 400, bold = 700.
How are style classes and id selectors written?
A style class is preceded by a period, e.g. .special { color: purple; }, applied with class = "special". An id selector has the form #elementId.
Why use generic font families?
They let authors specify a type of font instead of a specific font, in case a browser does not support a specific font.
Why are relative font-size values preferred over points?
Because an author does not know the specific measurements of each client's display; relative values permit more flexible viewing (users can change font sizes for readability).
User, author and user-agent styles: which takes precedence?
User styles take precedence over user-agent styles; author styles take precedence over user styles.
Why are they called "Cascading" Style Sheets?
Styles cascade, or flow together, so the ultimate appearance of elements results from combining styles defined in several ways.
A child em and its parent p set different colors. Which wins, and why?
The child's style — properties defined for child and descendant elements have higher specificity than those for parents and ancestors, and conflicts are resolved in favor of higher specificity.
Values of text-decoration
underline, overline, line-through, blink.
What is a pseudoclass, and when is hover activated?
Pseudoclasses give access to content not declared in the document. hover is activated when the user moves the mouse cursor over an element.
List the relative length units.
px (pixels — varies with screen resolution), em (height of uppercase M), ex (height of lowercase x), percentages (of the default font size).
List the absolute length units and the pt/pc conversions.
in, cm, mm, pt, pc. 1 pt = 1/72 in; 1 pc = 12 pt.
What is an external style sheet, and what is "skinning"?
A separate document containing only CSS rules. Modifying that single CSS file changes the styles across all pages that use it — sometimes known as skinning.
How are CSS comments written, and where can they go?
They start with /* and end with */, and may be placed in inline styles, embedded style sheets and external style sheets.
Write the link element for styles.css and explain rel, type and href.
<link rel = "stylesheet" type = "text/css" href = "styles.css">. rel = relationship between the documents (a stylesheet); type = MIME type of the linked document; href = URL of the style sheet.
background-image and background-position: format and values
background-image: url(fileLocation). background-position: top, bottom, center, left and right, individually or combined, or lengths.
Values of background-repeat
no-repeat (one copy), repeat (default; vertical and horizontal tiling), repeat-x (horizontal only), repeat-y (vertical only).
What does background-attachment: fixed do? What is the default?
It fixes the image in the position set by background-position, so scrolling does not move it. The default, scroll, moves the image as the user scrolls.
text-indent
Indents the first line of text in the element by the specified amount.
text-align values and what overflow: scroll does
text-align: center, left, right. overflow: scroll adds scroll bars when content exceeds the element's set width and height.
Order the box model from the inside out.
Content → padding → border → margin.
Padding vs. margin
Padding: the distance between the content inside an element and the inside of its border (the element's edge). Margin: the space between the outside of the element's border and all other content on the page.
The three border properties and their values
border-width (any CSS length, or thin, medium, thick); border-color; border-style (none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset).
What does floating an element do?
Moves the element to one side of the screen; other content then flows around it.
What are media types? How do you write styles for all media and only for print?
They let you decide how a page looks depending on the media used (most common: screen). @media all { … } for all media; @media print { … } for print only.
Name the media features listed for media queries, and how orientation is decided.
width, height, device-width, device-height, orientation, aspect-ratio, device-aspect-ratio. Orientation is portrait if height > width, landscape if width > height.
Which property and pseudoclass build a CSS drop-down menu?
:hover (styles while the mouse is over an element) and display (block, inline, or none = not rendered). Fig. 4.17: nav ul { display: none; } nav:hover ul { display: block; }
User style sheets: where are they set, and which font sizes override them?
In the browser's options (not linked to the document). Absolute font sizes override user style sheets; relative sizes yield to the user-defined style.
What are the four values of text-shadow, in order?
Horizontal offset, vertical offset, blur radius, color.
Negative horizontal offset vs. negative vertical offset in text-shadow
A negative horizontal offset moves the shadow to the left; a negative vertical offset moves it up.
What does a blur radius of 0px produce, and what happens as it increases?
0px gives a shadow with a sharp edge (no blur); the greater the value, the greater the blurring of the edges.
Which property makes rounded corners, and when is an end completely round?
border-radius. Any value greater than half of the shortest side length produces a completely round end.
How do you round only one corner?
Use border-top-left-radius, border-top-right-radius, border-bottom-left-radius or border-bottom-right-radius.
box-shadow: which elements can have it, and what do positive offsets do?
Any block-level element. A positive horizontal offset moves the shadow right; a positive vertical offset moves it down.
What is a linear gradient, and what are color-stops?
A type of image that gradually transitions from one color to the next horizontally, vertically or diagonally. Color-stops are the points (pixels or percentages along the gradient line) where colors change.
Where can gradients be used?
In any property that accepts an image.
What are vendor prefixes used for?
For properties that are still being finalized in the CSS specification but have already been implemented in various browsers (e.g., -webkit-, -moz- in the code figures).
Why is a CSS3 gradient background written three times (-webkit-, -moz- and standard)?
Once for WebKit browsers (-webkit-gradient), once for Firefox (-moz-linear-gradient) and once in standard CSS3 (linear-gradient), because many CSS3 features were not yet finalized.
What is a radial gradient?
A gradient in which the color changes gradually from an inner point (the start) to an outer circle (the end).
The three values of radial-gradient in Fig. 5.6
The position of the start (e.g., center; or top, bottom, left, right), the start color, and the end color: radial-gradient(center, yellow, red).
What does -webkit-text-stroke do, and what two values did the example use?
A nonstandard WebKit property that adds an outline (text stroke) around text. Values: outline thickness (2px) and stroke color (black).
-webkit-box-reflect: first and second values
First: the direction of the reflection (above, below, left or right). Second: the offset — the space between the image and its reflection. Optionally a gradient.
With multiple background images, how are positions matched to images, and what does background-origin do?
The comma-separated background-position values match the order of the comma-separated images. background-origin decides where each image is placed using the box model (e.g., border-box or content-box).
How does border-image-slice divide the image?
Into nine regions — four corners, four sides and a middle (transparent unless specified) — using four inward offsets from top, right, bottom and left. No negative values; two values = top/bottom and left/right; percentages allowed.
Stretched vs. repeated image border
Stretched: the sides are stretched (distorted) to fit while the corners stay unchanged. Repeated (border-image-repeat: repeat): the tiles are repeated to fit, using partial tiles to fill excess space.
Order of values in the animation shorthand
animation-name, animation-timing-function, animation-duration, animation-delay, animation-iteration-count, animation-direction.
Which timing function is the default, and what does it do?
ease — starts slowly, increases speed, then ends slowly.
ease-in vs. ease-out vs. ease-in-out
ease-in: starts slowly, then speeds up. ease-out: starts faster, then slows down. ease-in-out: starts and ends slowly.
What do iteration-count infinite and direction alternate mean?
infinite repeats the animation continuously. alternate runs the animation in alternating directions each cycle (the default, normal, runs the same direction).
Can animation-play-state be part of the animation shorthand? What is its default?
No — it must be specified separately. It specifies whether the animation is paused or running, and defaults to running.
What does the @keyframes rule define?
The element's properties that will change during the animation, the values they change to, and when they change; it is followed by the animation's name.
Transition vs. animation
A transition specifies only the starting and ending values of the changing properties; an animation's keyframes control intermediate states throughout its duration.
Explain transition: transform 4s, opacity 2s;
The transform takes four seconds to apply and the opacity changes over two seconds, so the transform continues for another two seconds after the opacity change completes.
rotate and scale transformation functions
rotate receives degrees (negative values rotate left). scale: 1 = original width/height; values > 1 increase size, < 1 decrease size.
Which elements does :hover work with now?
Any element (it formerly worked only for anchor elements).
What does skew do?
Slants block-level elements at an angle horizontally (skewX) or vertically (skewY).
column-count, column-gap and column-rule
column-count: number of columns; column-gap: spacing between columns; column-rule: a line between each column.
What is PHP, and what kind of pages is it used for?
PHP: Hypertext Preprocessor — the most popular server-side scripting language for creating dynamic web pages. It is open source and platform independent.
Where is PHP code executed, and how is it delimited?
It is interpreted by the server before the page is delivered to the client. Code goes between <?php and ?>; files end with .php.
How are PHP variables written and created?
They are preceded by a $ and are created the first time they are encountered. Names are case sensitive.
PHP comment styles
Single-line: // or #. Multiline: /* … */.
What is interpolation in PHP?
When a variable appears inside a double-quoted string, PHP inserts the variable's value where its name appears. It happens on the server before the document is sent.
What does "loosely typed" mean for PHP variables?
They can contain different types of data at different times.
List the PHP data types.
int/integer, float/double/real, string, bool/boolean, array, object, resource, NULL.
What are the resource and NULL types?
resource: an external source — usually information from a database. NULL: no value.
What do gettype and settype do?
gettype returns the current type of its argument. settype takes a variable and its new type and converts it.
What happens when settype converts "3.5 seconds" to double, then to integer?
To double: 3.5 (the number at the beginning of the string). To integer: 3 — doubles are truncated, so data can be lost. A string with no leading number evaluates to 0.
settype vs. casting
settype changes the variable's type (and value). Casting, e.g. (integer) $data, does not change the variable's content — it creates a temporary copy of its value in memory.
Which operator concatenates strings in PHP?
The concatenation operator, a period (.).
How does define work, and what happens if you assign to a constant later?
define(name, value[, caseInsensitive]) creates a named constant; constants are case sensitive by default. Assigning a value to a constant after it is declared is a syntax error.
What value does an uninitialized variable have in a numeric context?
0 — e.g., multiplying a number by an uninitialized variable results in 0, so initialize variables before use.
Where may PHP keywords not be used?
As function, method, class or namespace names.
How do you create an array element, and append one?
Assigning to an element of a nonexistent array creates the array; assigning with the index omitted, e.g. $first[] = "three";, appends a new element to the end.
What do count and array do?
count returns the total number of elements in an array. array creates an array containing its arguments; the first is at index 0.
What is an associative array, and how is it created?
An array with nonnumeric indices, created with =>: index on the left, value on the right, e.g. array( "January" => "first" ).
reset, key and next
Each array has an internal pointer. reset sets it to the first element; key returns the index of the current element; next moves it to the next element.
foreach with one variable vs. two variables after as
Two variables: the first gets the element's index, the second its value. One variable: it gets the element's value.
What does strcmp return?
-1 if the first string alphabetically precedes the second; 0 if they are equal; 1 if the first alphabetically follows the second.
What is a regular expression?
A series of characters that serve as pattern-matching templates (search criteria) in strings, text files and databases.
preg_match: arguments
The regular-expression pattern and the string to search; an optional third argument is an array that stores the matches (element 0 = the whole match, then each parenthetical part left to right).
Metacharacters ^, $ and .
^ matches the beginning of a string; $ matches the end; . matches any single character.
Bracket expressions, ranges and \b
A bracket expression [ … ] matches any single character from the list; a range uses a dash, e.g. [a-z]; \b before and after a group marks the beginning and end of a word (whole words).
How are character classes written?
Enclosed by [: and :], e.g. [:alpha:]; placed inside another set of brackets ([[:alpha:]]) they match all characters in the class.
preg_replace: arguments and return value
Three arguments: the pattern to match, the replacement string, and the string to search. It returns the modified string.
What are superglobal arrays? Give two.
Associative arrays predefined by PHP that hold variables from user input, the environment or the web server, accessible in any variable scope. $_GET and $_POST hold data from HTTP get and post requests.
What does die do?
Terminates script execution; its optional string argument is printed as the script exits.
Why must important form data be validated on the server?
Business logic must ensure invalid information is not stored in databases, and JavaScript may be disabled by the client.
mysql_connect: arguments and return value
The server's hostname, a username and a password. It returns a database handle, or false if the connection fails.
mysql_query and mysql_fetch_row
mysql_query runs a query on a database and returns a result resource (or false); it can also run INSERT or DELETE. mysql_fetch_row returns an array of the column values in the current row of the result.
What is a cookie, and which cookies can a server access?
Information a server stores in a text file on the client's computer to maintain information during and between browsing sessions. A server can access only the cookies it placed.
Session cookie vs. persistent cookie
A session cookie has no expiration date and lasts until the user closes the browser; a persistent cookie has an expiration date.
How is a cookie deleted, and why must setcookie come before any output?
Calling setcookie with only the name deletes it. Cookies are sent with the HTTP header, so setcookie must be called before any other output.
What should cookies not store?
E-mail addresses, passwords or private data.
isset and $$variable
isset determines whether $_POST contains keys for the form fields. $$variable is a variable variable: the value of the variable whose name equals the value of $variable.
What does mysql_real_escape_string do?
Inserts a backslash (\) before any special characters in the passed string.
Where can a web script run?
Client side (in the web browser used to view the pages) or server side (on the server that hosts the website).
What is client-side scripting?
Scripts executed on local computers after you have loaded the web pages.
Which languages can the browser understand?
JavaScript, HTML (the structure of the page) and CSS — not PHP.
What is JavaScript used for?
It is a scripting language used to enhance the functionality and appearance of web pages.
What is the BOM? Name its important objects.
The Browser Object Model, used to interact with the browser. Important objects: document, location, history, navigator, screen, frames.
What is the DOM, and how does it organize a page?
The Document Object Model deals with the document's HTML elements, organizing them in a tree structure (DOM tree) in which every element is an object (a node) with properties and methods; the browser builds it when the page loads.
In an HTML document's DOM tree, what is the root element, and what are its two children?
The root element is <HTML>, under Document; its children are <HEAD> and <BODY>.
What processes JavaScript commands, and why are scripts often put in the head?
JavaScript interpreters in the browsers. The browser interprets the contents of the head section first.
What does the <script> tag do, and what does its type attribute specify?
It indicates that the text which follows is part of a script. type specifies the MIME type / scripting language, e.g. text/javascript (it may be omitted in HTML5).
What is a string literal?
A string of characters contained between double quotation (") marks.
What is an object?
Something residing in the computer's memory that contains information used by the script; it has attributes (data) and behaviors (methods), and its methods use the data to perform actions.
Is the semicolon required in JavaScript? Is JavaScript case sensitive?
Every statement should end with a semicolon (statement terminator), although none is required by JavaScript. Yes, it is case sensitive — wrong case is a syntax error.
writeln vs. write
writeln writes a line of HTML5 text in the document. write displays a string like writeln but does not position the output cursor at the beginning of the next line after writing.
Why place JavaScript code in a separate file?
It makes the code more reusable, because it can be included into any HTML5 document.
What is the + operator called when it joins two strings?
The concatenation operator.
Which object and method display an alert dialog?
The browser's window object, method alert; its argument is the string to display.
What is an escape sequence? Give \n and \t.
A backslash combined with the next character in a string. \n = newline (cursor to the beginning of the next line); \t = horizontal tab.
How do you put a double quote inside a double-quoted string, and a backslash?
\" for a double quote and \\ for a backslash (Fig. 6.4).
Dynamic vs. static web pages
Dynamic pages' content can change: scripting generates part or all of the page's content at the time it is shown.
What does prompt do, and what are its two arguments?
Displays a dialog into which the user can type a value. First argument: the message (prompt). Optional second argument: the default string in the text field.
What is a variable, and how is it declared?
A location in the computer's memory where a value can be stored for use by a script; it has a name, type and value and should be declared with the keyword var.
Rules for a valid JavaScript identifier
Letters, digits, underscores (_) and dollar signs ($); it must not begin with a digit and must not be a reserved keyword.
What does null mean, and what does writing it display?
It signifies that a variable has no value (it is not a string literal). Writing a null value to the document displays the word "null".
What does parseInt do?
Converts its string argument to an integer.
What does the % operator do?
It is the remainder operator: it yields the remainder after division.
Arithmetic precedence in JavaScript
*, / and % are applied first (left to right if several); + and - are applied next (left to right).
What does an if statement do?
Lets a script make a decision based on the truth or falsity of a condition: the body executes only if the condition is true.
Equality vs. relational operators: which have higher precedence?
Relational operators (>, <, >=, <=) have higher precedence than the equality operators (==, !=); equality operators associate left to right.
How do you get the current local time in JavaScript?
Create a Date object with the new operator: new Date().
What is an algorithm?
A procedure for solving a problem in terms of the actions to be executed and the order in which they are executed.
What is pseudocode? Is it a programming language?
An informal language, similar to everyday English, that helps you develop algorithms. It is not an actual computer programming language.
Sequential execution vs. transfer of control
Sequential execution: statements execute in the order they appear. Transfer of control: changing the order in which statements execute.
Which three control statements are enough to write all scripts?
Sequence, selection and repetition.
Name JavaScript's three selection structures and their kind.
if — single-selection; if…else — double-selection; switch — multiple-selection.
Name JavaScript's four repetition statements.
while, do…while, for and for…in.
Which values are reserved words in JavaScript besides keywords?
null, true and false (plus words reserved for possible future use).
What does the JavaScript interpreter do with white space?
It ignores white-space characters (blanks, tabs and newlines used for indentation and vertical spacing).
Describe the conditional operator ?: .
Closely related to if…else; JavaScript's only ternary operator (three operands): a boolean expression, the value if true, and the value if false.
In nested if…else, which if does an else belong to?
The interpreter always associates an else with the previous if, unless told otherwise by the placement of braces ({}).
How many statements may an if body contain? What is a block?
Only one statement; to include several, enclose them in braces { } — a set of statements in braces is a block.
Fatal vs. nonfatal logic error
Both take effect at execution time. Fatal: the script fails and terminates prematurely. Nonfatal: the script continues but produces incorrect results.
What does a while statement do?
Repeats an action while some condition remains true; when the condition becomes false, repetition terminates.
Why is counter-controlled repetition called "definite repetition"?
Because the number of repetitions is known before the loop begins executing.
Total vs. counter
A total accumulates the sum of a series of values (normally initialized to zero). A counter is a variable used to count, typically in a repetition statement.
What is a sentinel value, and what else is it called?
A special value that indicates the end of data entry. Also called a signal value, a dummy value or a flag value.
Why is sentinel-controlled repetition called "indefinite repetition"?
Because the number of repetitions is not known in advance.
How should a sentinel value be chosen?
So that it cannot be confused with an acceptable input value.
Two ways control statements can be combined
Stacked on top of one another in sequence, or nested inside one another.
List the arithmetic assignment operators.
+=, -=, *=, /= and %= — they abbreviate common expressions (e.g., x += 2 means x = x + 2).
Prefix vs. postfix increment
Prefix (++a): increment by 1, then use the new value in the expression. Postfix (a++): use the current value in the expression, then increment by 1.
When do ++c and c++ have the same effect?
When the variable is incremented in a statement by itself. Inside a larger expression they have different effects.
Fig. 7.15: which operator groups associate right to left?
The unary ++ and --, the conditional ?: and the assignment operators (=, +=, -=, *=, /=, %=). The others listed associate left to right.
What four things does counter-controlled repetition require?
The name of a control variable; its initial value; the increment (or decrement) by which it is modified each time through the loop; the condition that tests for its final value to determine whether looping should continue.
How do you put a double-quote character inside a JavaScript string literal?
Precede it with a \ to create the escape sequence \" (the double quote otherwise delimits the beginning and end of the string literal).
Which quotes may surround an HTML5 attribute value? Can a JavaScript string literal contain single quotes?
HTML5 allows either single quotes (') or double quotes ("). JavaScript allows single quotes to be placed in a string literal.
What three expressions does a for statement header contain?
Initialization; condition; increment expression.
What can cause an off-by-one error in a loop?
Using a < or > instead of a <= or >= in the loop's condition, or vice-versa.
How does the increment expression of a for statement behave?
It acts like a stand-alone statement at the end of the body of the for statement.
In a for statement, which parts are optional and which are required?
The three expressions are optional; the two semicolons are required.
What is a variable's scope?
The part of a script in which a variable name can be used.
What happens if the loop-continuation condition of a for is false at the start?
The body of the for statement is not performed; execution proceeds with the statement following the for statement.
What is a negative "increment" in a for statement called?
A decrement: the loop actually counts downward.
What does the loop for ( var number = 2; number <= 100; number += 2 ) sum += number; compute, and what is the result?
The sum of the even integers from 2 to 100: 2550.
How do you compute x raised to the y th power in JavaScript?
Math.pow(x, y) — JavaScript does not include an exponentiation operator.
Compound interest (principal 1000.00, rate 0.05, years 1–10): which statement computes each year's amount?
amount = principal * Math.pow( 1.0 + rate, year ); with principal = 1000.00 and rate = 0.05, for year 1 to 10.
What does the switch multiple-selection statement do?
It tests a variable or expression separately for each of the values it may assume; different actions are taken for each value.
Name the list-style-type values.
decimal (numbers — the default), lower-roman, upper-roman, lower-alpha, upper-alpha, others.
What does a switch statement do when control reaches it?
It evaluates the controlling expression in the parentheses and compares this value with the value in each case label; if a comparison is true, the statements after that case label execute in order until a break statement is reached.
What is the default case of a switch for?
To specify a set of statements to execute if no other case is satisfied; usually the last case in the switch statement.
Why is break not required for the last case of a switch?
Because program control automatically continues with the next statement after the switch.
What happens when several case labels are listed together with no statements between them?
The same set of actions executes for each of those cases (e.g., case 1: case 2:).
Are braces required around multiple actions in a case?
No. Each case can have multiple actions, and braces are not required around them.
When does do…while test its condition, and what follows from that?
After the loop body executes, so the loop body always executes at least once.
What does break do in a while, for, do…while or switch?
Causes immediate exit from the statement; execution continues with the next statement in sequence.
Two common uses of break.
Escape early from a loop; skip the remainder of a switch statement.
What does continue do in a while, for or do…while?
Skips the remaining statements in the body and proceeds with the next iteration of the loop.
After continue: what happens next in a for loop, compared with while / do…while?
In for statements, the increment expression executes, then the loop-continuation test evaluates. In while and do…while, the loop-continuation test evaluates immediately.
Name JavaScript's three logical operators.
&& (logical AND), || (logical OR), ! (logical NOT, also called logical negation).
When is expression1 && expression2 true?
Only when both conditions are true (Fig. 8.13).
When is expression1 || expression2 true?
When either or both of the conditions are true; false only when both are false (Fig. 8.14).
Precedence and associativity of && and ||.
&& has a higher precedence than ||. Both associate from left to right.
What is short-circuit evaluation?
An expression containing && or || operators is evaluated only until truth or falsity is known.
Why is ! a unary operator?
It has only a single condition as an operand; it reverses the meaning of that condition.
Which nonboolean values are considered false?
The numeric value zero; the empty string; the value null; variables that have been declared but not initialized. (Nonzero numbers, strings that contain characters and all objects are true.)
Fig. 8.16: which operator groups associate right to left?
The unary operators ++ -- !, the conditional ?:, and the assignment operators = += -= *= /= %=. All the others listed associate left to right.
Which three software platforms dominate the smart phone market?
Apple's iOS, Google's Android, and Microsoft's Windows Phone.
Why is Android relatively easy to port to any hardware platform?
Because the software is written in Java and executed with interpreters, similar to but not the same as the Java Virtual Machine (JVM).
What is the first required tool for Android development, and is the JRE enough?
The Java Development Kit (JDK). Just the Java Runtime Environment (JRE) is not sufficient.
Where are the other tools needed for Android development bundled?
In the Android Software Development Kit (SDK).
How does a servlet run when a Web server receives a request for it?
The servlet engine instantiates the servlet class and calls one of its methods, usually doGet or doPost (servlets act as slaves to the servlet engine).
What is an activity?
A class instance that has an associated view markup file to support user interactions. It manages one page of display. Activities are written in Java; an application includes one or more activities.
What do view files correspond to in a Web application?
To the forms in a Web application. Each activity has an associated view file.
What is an intent, and what is it used for?
A means of communications, both within applications and among applications; an instance of a Java class. Intents are used to start and stop activities, move control among activities, and pass data among activities and applications.
Name three key parts of an Android application.
Activities, views, and intents.
How are Android applications built and how is their Java code run?
As projects — single deployable systems (the simplest includes one or a few activities). The Java code is compiled to an intermediate form and interpreted, but not with a standard JVM.
When does an Android application stop executing?
When either the user starts another application or the operating system stops it because it needs its resources to run other applications that have higher priorities.
By what mechanism does Android control the execution of applications?
A collection of predefined callback methods that are implicitly called when certain events are raised by either system or user actions.
Where are an application's activities placed, and which one is in execution?
On a stack. The activity on top of the stack is the one currently in execution and whose view is displayed.
What does onCreate do, and when is it called for the main activity?
It sets the activity's interface (view), often initializes class-scope variables, and puts the activity in the created state. For the main activity it is called as soon as the user selects the application's icon.
onStart vs onResume.
onStart starts the activity and displays its view (started state); it is called as soon as onCreate finishes. onResume starts execution of the activity's code (resumed state, where the user interacts with the view); it is called as soon as onStart finishes.
Which activity states are transitional, and why?
The created and started states: onStart is called as soon as onCreate finishes, and onResume as soon as onStart finishes, so an activity cannot stay in these states for an extended period of time.
How does an activity leave the paused state, and how does it leave the stopped state (other than being destroyed)?
Paused → resumed when onResume is called on it. Stopped → started when onRestart is called on it.
Activity lifecycle: which callback leads from Resumed to Paused, from Paused to Stopped, and from Stopped to Destroyed?
onPause; onStop; onDestroy.
Activity lifecycle: how visible is an activity in the resumed, paused and stopped states?
Resumed: visible. Paused: partially visible. Stopped: hidden. (Started is also visible.)
Why are Android markup elements called views?
Because Android applications are built as Model-View-Controller (MVC) applications; the elements are all extensions of the View class.
From which class are layout managers (layouts) derived?
From the ViewGroup class.
Name the four layout managers in the Android SDK and how each arranges views.
LinearLayout: a vertical column or a horizontal row. FrameLayout: pins views around its frame. RelativeLayout: positions views relative to other views. GridLayout: a grid.
What is always the first attribute of a layout element, and what does it specify?
xmlns — it specifies the namespace of the elements and attributes used in the layout: http://schemas.android.com/apk/res/android.
What are TextView elements used for, and which four attributes do they usually include?
To define fixed text, often used for labeling other views. Attributes: id, layout_width, layout_height, and text.
In android:id = "@+id/the_name", what do @ and + mean?
@: the XML parser should parse and expand the rest of the string and identify it as a resource id. +: this is a new resource name that must be created and added to the resources (placed in the Android-generated file R.java).
Which method lets Java code refer to a view through its resource id in R.java?
findViewById.
What is EditText, and which attribute places initial text in it?
A subclass of TextView configured to allow its elements to be edited (similar to HTML textboxes and textarea, but more powerful). The hint attribute places initial text in an EditText control.
How is a keyboard shown on an Android device that normally displays no keyboard?
A standard keyboard is displayed by tapping in the text field; this also places the cursor in the text field.
How is the label of an Android button specified?
With the text attribute (e.g., android:text = "@string/button_send").
What is the event for a button click, and how is its handler registered in markup?
The event is Click. In markup, the name of the handler method is assigned to the onClick attribute of the Button element (android:onClick = "the_handler"). Handlers can also be registered in code.
What are the three steps for creating your first Android app?
1. Set up your development environment; 2. Create a new Android project in Eclipse; 3. Run it in the emulator.
What does AVD stand for, and when is it created?
Android virtual device; it is created while setting up the Android environment.
Do you need to restart the emulator for a new version of your application?
No. (The emulator may take a few minutes to start, so be patient.)
In HelloAndroid.java, which call in onCreate sets the activity's layout?
setContentView(R.layout.main), after super.onCreate(savedInstanceState).
In AndroidManifest.xml, which action and category does the HelloAndroid activity's intent-filter declare?
Action android.intent.action.MAIN and category android.intent.category.LAUNCHER.
What is local impact?
The effect of web-based systems and related technologies on the life of local communities — in our case Saudi citizens.
When is a system said to have global impact?
When it affects human life across the borders spanning multiple countries or geographical boundaries.
What has the development of web systems done to governmental services?
Made a lot of governmental services seamless and online.
Which kinds of services could web systems facilitate for local communities' development?
Citizen-centric services, health and defense services.
Why is the Web System course vital?
It builds young software professionals who could help a lot in the progress of KSA in the IT field.
Give two local examples of services that can be availed from home.
The https://www.moi.gov.sa/ portal and the Absher app.
How do web system-based services compare with traditional file processing based systems?
They are faster and cheaper.
Web Systems are "main pillars" of what?
Of the modern way of solving manual problems through digitization.
How do web systems reduce paper usage, and why does this matter more in KSA?
By facilitating the storage of data in databases. In KSA it is more important due to the availability of its manufacturing source like wood and other lignocellulosic materials such as cotton, rice or wheat straw (as stated on the slide).
How does online access to services lower carbon pollution locally?
It significantly lowers citizens' physical movement to offices, which lowers the vehicle-emitting carbon pollutions.
Give a global example of web systems impacting millions of lives.
https://help.unicef.org/, NGOs and other health related portals.
How can IT be described?
IT has changed every aspect of human life and can be said to be the most disruptive technology of 20th Century.
Which industries are affected by advanced web systems?
Every industry.
What kind of coordination do web systems facilitate globally?
Across the border coordination among organizations, businesses, community service providers and so on.
When and from where can web systems be accessed?
At any time from any where.
Name the two environmental effects of web systems in the global context.
Most services are online, significantly reducing paper usage; online services help in controlling traffic congestion and lowering carbon emission.
List the six benefits of Web System.
Low development cost; Easy Installation and Maintinance (as printed); Accessible Everywhere; Centralized Security; Increased efficiency; Easy Data Sharing and Collaboration.