CS 202 chapter 8 questions
If a question's correct answer is true and the user clicks the "True" button, what value is passed to QShow to indicate correct or not correct?
'yes' causes the QShow function to color the question's text blue, indicating correct. 'no' (or anything other than 'yes', actually) instead causes red.
Which status code is sent when the web server wants to redirect the browser to a different URL?
301 or 302, always accompanied by a location header that indicated the new URL that the browser should access
Which status code is sent when the web server compares the cached ETag with the server's ETag for a requested web resource, and the two ETags are identical?
304, When the ETags are equal, the web browser has an up-to-date cached copy of the web resource.
The instruction ancestors = ancestors * 2 on line 6 stores what new value in variable ancestors?
4
Which status code is sent when the web server is denied permission to the requested URL?
403
Which status code is sent when the requested URL does not point to an existing resource on the web server?
404
how many cars, machines, meters and other IoT devices did Cisco, a major network equipment manufacturer, predict would be connected to the internet in 2020?
49 billion
how many total HTTP requests does a browser send for a web page that contains four web resources: image, video, CSS style sheet, and Javascript file?
5
How many times does the loop's print instruction run? for i in range(1, 7): print(i)
6
Does the following HTML pass the HTML validator with no errors or warnings? <!DOCTYPE html> <html lang="en"> <h1>Test page</h1> <p>Does this page pass the validator test?</p> </html>
Although the <head> tag is not required and will be generated automatically by the browser, the <title> tag is required, so the validator generates an error.
<p id= "colorable text">...
Gives this paragraph a label, so that a function can find the paragraph to change the paragraph's color.
Which request method is used by the browser to get the same response headers that a GET would generate but without the message body?
HEAD, only requests the response headers
What is the current recommended version of the HTML standard?
HTML 5
< body> The California quarter features Yosemite valley. </body>
HTML content displayed by the browser
Where can the HTTP header field If-None-Match be found?
HTTP request
are human detectors or IBM's Watson more likely to keep up with new medical information in 2020?
IBM's Watson
What HTTP header field is used to make a conditional request using a datetime?
If-Modified-Since
onclick= "ChangeTextColor('red')"
Indicates that when the button is pressed, the JavaScript function ChangeTextColor should be executed, with the value 'red'.
screen size
Physical dimension in pixels of a device's screen. Mobile device screens are much smaller than desktops. Good design requires significant effort to make websites that work well for different screen sizes.
The first true/false question passes what value for function QShow's qid?
Q1
<html>
Tag that marks the start of an html document.
<button type="button" onclick="ChangeTextColor('blue')">Blue</button>
The HTML that should be added to create a third button.
What organization defines web standards?
World Wide Web Consortium
language
a set of rules describing how to write HTML
responsive web design
a web design approach that creates web pages that automatically move and resize parts depending on the display size and orientation
CSS background color
h1 {background-color: lightgray;}
user agent
identifies the browser making the request
server
identifies the web server software that generated the response
<!DOCTYPE html>
instructs the web browser about what type of document follows
Does the HTML follow the developer guidelines to start block-level elements on new lines? <h1>Olympics</h1><p>The IOC organises the modern summer and winter Olympic Games and Youth Olympic Games held every four years.</p>
no, <p> is a block tag and should start on a new line.
Does the HTML follow the developer guidelines to separate content from presentation and functionality? <html> <style>p { color: blue }</style> <body> <p>Once in a blue moon!</p> </body> </html>
no, An embedded style separates style from content within the HTML, but an external style sheet allows CSS presentation to be shared by multiple pages. So, an external style sheet is preferred over embedded styles.
Does the HTML follow the developer guidelines to use lowercase for tags and attributes? <img Src="https://apple.com/apple.jpg">
no, Attributes should be lowercase, including the first character.
Do web servers always generate ETags for all web resources?
no, ETags are not often produced for dynamic web content.
Does the HTML follow the developer guidelines to use lowercase for tags and attributes? <H1>Table of Contents</H1>
no, Even <h1> tags should use lowercase. Although HTML5 allows lowercase or uppercase tags, most web developers only use lowercase tags.
Does the HTML follow the developer guidelines to provide labels and placeholders? May we add you to our mailing list? <br> <label for="optInYes">Yes</label> <input placeholder="Add me" type="radio" name="optIn" id="optInYes" value="true"> <label for="optInNo">No</label> <input placeholder="Do not add me" type="radio" name="optIn" id="optInNo" value="false">
no, Placeholders cannot be used with radio buttons. Placeholders are only needed for elements that allow placeholders.
Does the HTML follow the developer guidelines to consistently indent nested elements? <form> <label for="name">Name:</label> <input type="text" id="name" name="name"> <label for="address">Address:</label> <input type="text" id="address" name="address"> <label for="city">City:</label> <input type="text" id="city" name="city"> </form>
no, Tags are indented at least two spaces, but the indentation is inconsistent. The input and label elements are contained in the form element, so the input and label tags should have the same indentation.
does the HTML follow developer guidelines to use boolean attributes? <a href="#" nofollow>Don't spam me!</a>
no, The <a> tag does not have a nofollow boolean attribute. Many search companies support a rel="nofollow" attribute to help indicate the link refers to paid content.
Does the HTML follow the developer guidelines to consistently indent nested elements? The all-time top grossing movies domestically<ol> <li>Avatar</li> <li>Titanic</li> <li>Jurassic World</li> </ol>
no, The <li> tags are not indented. Indenting the list items makes reading and understanding the HTML easier.
Does the HTML follow the developer guidelines to separate content from presentation and functionality? button onclick="return process_data()">Process Data</button>
no, The button combines functionality in the HTML by putting JavaScript in the onclick attribute.
The Python program has blank lines at lines 2, 5, and 8. Based on the program's output, do the blank lines seem to matter?
no, The output contains no blank lines, so those blank lines in the program seem to have no effect. In a program, blank lines are just used to improve readability for humans, providing separation between groups of related instructions.
Does the HTML follow the developer guidelines to provide labels and placeholders? <input type="text" name="favoriteSport" id="sport">
no, The text input field is missing a label and placeholder.
Does the HTML follow the developer guidelines to start block-level elements on new lines? <h1>Olympics</h1> <p>The <em>IOC</em> organises the modern Olympic Games and Youth Olympic Games, held in summer and winter, every four years. The first Summer Olympics organised by the IOC was held in Athens, Greece, in 1896</p>
no, While the <h1> and <p> block tags start on new lines, <em> is an inline tag and and may continue on the same line.
does the HTML follow developer guidelines to use boolean attributes? <div hidden="hidden">
no, hidden is a boolean attribute, and should not be assigned as value. <div hidden> should be used.
Does a 304 response generally contain a message body?
no, indicates the cached content is up-to-date, so re-sending the same content to the browser is unnecessary.
content-length
number of bytes in the response's message body
CSS font family
p {font-family: arial;}
CSS font size
p {font-size: 9pt;}
CSS margin
p {margin-left: 10px;}
<p>
paragraph
markup
part of a document that explains how to interpret or structure other parts of the document
Document Object Model (DOM)
provides way of organizing, accessing, and changing any part of a web page; JS and DOM use it
<section>
section
html
specifies document structure
CSS padding
strong {padding: 5px;}; spacing between element's content and border
</html>
tag that marks the end of the html document
<title> California State Quarter </title>
tag that names the document
<meta charset= "utf-8">
tag that specifies the character encoding used in the document
hypertext
text that contains connection to other documents
host
the domain name for the requested path
A technician installs devices that measure and report water chemical concentrations, water level, pump status, and water flow through the filter system
true
After the customer reports the water level, the receptionist could inform the caller that a service technician was already dispatched and was six minutes from arriving at the house
true
If the customer notices the low water level and calls, the company receptionist's browser can have the customer's pool status web page loaded by the time the receptionist answers the phone.
true
The pool control system periodically transmits summary data over the Internet to a pool service company's web server
true
To see how a web page is constructed, a user can view the page source in the browser
true
Web developers can sometimes ignore really old web browsers
true
a random website is more likely to have a visitor with low vision than a visitor who is totally blind
true
<a href="http://example.com" rel='nofollow'>
use double quotes,
<input type='text' name='zip'>
use double quotes, type='text' and name='zip' use single quotes.
<input type=checkbox checked>
use quotes around attribute values, type=checkbox should be type="checkbox"
<P> a short paragraph. </P>
valid
<em>You must read <cite>A Tale of Two Cities</cite>, one of the best selling books of all time.</em>
valid
<h2>Highway traffic code overview</h2>
valid
<p>This is a very short paragraph.</p>
valid
This is the first verse.<br />The second verse begins on the next line
valid
You <em>must</em> read <cite>A Tale of Two Cities</cite>, one of the best selling books of all time.
valid
An HTML _____ is a program that indicates whether a document follows the HTML standard
validator
affordances
visual clues that guide the user in figuring out how to use an app
Does the HTML follow the developer guidelines to start block-level elements on new lines? <label for="city">City:</label> <input type="text" name="city" id="name">
yes
how many total HTTP requests does a browser send for a web page that does not use any other web resources?
1
What is the value of ancestors after the following loop finishes running? ancestors = 2 for i in range(1, 4): ancestors = 2 * ancestors
16; 1st loop: ancestors = 2 * 2, so 4. 2nd loop: ancestors = 2 * 4, so 8. 3rd loop: ancestors = 2 * 8, so 16.
YEAR: The idea for generating links from within one document to other documents.
1945
YEAR: the term HyperText invented
1965
YEAR: first web browser is created
1990
YEAR: the W3C created
1994
YEAR: HTML 2.0 standard published
1995
What value does ancestors have when this instruction runs: print('Gen 1:', ancestors)
2
The program creates a variable named ancestors and sets the variable to what initial value?
2, ancestors = 2 associates the variable ancestors with a memory location, and sets that location's value to 2.
if a web browser sends 20 HTTP requests to a web server, how many HTTP responses will the web server send to the web browser?
20
What is the output of the following? leapYear = 2012 for i in range(1, 6): print(leapYear) leapYear = leapYear + 4
2012 2016 2020 2024 2028
YEAR: HTML.5 standard published
2014
write a heading for a book chapter titled "introduction?
<h1> Introduction </h1>
what tag is used for subchapter titles?
<h2>
write an HTML fragment that creates a title for the fourth level of the document hierarchy. The title should be "Exquisite details".
<h4> Exquisite details </h4>
mobile first
A web development approach that advocates first creating a reduced-feature version of a website for mobile users. Then, the developer creates a full-featured website for visitors using desktop computers.
before a TCP connection is created, the web browser performs a/an
DNS lookup, so the browser can establish a TCP connection with with web browser
x = document.getElementsByld("colorable text")
Finds the paragraph with id "Colorable text", and sets x to that paragraph. x can then be used to change that paragraph's attributes, like color.
which browser lost the most market share between 2010 and 2015?
Internet Explorer
Which request method is used by the browser to submit web form data to the web server?
POST, request method most often used to submit web form data to the web server
last modified
datetime the requested resource was last modified on the web server
date
datetime the response was generated by the web server
JavaScript
enables document interaction
really small businesses are exempt from web accessibility requirements
false
color blindness is so rare that web developers do not have to consider the issue when selecting colors for a web page
false, 8% of men are color blind, can distinguish red from green
If <h1> text appears too big, <h2> or <h3> tags can be used to decrease the text size
false, A heading tag is used to indicate the title and level of a section and not the formatting of section headings. The visual appearance of the heading tags can be changed.
To copy the functionality of another web page found on the Internet, just copy the HTML from the view source page
false, Although copying and pasting may create an identical page structure, the web page may not function identically because the copied page may be missing the images, CSS, and JavaScript necessary for the page to function properly. Also, copying a web page's contents likely violates copyright law
The pool company would have to send a technician to the pool to change the control system settings
false, IoT based control systems can be built so that a technician can access and modify system settings via a web page from anywhere on the internet
Web developers typically create web pages using new features available exclusively on a particular browser.
false, New features can add additional functionality or visual appeal to a web page. However, the extra effort required to incorporate the browser-specific features, while simultaneously ensuring that the page works well on other browsers, is hard to justify
The <p> tag can have another <p> tag inside
false, Paragraphs cannot be placed inside other paragraphs, so a <p> tag cannot be used inside another <p> opening and closing tags
The <br> tag has a closing tag
false, The <br> tag is one of the few HTML tags that does not have a closing tag.
unlike the blind, people who are deaf do not need special accommodation for websites
false, captions and transcripts are provided
Because Chrome is by far the leading browser worldwide, testing a web page only really needs to be done using Chrome
false, web page should equally work well for any commonly used browser
The pool company will not know that the water level is too low unless the customer calls or someone happens to check the system status web page
false, when a company server receives data indicating that the water level is dangerously low, the server can create an entry in the problem reporting system.
<h1>
first level heading
<p>Sentence one.<strong> Sentence two.</p>
invalid, <strong> does not have a closing tag
<p>We changed the <strong><em>font</strong></em> in this paragraph.</p>
invalid, A tag opened inside another must be closed before the outside tag is closed: <strong><em>font</em></strong>
<p>HTML is derived from HyperText Markup Language. <p>The inspiration for HTML was SGML, the Standard Generalized Markup Language</p> HTML is simpler than SGML and adds hyperlinks.</p>
invalid, HTML5 prohibits placing a paragraph inside another paragraph.
You must read <em><cite>A Tale of Two Cities</em></cite>, one of the best selling books of all time.
invalid, This HTML markup is illegal because the <cite> opening tag is placed after the <em> opening tag, but the </cite> closing tag is placed after the <em> tag.
<h1>This is a chapter heading
invalid, missing closing tag
<br>
line break
Cascading Style Sheets (CSS)
manages document presentation
content-type
media type of the response's message body
Is Internet browsing more likely to be done using desktop computers or mobile devices in 2020?
mobile
Does the following HTML pass the HTML validator with no errors or warnings? <!DOCTYPE html> <html lang="en"> <title>Test page</title> <p>Does this page pass the validator test?</p> </html>
no error
<input type="checkbox" checked
no guideline violations
<p class="assertion">He says he is 'innocent'.</p>
no guideline violations
<p id="preamble">We the people ...</p>
no guideline violations
Does the HTML follow the developer guidelines to separate content from presentation and functionality? <html> <link rel="stylesheet" href="main_style.css"> <body> <p>A page with style!</p> </body> </html>
yes, The page separates the content from the presentation by putting the CSS in a separate file.
does the HTML follow developer guidelines to use boolean attributes? <select> <option selected>Pick an option below</option> <option>Lions</option> <option>Tigers</option> <option>Bears</option> <option>Oh, my!</option> </select
yes, The selected attribute for the <option> tag is a boolean attribute.
Does the HTML follow the developer guidelines to consistently indent nested elements? <tr> <td>Hematocrit</td> <td>34.9-44.5%</td> <td>38.8-50.0%</td> </tr>
yes, each <td> is indented three spaces