CIS193 Chapter 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which element of the JavaScript expression document.write("<p>The current time in " + cityName + " is " + currentTime + ".</p>"); is a literal?

"<p>The current time in "

What is the key difference between a two-tier and a three-tier client/server system?

In a three-tier system, the database is split into a processing tier and a data storage tier.

Which of the following languages is used for server-side scripting?

Ruby

Which statement about the BOM is correct?

The BOM is largely the same among the various browsers currently available.

Which statement about a client/server architecture is correct?

The server fulfills the client's information request.

An HTML document that is well formed and correctly written according to the element definitions in HTML's specific language definition is considered a valid document.

True

In the context of programming web applications, a user typing in a form field with a keyboard, the occurrence of an error as a browser attempts to load a page, and a user touching a webpage element on a mobile phone screen are all examples of events.

True

JavaScript libraries such as Node.js and jQuery can be downloaded and then utilized to create and manage large web applications more effectively when connected to the HTML file through a script element in the head section.

True

Programmers are not required to end JavaScript statements with semicolons, but it is considered good practice to do so.

True

The JavaScript window.alert() method makes a dialog box appear that contains the literal string passed to it plus an OK button that can be clicked to close the box.

True

The operands in the JavaScript expression "ABC" + 123 + doReMe are: "ABC", 123, and doReMe.

True

When the file magnolia.js is attached to a web page by inserting the following line into its HTML file, the browser will load the HTML and JavaScript files together until the script is loaded, pause loading of the HTML to process the script, then complete loading of the HTML. script src="magnolia.js" async></script

True

You should add the defer attribute to the script element attaching an external JavaScript file to an HTML file when you want the browser to load the HTML file completely, then load and process the script.

True

2. Enclosing embedded JavaScript statements within a script element of an XHTML document in a CDATA section causes them to be treated as parsed character data, which will invalidate the XHTML document.

True. With HTML documents, the statements in a script element are interpreted as character data instead of as markup. A section of a document that is not interpreted as markup is referred to as character data, or CDATA. If you were to validate an HTML document containing a script section, the document would validate successfully because the validator would ignore the script section and not attempt to interpret the text and symbols in the JavaScript statements as HTML elements or attributes.

What is an API?

a set of procedures that access an application

Which JavaScript statement calls a method associated with the hotChocolate object, passing the argument 1 to this method?

hotChocolate.addToOrder(1);

Which JavaScript statement assigns the value 3.49 to the price property of the hotChocolate object?

hotChocolate.price = 3.49;

Which of the following is a characteristic of an object used in JavaScript programming?

includes both programming code and data

Which of the following lines of code correctly uses an event handler attribute to display a dialog box when the webpage user clicks or taps a submit button?

input type="submit" onclick="window.alert('Welcome!')" /

A(n) _____ reads the code of a program line by line, scanning for errors, as the program is run.

interpreter

Suppose you want to change the source file for the image element with the id value shirtPhoto so that a blue shirt is shown when the webpage user clicks a blue swatch image on the page. The photo's file name is stored in the variable blueShirtImage. What JavaScript event handler could you attach to the swatch image element?

onclick="document.getElementById('shirtPhoto').src = blueShirtImage"

What code lines would you place before and after a set of JavaScript statements to embed them in an HTML file?

script and /script

A key characteristic that sets scripting languages apart from other programming languages is that

scripting languages are run directly from a program, not compiled

When naming and using variables in JavaScript, you should remember that

shelter and homelesspet are appropriate names for objects (lowecase only)

Which of the following JavaScript statements will NOT succeed in declaring the speedLimit variable and assigning the value of 70 to it?

speedLimit = 70, let speedLimit

In JavaScript,

the statement document.write("Today's special: dumplings!"); can be used to display a message on a web page

JavaScript

was once supported by Internet Explorer only in a different form called JScript

Suppose you have initialized a variable in your JavaScript program using this statement: let weight = 130; What expression should you use to modify the value of weight later in the program?

weight = 115;

What would you place in the blank in the following JavaScript code to insert a note for other programmers to read that the interpreter would ignore?

// Need to replace with dynamic content

Which statement is correct?

A markup language called HTML is used to define the content and structure of a web page.

If all of the major browsers can render a web page, this indicates that the HTML document used to produce it is well formed.

False

It is the best practice to place all JavaScript scripts at the beginning of an HTML file so that they will not be run until after the Document Object Model has been created.

False

JavaScript programmers must include code to respond to the complete set of trigger events in each script because all events occur with all devices that run browser applications.

False

When the following script element is inserted into an HTML file to instruct the browser to load a JavaScript file, the name and location of the HTML file belong in the blank. script src="_____" /script

False

When you insert several JavaScript scripts into an HTML file, you must repeat statements declaring and initializing variables in each script because the statements in one script are unavailable to other scripts in the file.

False

When you link an HTML file to an external JavaScript file using the src attribute of the script element, you must update the HTML file every time the script is modified to prevent load-time errors.

False

1. Enclosing embedded JavaScript statements within a script element of an XHTML document in a CDATA section causes them to be treated as parsed character data, which will invalidate the XHTML document.

False. You can make XHTML documents valid by using a CDATA section to enclose embedded JavaScript code within a script element. In XHTML documents, the statements in script elements are treated as parsed character data, or PCDATA, which identifies a section of a document that is interpreted as markup. Because JavaScript code in an XHTML document is treated as PCDATA, if you attempt to validate an XHTML document that contains a script section, it will fail the validation. if you prefer to keep the JavaScript code within the document, you can enclose the code within a script element within a CDATA section, which marks sections of a document as CDATA. The syntax for including a CDATA section on a web page is as follows: {left hat}![CDATA[ statements to mark as CDATA]]{right hat}

What is the role of the IDE in a JavaScript developer's workflow?

It is used to manage all aspects of website development, including writing and testing code.

What is the relationship between JavaScript and ECMAScript?

JavaScript is the most important implementation of ECMAScript.

You can use the addition operator (+) in several ways in JavaScript. However, you CANNOT use the addition operator to

add the integer 10 and the string "10" to return the integer 20

Which of the following lists contains only JavaScript keywords?

await, delete, enum, interface

A code editor

color codes the entered text to denote JavaScript keywords and user-defined values

A(n) _____ transforms a set of instructions written in a programming language into machine code, which can be understood by a computer.

compiler

Which statement should you use to declare a variable called accelerationOfGravity that will store a constant value that cannot be changed?

const accelerationOfGravity = 9.8,

The Document Object Model

describes how to access the contents of a web page and user actions within that page

Server-side scripting is used to

directly access a database on a system's back end

A variable used in a program written in JavaScript

is a specific location in the computer's memory

When a variable is declared and initialized with the statement var velocity = 32;, this means that

it has a somewhat different scope than if it were declared using the let keyword

HTTP is important for the web's client/server system because

it is the protocol used for data exchange between the client and server

Suppose you need to create a variable to represent a color choice for an item. Which variable name should you assign to it to follow JavaScript rules and conventions?

itemColor

Suppose you have initialized two variables containing integers called qtyOne and qtyTwo. How would you write a JavaScript expression to declare a totalQty variable and assign the sum of qtyOne and qtyTwo as its value?

let totalQty = qtyOne + qtyTwo,

Using client-side scripting to handle light processing tasks such as data validation

minimizes transfer times across the Internet, making web applications faster


Kaugnay na mga set ng pag-aaral

A&P 2 Chapter 19 test review questions

View Set

AP Gov Chapter #- Legislative Branch

View Set

Epidemiology Midterm Review- peer

View Set

Marketing exam 1 quiz questions ch. 1-3

View Set

Hey p.18-19, Hey p.22-23, Hey p.26-27, ימות השבוע, Hey p.28-29, Hey p.32-33

View Set

Chapter 13: Cardiac Rhythm Disturbances

View Set

Exam review 3 Personal Nutrition, UC

View Set

World Literature, Test 7, Unit 9

View Set

Write the chemical formula (ionic)

View Set

Chapter 4 Consolidated Financial Statements and Outside Ownership

View Set