Cis 332 Exam 3 Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

To create a link that goes to a placeholder on the same page, you code the href attribute as @ followed by the id attribute of the placeholder element # followed by the id attribute of the placeholder element $ followed by the id attribute of the placeholder element the id attribute of the placeholder element

# followed by the id attribute of the placeholder element

totalMonths has a string value of "13", what does the if statement that follows display? var years = parseInt ( totalMonths / 12 ); var months = totalMonths % 12; if ( years == 0 ) { alert ( months + " months."); } else if ( months == 0 ) { alert ( years + " years"); } else { alert ( years + " years, and " + months + " months."; } 1 years, and 1 months 1 year, and 1 month 1 years 1 year

1 years, and 1 months

List and describe at least two advantages jQuery provides

1. Methods and functions can change the Document object Model directly (DOM) 2. Jquery follows the rules of cross browser compatibility

What will futureValue contain after the for loop has been executed one time? var years = 10; var annualRate = 10; var futureValue = 1000; annualRate = annualRate / 100; for ( i = 1; i <= years; i++ ) { futureValue += futureValue * annualRate; } 1000 1100 11000 1010

1100

What will the value of the totalsString variable be after the following code is executed? var totals = [141.95, 212.95, 411, 10.95]; totals[2] = 312.95; var totalsString = ""; for (var i = 0; i < totals.length; i++) { totalsString += totals[i] + "|"; } 141.95|212.95|411|10.95| 141.95|212.95|411|312.95| 141.95|212.95|312.95|10.95| 10.95|

141.95|212.95|312.95|10.95|

How many times will the while loop that follows be executed? var months = 5; var i = 1; while (i < months) { futureValue = futureValue * (1 + monthlyInterestRate); i = i+1; } 0 4 5 6

4

the if statement that follows is executed, what will the value of discountAmount be? var discountAmount; var orderTotal = 200; if (orderTotal > 200) { discountAmount = orderTotal * .3; } else if (orderTotal > 100) { discountAmount = orderTotal * .2; } else { discountAmount = orderTotal * .1; } 0.0 20.0 40.0 60.0

40.0

Cross-browser compatibility is a serious development issue because Internet Explorer and the other browsers don't always interpret HTML the same way CSS the same way HTML, CSS, and JavaScript the same way HTML and CSS the same way

HTML, CSS, and JavaScript the same way

A link can be used to start or open all but one of the following. Which one is it? an audio or video file a PDF or PowerPoint file an email a JavaScript application

a JavaScript application

The DOM for a web page is built before the page is loaded after the page is loaded as the page is loaded when the DOM is needed

as the page is loaded

Now that HTML5 is used by all modern browsers, the HTML div element should be used primarily for grouping elements for headers and footers elements for JavaScript and jQuery applications lists and links images and text

elements for JavaScript and jQuery applications

To lay out a web page so it adjusts to the width of the screen, you use fluid layout liquid layout media queries scalable images

fluid layout

When scripting the DOM with JavaScript, the $ sign is commonly used for the name of a function that gets the element with the specified id. for the name of the event handler that is triggered when a page is loaded to refer to the document object to refer to the current node in the DOM

for the name of a function that gets the element with the specified id.

When you use mobile-first coding for a responsive web page, you start with for a fixed layout and add media queries for the various viewport sizes. for the smallest media query and media queries for successively larger screens. for a fluid layout and add media queries for the various viewport sizes. for the smallest screen and add media queries for successively larger screens.

for the smallest screen and add media queries for successively larger screens.

To create a menu that drops down from an item in a navigation bar when the mouse pointer hovers over it, you use CSS to change the display property for the menu from off to on from none to inline from off to block from none to block

from none to block

After the statements that follow are executed, var firstName = "Ray", lastName = "Harris"; var fullName = lastName; fullName += ", "; fullName += firstName; firstName="Harris" firstName="Ray Harris" fullName="Ray Harris" fullName="Harris, Ray"

fullName="Harris, Ray"

JavaScript is commonly used to modify the contents of a web page when the page is loaded in response to a user action when the images of a page are loaded in response to web server actions

in response to a user action

JavaScript is a scripting language that runs in the JavaScript compiler of the browser in the JavaScript compiler of the web server in the JavaScript engine of the browser in the JavaScript engine of the web server

in the JavaScript engine of the browser

when the statement that follows is executed, a message is displayed if the value in userEntry if (!isNaN(userEntry) || userEntry <= 0 ) { alert ("Message"); } isn't a number or the value in userEntry is less than or equal to zero isn't a number and the value in userEntry is less than or equal to zero is a number or the value in userEntry is less than or equal to zero is a number and the value in userEntry is less than or equal to zero

is a number or the value in userEntry is less than or equal to zero

Two types of tested JavaScript and jQuery code that you can use to add features like carousels, tabs, and accordions to a web page are jQuery plugins and widgets jQuery plugins and JavaScript widgets jQuery widgets and jQuery UI plugins jQuery plugins and jQuery UI widgets

jQuery plugins and jQuery UI widgets

To change the left alignment of the items in an unordered list, you set the left margin for the ul element left padding for the ul element left margin for each li element left padding for each li element

left padding for the ul element

When you use a link to start an email, you code the href attribute as emailto: followed by the email address of the sender emailto: followed by the email address of the recipient mailto: followed by the email address of the sender mailto: followed by the email address of the recipient

mailto: followed by the email address of the recipient

To adjust the appearance of a web page to different screen sizes, you use liquid layout media queries fluid layout scalable images

media queries

Before you use desktop-first or mobile-first coding for the CSS for a responsive web page, you need to do all but one of the following. Which one don't you have to do? plan the layout for all screen sizes. test the HTML for the elements that the page will be using. plan the components for all screen sizes. code the HTML for the elements that the page will be using.

test the HTML for the elements that the page will be using.

To remove the underlining from an <a> element, you can use CSS to set its text-decoration property to none text-decoration property to off underline property to none underline property to off

text-decoration property to none

Where does the link created by this code go to? <a href="8reasons.html#reason6">Complete, real-world applications</a> the element with reason6 as its id on the same page as the link the element with #reason6 as its id on the page named 8reasons.html the element with #reason6 as its id on the same page as the link the element with reason6 as its id on the page named 8reasons.html

the element with reason6 as its id on the page named 8reasons.html

The DOM for a web page provides a hierarchy of nodes that represent the elements, contents, and attributes in the HTML the elements, attributes, and comments in the HTML the contents, attributes, and comments in the HTML the elements, contents, attributes, and comments in the HTML

the elements, contents, attributes, and comments in the HTML

When you use ems or percentages to size fonts the font size is relative to the browser's default font size the font size is relative to the font size specified for the body the font size changes as the size of the viewport changes the font size changes as the size of the font used by its parent element changes

the font size changes as the size of the font used by its parent element changes

The href attribute for an <a> element specifies the page that the link should go to the placeholder that the link should go to the page and/or placeholder that the link should go to the page that the link should go to and whether the page should be in a new window

the page and/or placeholder that the link should go to

To make sure that the ECMAScript 5 features will work in older browsers, you can use a JavaScript shiv a JavaScript shim the shim.js file the sham.js file

the shim.js file

When you create a link that starts a video, you can code a type attribute that specifies the codec for the media file media attribute that specifies the codec for the media file type attribute that specifies the MIME type for the media file media attribute that specifies the MIME type for the media file

type attribute that specifies the MIME type for the media file

To drop down the menu for an item in a navigation bar when the mouse pointer hovers over it, you need to use CSS like this #nav_menu ul li:hover { display: block; } #nav_menu ul li:hover ul { display: block; } #nav_menu ul li:hover > ul { display: block; } #nav_menu ul li:hover ~ ul { display: block; }

#nav_menu ul li:hover > ul { display: block; }

To call the jQuery val method for an element that has "zip_code" as its id attribute, you would code this JavaScript: $(".zip_code").val(); $(".val").zip_code(); $("#zip_code").val(); $("#val").zip_code();

$("#zip_code").val();

Which of the following lines of JavaScript, will put the message "Invalid entry" into a label with its id attribute set to email_error? $("email_error").nodeValue.firstChild = "Invalid entry"; $("email_error").firstChild.nodeValue = "Invalid entry"; $("email_error").firstChild.nodeValue.Invalid entry; $("email_error").firstChild = "Invalid entry";

$("email_error").firstChild.nodeValue = "Invalid entry";

Which of the following is a valid jQuery event handler for the click event of h2 elements? $(h2).click(function { alert("This heading has been clicked"); }); $(h2).click(function() { alert("This heading has been clicked"); }); $h2.click(function() { alert("This heading has been clicked"); }); $(h2).click{function() ( alert("This heading has been clicked"); )};

$(h2).click(function() {

Assume userName equals "Tom" and userAge equals 22. What is displayed in a dialog box when the following statement is executed? alert(userAge + " \nis " + userName + "'s age."); 22 is Tom's age. 22 is Tom's age. 22 \nis Tom's age. 22 \n is Tom's age.

22 is Tom's age.

Suppose the fixed width of an aside element in a fixed layout is 300 pixels, and the fixed width of its parent element (body) is 900 pixels. If you convert the page from fixed to fluid layout, the width of the aside should be set to 33.33% .3333 300% 3

33.33%

Which of the following do you NOT have to do to create a scalable image whose width is limited to its native size? Remove the image's height and width properties from the HTML Set the image's width property to 100% Set the image's height property to "auto" Set the image's max-width property to the width of the image in pixels

Set the image's height property to "auto"

What does the window.onload function do? var $ = function (id) { return document.getElementById(id); } var printPage = function() { window.print(); } window.onload = function() { $("printButton").onclick = printPage; Prints the page when the button with its id set to printButton is clicked Sets up the event handler named printPage Calls the printPage function when the button with printBotton as its id is clicked Prints the page

Sets up the event handler named printPage

Which of the following do you NOT need to do when you use the SlickNav menu plugin for a responsive web page? Use CSS to hide and display the SlickNav menu based on viewport size Use HTML to code the menu used by SlickNav Code a script element for the jQuery core library Code a script element for the SlickNav JavaScript file Code a script element that appends the slicknav menu to an HTML element Code a link element for the SlickNav style sheet

Use HTML to code the menu used by SlickNav

An easy way to test a responsive design is to Use a text editor like Brackets Deploy the website to a server and test it in Chrome Deploy the website to a server and test it on a variety of devices Use the developer tools of a modern browser

Use the developer tools of a modern browser

When will the styles for the media query that follows be applied? @media only screen and (min-width: 768px) and (max-width: 959px) When the width of the screen is greater than 768 pixels and less than 959 pixels When the width of the screen is 768 pixels or more When the width of the screen is 959 pixels or less When the width of the screen is greater than 768 pixels or less than 959 pixels

When the width of the screen is greater than 768 pixels and less than 959 pixels

The title for an <a> element specifies the text that's displayed for the link a description that can be used for accessibility the text that's used for SEO the metadata for the link

a description that can be used for accessibility

The pseudo-class selectors for links let you use CSS to change the formatting for all but one of the following. Which one is it? a link that hasn't been visited a link that has been visited a link that has the focus or is being hovered over a link that is inactive

a link that is inactive

When you code a jQuery event handler, you include a selector and the name of an event method a selector, the name of an event method, and the name of the function that handles the event the name of an event method and the name of the function that handles the event a selector and the name of the function that handles the event

a selector, the name of an event method, and the name of the function that handles the event

A vertical navigation menu is best coded as a series of <a> elements with their display properties set to block a series of <a> elements with their text-decoration properties set to none a series of li elements with their display properties set to block a series of <a> elements within the li elements of an unordered list

a series of <a> elements within the li elements of an unordered list

To create a drop-down menu from an item in a horizontal navigation bar, you nest a ul element within the ul element for the navigation bar a ul element within an li element of the ul element for the navigation bar an li element within an li element of the ul element for the navigation bar one ul element within each li element of the ul element for the navigation bar

a ul element within an li element of the ul element for the navigation bar

To position a drop-down menu directly below an item in a navigation bar, you apply absolute positioning to the ul element for the drop-down list relative positioning to the ul element for the drop-down list absolute positioning to the navigation bar fixed positioning to the ul element for the drop-down list

absolute positioning to the ul element for the drop-down list

When a client requests a dynamic web page, the HTML is generated by the web server an application server a database server the web browser

an application server

When the DOM is changed by JavaScript, the changes are immediately shown in the browser window are shown the next time the page is loaded are shown when the page is refreshed are shown when the user takes the next action

are immediately shown in the browser window

The use of the jQuery ready event method is important because it will run its methods as soon as DOM for the page has been built as the page loads after all of the content for the page has been loaded after all of the content except the images has been loaded

as soon as DOM for the page has been built

The main reason for using the SlickNav plugin is to create a navigation menu that responds more quickly responds to touch can be accessed on a mobile device provides for multi-tier menus

can be accessed on a mobile device

The class attribute can be applied to only one element in an HTML document determines the priority level of an HTML element determines the text that will be displayed when the mouse hovers over an element can be used by CSS to apply the same formatting to more than one HTML element

can be used by CSS to apply the same formatting to more than one HTML element

Which of the following statements is false? A JavaScript identifier is case-sensitive can start with a $ sign can start with a number can be more than 128 characters long

can start with a number

The easiest way to run a web page that's already in your browser after you've made changes to the code for the page is to click on the Reload or Refresh button use the Open or Open File command in the File menu type just the file name into the address bar type just the domain name into the address bar

click on the Reload or Refresh button

jQuery is a library that consists of methods that are written with Java is automatically loaded with a web page can be loaded into a web page from a JavaScript Delivery Network consists of methods that are written with JavaScript

consists of methods that are written with JavaScript

In JavaScript, the order of precedence for arithmetic expressions causes multiplication operations to be performed before addition operations division operations to be performed after subtraction operations increment operations to be performed after modulus operations addition operations to be performed before subtraction operations

multiplication operations to be performed before addition operations

Which of the following is NOT part of an HTTP URL: protocol path node filename

node

By default, an ordered list is displayed as a numbered list bulleted list alphabetical list sorted list

numbered list

If you're using the Chrome browser and a JavaScript application stops running due to an error in the JavaScript code, you can identify the statement that caused the error by pressing F12, clicking on the link in the Sources panel, and reviewing the code in the Console panel pressing F12, clicking on the link in the Console panel, and reviewing the code in the Sources panel pressing F12 and reviewing the code in Console panel pressing F12 and reviewing the code in the Sources panel

pressing F12 and reviewing the code in the Sources panel

(Refer to example 18-1) Which of the three JavaScript functions are event handlers? Example 18-1: The JavaScript in an external file named printPage.js var $ = function (id) { return document.getElementById(id); } var printPage = function() { window.print(); } window.onload = function() { $("printButton").onclick = printPage; } $, printPage, and window.onload printPage $ and printPage printPage and window.onload

printPage and window.onload

If you want the user to be able to click anywhere in a box in a vertical navigation menu that's created by using <a> elements within the list items of an unordered list, you must set the list-style property for the list to none set the display property for the list items to block set the text-decoration property for the <a> elements to none set the display property for the <a> elements to block

set the display property for the <a> elements to block

One of the ways to create a horizontal navigation menu from an unordered list is to set the display property of each li element to inline set the clear property of each li element to both set the display property of the <a> element within each li element to inline set the float property of the <a> elelment within each li element to left

set the display property of each li element to inline

One of the ways to create a horizontal navigation menu from an unordered list is to set the display property of each li element to block set the float property of each li element to left set the display property of the <a> element within each li element to inline set the float property of the <a> elelment within each li element to left

set the float property of each li element to left

When you develop responsive web pages, you use a meta element in the HTML to tell the browser that the page is responsive specify that media queries will be used set the width of the viewport to the device width let the user change the size of the browser window

set the width of the viewport to the device width

You can use jQuery for functions like image swaps and slide shows without knowing how the JavaScript works. However, you do need to know how to code the HTML so it has the structure that the JavaScript expects so it has the structure and attributes that the JavaScript expects so it has the attributes that the JavaScript expects so it has the attributes and classes that the JavaScript expects

so it has the structure and attributes that the JavaScript expects

In a fluid layout, you should use percents to set the widths for all but one of the following. Which one is it? structural elements left and right padding left and right margins borders

structural elements

A description list is a list that consists of descriptions bulleted descriptions terms and descriptions bulleted terms and descriptions

terms and descriptions

When you code a jQuery selector, you use the JavaScript syntax the jQuery syntax the CSS syntax the HTML syntax

the CSS syntax

When you use viewport height (vh) to size fonts, the font size is relative to the browser's default font size the font size is relative to the font size specified for the body the font size changes as the size of the viewport changes the font size changes as the size of the font used by its parent element changes

the font size changes as the size of the viewport changes

You can use the CSS list-style-type property to change the bullet style in an unordered list the number style in an ordered list the terms style in a description list the bullet or number style in an unordered or ordered list

the number style in an ordered list

To set the breakpoints for media queries, you get the viewport sizes of all of the popular devices. use Developer Tools to determine at what widths the design breaks. use the viewport sizes that are set by Web Consortium. use Developer Tools to see the viewport sizes for the various devices.

use Developer Tools to determine at what widths the design breaks.

Which of the following is NOT a way to include JavaScript in the HTML for a web page? use a script element to load an external JavaScript file use an embed element to load an external JavaScript file embed JavaScript in a script element in the head section embed JavaScript in a script element in the body section

use an embed element to load an external JavaScript file

Which of the following is a valid statement for declaring and initializing a variable named length to a starting value of 120? length = 120; int length = 120; var length = 120; num length = 120;

var length = 120;

JavaScript code runs on the database server application server web server web browser

web browser

Scalable images adjust to height of the containing element. width of the containing element. width of the device screen. height of the device screen

width of the containing element.

(Refer to example 18-1) Which function or method actually prints the page? Example 18-1: The JavaScript in an external file named printPage.js var $ = function (id) { return document.getElementById(id); } var printPage = function() { window.print(); } window.onload = function() { $("printButton").onclick = printPage;} printButton window.onload window.print() printPage

window.print()


Set pelajaran terkait

Biztosítás szakmai alapfogalmak

View Set

Ch. 52 - Property Management Agreements

View Set

OSHA - Avoiding Electrocution Hazards (Construction)

View Set

Chapter 10 production and operations management

View Set

Cost Management 2nd edition, Ch 07 - Activity-Based Costing & Management

View Set

Path 370 Assessment 3 (CH. 16, 18, 19, 20)

View Set

Патанатомия экзамен

View Set

Quiz 14 Licensing, Education, and Associations

View Set

English, REACH FOR THE TOP MARIA SHARAPOVA

View Set

CHAPTER 12 AGGREGATE EXPENDITURE AND OUTPUT IN THE SHORT RUN

View Set