978-0133577396 Chapter 19

subject Type Homework Help
subject Pages 5
subject Words 1134
subject Authors Lawrence Snyder

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Fluency with Information Technology, 6e (Snyder)
Chapter 19 Programming Functions: Thinking Big
19.1 True/False Questions
1) Functions allow reuse of code but also result in increased complexity because parts of the
solution are hidden.
2) Variables in the parameter list of a JavaScript function are automatically declared.
3) The name of a function identifies it and must be used when the function is called.
4) Function names cannot contain numbers and must not be more than eight characters long.
5) The value produced by the <expression> in JavaScript's return statement is called the
function's value or result.
6) The return value for a JavaScript function must be a variable.
7) Local variables cannot be used outside the functions in which they are declared.
8) In a function, arguments can be provided in any order.
9) In a JavaScript formula (e.g., (9/5) tempInC + 32), multiplication is implied; therefore, the
multiplication operator (*) is not required.
10) A variable cannot be used as part of a calculation to assign a value to itself.
page-pf2
11) The parameter list must include at least one parameter.
12) A computer cannot generate a truly random number.
14) When a global and local variable share the same name, a JavaScript program will not be
accepted by the browser.
15) Functions are made up of two parts, the name and the parameters.
16) The arguments in a function call give values for the parameters, matched in order left to
right.
17) Programmers rarely use code written by others.
1) Variable names declared in a function:
A) can be used outside that function
B) cannot be changed within that function
C) can be used outside the function, but cannot be changed outside the function
D) can only be used inside that function
2) All of the following are parts of a function except:
A) the name
B) parameters
C) global variables
D) the definition
3) Output directly onto a Web page from JavaScript is done using:
A) writeln( )
B) document.write( )
C) print( )
D) document.display( )
page-pf3
4) A variable declared in a function is a(n):
A) local variable
B) global variable
C) independent variable
D) named variable
5) In JavaScript, the result of a function call can be displayed to the user
A) in a pop-up with by calling alert( )
B) interactively by modifying the DOM after the page has been displayed
C) by writing the values into the page as it it is first displayed
D) all of the above
6) When defining a function, how do you specify the result?
A) You call it.
B) You re-write it.
C) You return it.
D) You designate it.
7) The JavaScript function toString( ):
A) converts to a printable form
B) returns the length of a string of characters
C) displays the JavaScript on a Web page
D) saves the answer to a file
8) Which of the following is an alternate term for function?
A) procedure
B) subroutine
C) method
D) all of the above
9) Which of the following functions displays the page that is specified as its first argument?
A) window.open( )
B) window.new( )
C) window.page( )
D) none of the above
page-pf4
10) The inputs to a function are called:
A) identifiers
B) parameters
C) values
D) algorithms
11) The random numbers generated by Math.random( ):
A) will never be repeated
B) are really pseudo-random
C) are random because the computer is deterministic
D) are negative numbers
12) The values returned by the Math.random( ) function are between:
A) 0 (inclusive) and 1 (exclusive)
B) 0 (exclusive) and 1 (inclusive)
C) 0 (exclusive) and 1 (exclusive)
D) 0 (inclusive) and 1 (inclusive)
13) Radio buttons belong to groups in which, if one is checked, any others are unchecked. How
do you know which buttons are in the same group?
A) They are placed on the same line of the HTML file.
B) They have the same name.
C) They are part of the same form.
D) The are enclosed in a <radiogroup>...</radiogroup> tag pair.
14) After running the JavaScript:
var d = new Date();
var t = d.getTime();
the variable t contains
A) the number of milliseconds since the current web page was downloaded.
B) the number of days since the beginning of 1990, US Pacific time zone.
C) a string giving the current date and time, with the seconds given to three decimal places.
D) the number of milliseconds since the beginning of 1970 in Greenwich, England.
1) Inputs to a function are known as ________.
2) The ________ is the algorithm written in a programming language.
page-pf5
3) A(n) ________ is a programming structure with a name, optional parameter list, and a
definition that encapsulates an algorithm.
4) Variables declared inside a function are ________ in scope.
5) ________ a function is asking the computer to run or execute the statements of the function to
produce the answers.
6) The ________ function in JavaScript returns the integer portion of a number.
7) JavaScript uses the <input…/> tag for both input and ________ text boxes.
8) Functions that are written so they can be reused in other ________ are considered building
blocks.
9) The function ________ is used in JavaScript to convert numbers into printable form.
10) A function is declared by writing its function ________.
11) ________ creates a JavaScript object which represents a date and time.
12) Function names should begin with a(n) ________.
13) Joining several components together, e.g., ( '<tr style="background-color : #00ccff ">' +
'<td>-10</td><td>' + convertC2F(-10) + '</td></tr>' ), is known as ________.
14) The HTML element ________ provides an area where JavaScript can draw lines and figures.

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.