Filters
Question type

Study Flashcards

If you wanted the following function to return only the two values of 0 and 1, how would you re-write line 2? 1 ) function tossIt() { 2 ) return Math . random() ; 3 ) }


A) return Math . round() ;
B) return Math . round(Math . random() ) ;
C) return Math . round(random() ) ;
D) This cannot be done .

E) A) and C)
F) B) and D)

Correct Answer

verifed

verified

Functions that are written so they can be reused in other programs are considered ________ .

Correct Answer

verifed

verified

Select all that apply . Which of the following are required parts of a function?


A) the local variables
B) the definition
C) the name
D) the parameters

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

A variable cannot be used as part of a calculation to assign a value to itself . For example, this JavaScript statement would cause an error, assuming myNum is a numeric variable that has been previously declared and initialized:myNum = myNum*3 + 75/myNum;

A) True
B) False

Correct Answer

verifed

verified

When two variables have the same name, but one is global and one is local, the JavaScript program will not run .

A) True
B) False

Correct Answer

verifed

verified

The arguments in a function call pass values to the parameters, matched in order from left to right .

A) True
B) False

Correct Answer

verifed

verified

When calling a function, it does not matter which order you list the arguments .

A) True
B) False

Correct Answer

verifed

verified

False

What, if anything, is wrong with the following JavaScript code? <script>document . write("<img src = 'puppy . JPG'/>") ;</script>


A) You cannot use document . write() to display an image; it can only display text .
B) The outer double quotes are not needed with the document . write() function .
C) You cannot use the document . write() function with JavaScript; it must be used with a form .
D) Nothing is wrong with this code .

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

When a function is called, you write the function's name and include any necessary arguments (that is, input values) inside ________ .

Correct Answer

verifed

verified

If a function definition contains two parameters, two arguments must be included in the function call .

A) True
B) False

Correct Answer

verifed

verified

When you write code to ask the computer to run or execute the statements in a function, this is referred to as ________ the function .

Correct Answer

verifed

verified

calling

Select all that apply . What does the following command do? Ctx . quadraticCurveTo(20,20,20,50) ;


A) The curve will end at the point where x = 20 and y = 50
B) The curve will start at the point where x = 20 and y = 20
C) It specifies a curved line .
D) The curve will start at the point where x = 20 and y = 50

E) All of the above
F) C) and D)

Correct Answer

verifed

verified

Output directly onto a web page from JavaScript is done using the ________ built-in function .


A) document . display()
B) print()
C) writeln()
D) document . write()

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

The HTML ________ tag provides an area where JavaScript can draw lines and figures .

Correct Answer

verifed

verified

<canvas...

View Answer

Given the following JavaScript function, which of the following is NOT a possible result? Function tossIt() { Return Math . random() ; }


A) 0 . 5
B) 0 . 8923871
C) 0
D) 1

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

D

The numbers generated by the Math . random() function


A) will never be repeated
B) are random because a computer is deterministic
C) must be multiplied by -1 to change them to positive
D) are pseudo-random

E) All of the above
F) None of the above

Correct Answer

verifed

verified

Programmers rarely use code written by others .

A) True
B) False

Correct Answer

verifed

verified

The inputs to a function are called


A) parameters
B) arguments
C) identifiers
D) values

E) C) and D)
F) A) and C)

Correct Answer

verifed

verified

Variables in the parameter list of a JavaScript function are declared automatically .

A) True
B) False

Correct Answer

verifed

verified

A(n) ________ is a programming structure with a name, an optional parameter list, and a definition that encapsulates an algorithm .

Correct Answer

verifed

verified

Showing 1 - 20 of 42

Related Exams

Show Answer