CIS 150 Exam 4
Identify the output of the following code. var x = [3, 45, 1234, 24]; x.sort();
1234, 24, 3, 45
What is the output of the following code? var sum = 0; var x = [1, 3, 7, 11]; x.forEach(sumArray); function sumArray(value) { sum += value; }
22
Identify the output of the following code. var x = 8; var y = 6;
96
Identify a syntax used to create a spinner control using an input element.
<input name="name" id="id" type="number"value="value" step="value" min="value" max="value" />
Identify a syntax that sets the data type of the registerDate field to "date".
<label for="register">Date of registration</label><input name="registerDate" id="register" type="date" />
Identify a syntax of the option element that contains an attribute to make an option as default in a selection list.
<option value="value" selected>text</option>
Command buttons are created using the input element with the type attribute set to _____.
Button
The ____ element is used to create a custom option.
Button
_____ programming distributes the load to prevent a server from getting overloaded with program-related requests.
Client-side
A data entry control is associated with a _____ in which data values supplied by the user are stored.
Data Field
Identify a list which when applied to an input box, the values appear as a pop-up list of suggested values.
Data List
Which of the following can be referenced only after the browser has finished parsing the page content?
Document Objects
Identify a shortcut key on the keyboard to open the debugging tools.
F12
A command block is indicated by its opening and closing square brackets [ ].
False
For url type data, the virtual keyboard includes a key that inserts the .com character string.
False
Index values start with 1 so that the initial item in an array has an index value of 1, the second item has an index value of 2, and so on.
False
JavaScript is a procedural language that needs a compiler to translate the code into machine language.
False
The post method is the default method that tells the browser to append the form data to the end of the URL specified in the action attribute.
False
The while statement is used to exit a program loop before the stopping condition is met.
False
There are predefined CSS styles to format the appearance of a placeholder.
False
Identify the significance of "text" in
It identifies the form.
_____ is the programming language for client-side programs.
JavaScript
Identify a true statement of a JavaScript program in a web form. JavaScript is extracted by all layout engines in a similar way; as a consequence, this grounds consistency in terms of functionality and interface. JavaScript is a closed-source programming language, which provides tools and a programming environment for communicating the strategy and overall administration of distributed applications. JavaScript intercepts the content of the form before the browser attempts to contact the CGI script and report whether the data contained in the survey form has been correctly filled out or not. JavaScript is a bug-free Visual Basic scripting language, which is used only for networking applications.
JavaScript intercepts the content of the form before the browser attempts to contact the CGI script and report whether the data contained in the survey form has been correctly filled out or not.
Which of the following methods of the Math operator rounds x up to the next highest integer?
Math.ceil(x)
get and post are two possible values for the _____ attribute.
Method
Identify a return value for the expression 5/"A" using JavaScript.
NaN
_____ are like selection lists in which they limit fields to a set of possible values; but, unlike selection lists, the options appear as separate controls in the web form.
Radio Buttons
Identify a data type applied in an input element to create slider controls.
Range
JavaScript code is attached to an HTML file using the _____ element.
Script
A command that indicates an action for the browser to take should end with a _____.
Semicolon
A default value need not be specified; the text area box can be left empty or the placeholder attribute can be used to provide a hint to users about what to enter into the text box.
True
By default, items are placed in an array either in the order in which they are defined or explicitly by index number.
True
Once the field values have been entered by the user, they are processed by a program running on the user's computer or on a web server in a secure location.
True
Parameters are treated as variables within a function.
True
Server-side and client-side programming are the two main types of web-based programming.
True
When for attribute is used, the label text can be placed anywhere within the page and it will still be associated with the control.
True
If no _____ value is specified, the browser assumes a default value of text and adds a simple text input box to the web form.
Type
What is the output of the following code? var scores = [92, 68, 83, 95, 91, 65, 77]; var highScores = scores.filter(gradeA); function gradeA(value) { return value > 90; }
[92, 95, 91]
Identify the type of control that performs an action.
a form button
A(n) _____ is a collection of values organized under a single name.
array
Identify a method that tests whether the condition returned by the callback function holds for all items in an array.
array.every(callback [, thisArg])
Which of the following methods creates a new array populated with the elements of array that return a value of true from the callback function?
array.filter(callback [, thisArg])
The _____ method creates a new array by passing the original array items to the callback function, which returns the equivalent value of the array items.
array.map(callback [, thisArg])
Identify a method that decreases array by keeping only those items that return a value of true from the callback function.
array.reduce(callback [, thisArg])
Identify the expression used to reference array values.
array[i]
The _____ attribute tells a browser to parse the HTML and JavaScript code together, only pausing to process the script before returning to the HTML file.
async
To break a text string into several lines, which means that the text string continues on the next line, the _____ character should be used.
backslash
The technique for locating the source of an error is to set up _____, which are locations where the browser will pause the program, allowing the programmer to determine the error at that position.
breakpoints
Numeric data can be sorted by creating a(n) _____ function that contrasts the values of two adjacent array items.
compare
JavaScript is used as a programming tool for:
creating interactive web forms and animated graphics.
_____ is the process of locating and fixing a programming error.
debugging
The _____ loop tests the condition to continue the loop right after the latest command block is run.
do/while
The every(callback [, thisArg]) array method applies the callback function to each item in an array.
false
Identify the general structure of a for loop.
for (start;continue;update) { commands }
Identify the general structure for accessing each value from an array using a for loop.
for (var i = 0; i < array.length; i++) { commands involving array[i] }
A(n) _____ is a collection of commands that performs an action or returns a value.
function
Identify a compare function that sorts numeric values in descending order.
function descending(a, b) { return b - a; }
Which of the following syntax is used for a function to return a value?
function function_name(parameters){commandsreturn value;}
What is the output of the following code? for (var i = 0; i <= 360; i+=60)
i = 0, 60, 120, 180, 240, 360
What is the output of the following code?for(var i = 5; i > 0; i--)
i = 5, 4, 3, 2, 1
Identify a pseudo-class for a check box or option button whose toggle states cannot be ascertained.
indeterminate
The check box control is created using the _____ element.
input
Identify the cross-browser style sheet that changes the text color of the placeholder text for every input box to light red for the moz extension.
input::-moz-placeholder {color: rgb(255, 151, 151);}
The _____ method performs an action similar to the forEach() method except that the function it calls returns a value that can be used to match the contents of an existing array into a new array.
map()
Identify a function that extracts the first numeric value from the text string.
parseFloat(string)
Identify an attribute that can be added to the input element to validate a text value against a regular expression.
pattern="regex"
A _____, which employs the first-in-first-out (FIFO) principle in which the first item added to the data list is the first removed, is similar to a stack.
queue
A _____ occurs after a script has been successfully loaded with no syntax errors and is being executed by a browser.
run-time error
Identify a method that repeatedly runs commands at specified time breaks in a function created.
setInterval("command", interval)
A(n) _____ is any group of characters enclosed within either double or single quotation marks in JavaScript.
text string
The _____ property should be used only when no markup tags are involved.
textContent
The process of ensuring that the user has supplied correct data is called _____.
validation
Identify the expression in which the initial value of the day variable will be set to match the first day of the calendar month.
var day = new Date(calDate.getFullYear(), calDate.getMonth(), 1);
A(n) _____ is a named item in a program that stores a data value, such as a number or text string, or an object, such as a part of the web browser or browser window.
variable
Identify the syntax of the while loop.
while (continue) { commands }