Javascript

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

Inside which HTML element do we put the Javascript? a. <scripting> b. <javascript> c. <js> d. <script>

d. <script>

How can you add a comment in a Javascript? A. //This is a comment B. 'This is a comment C. <!--This is a comment-->

A. //This is a comment

Is Javascript case-sensitive? A. No B. Yes

B. Yes

19. What will be the result of the JavaScript expression 31 + " angry polar bears"? A. An error message B. 32 C. "31 angry polar bears"

C. "31 angry polar bears"

22. Which of the following are capabilities of functions in JavaScript? A. Accept parameters B. Return a value C. Both of the above

C. Both of the above

What is the correct syntax for referring to an external script called "xxx.js"? A. <script src="xxx.js"> B. <script href="xxx.js"> C. <script name="xxx.js">

A. <script src="xxx.js">

Which operator is used to assign a value to a variable? A. = B. - C. * D. x

A. =

Which of the following is executed first by a browser? A. A script in the <head> section B. A script in the <body> section C. An event handler for a button

A. A script in the <head> section

17. Which of the following is not a valid JavaScript variable name? A. 2names B. first_and_last_names C. FirstAndLast

A. 2names

20. How do you create a function in Javascript? A. function myFunction() { } B. function = myFunction() { } C. function:myFunction() { }

A. function myFunction() { }

How do you write an if statement in Javascript? A. if (i === 5) B. if i = 5 then C. if i = 5 D. if i === 5 then

A. if (i === 5)

21. How do you call a function named "myFunction"? A. myFunction(); B. call myFunction(); C. call function myFunction();

A. myFunction();

18b. Using the same sample string "The eagle has landed." , which of these statements would return the word eagle? A. test.substring(4,9); B. test.substring(5,9); C. test.substring("eagle");

A. test.substring(4,9);

Which of the following operators means "is not equal to" in JavaScript? A. ! B. != C. <

B. !=

The external Javascript file must contain the <script> tag.

False

How do you write an if statement for executing some code if "i" is NOT equal to 5? A. if i <> 5 B. if (i <> 5) C. if i ==! 5 then D. if (i !== 5)

D. if (i !== 5)

18a. If the string test contains the value "The eagle has landed.", what would be the value of test.length? A. 4 B. 21 C. The

B. 21

What is NOT a type of Pop up boxes available in Javascript? A. Alert B. Show C. Confirm D. Prompt

B. Show

Assume that the declaration var x; has been made and that x has been initialized. The code segment if (x > 5) x *= 2; if (x > 10) x = 0; is equivalent to which of the following code segments? A. x = 0; B. if (x > 5) x = 0; C. if (x > 5) x *= 2; D. if (x > 5) x = 0; else x *= 2; E. if (x > 5) x *= 2; else if (x > 10) x = 0;

B. if (x > 5) x = 0;

How do you declare a Javascript variable? A. v carName; B. var carName; C. variable carName;

B. var carName;

How to insert a comment that has more than one line? A. //This comment has more than one line// B. <!--This comment has more than one line→ C. /*This comment has more than one line*/

C. /*This comment has more than one line*/

23. What is the range of random numbers generated by the Math.random function? A. Between 1 and 100 B. Between 1 and the number of milliseconds since January 1, 1970 C. Between 0 and 1

C. Between 0 and 1

Where is the correct place to insert Javascript? A. The <head> section B. The <body> section C. Both the <head> section and the <body> section are correct

C. Both the <head> section and the <body> section are correct

How do you write "Hello World" in an alert box? A. alertBox("Hello World"); B. msgBox("Hello World"); C. alert("Hello World"); D. msg("Hello World");

C. alert("Hello World");


Kaugnay na mga set ng pag-aaral

Miranda Rights related to police

View Set

Vocabulary Lesson Assignment Lesson 2 - allegiance, appendage, pall, peremptorily, reiterate, undulation

View Set

Chapter 38 Corporations: Formation and Financing

View Set

Lab: Exercise 8: The Axial Skeleton

View Set

BUSI 1301.3E01_Chpt 8_Accounting

View Set