JS Flashcards
Which company is usually credited with inventing JavaScript (or at least getting the ball rolling with a language named LiveScript?) A Google. B Netscape. C Apple. D Microsoft.
B
Netscape.
What is the name of the standards organization that defines and maintains the JavaScript language? A World Wide Web Consortium. B Adobe Systems Incorporated. C ECMA International. D Mozilla.
C
ECMA International.
What are the three client-side languages that all Web browsers can execute? A HTML, CSS, JavaScript. B ASP.Net, PHP, Ruby on Rails. C Windows, Mac OS, Linux. D HTML, CSS, Java.
A
HTML, CSS, JavaScript.
Which is the shortest, simplest pair of tags you can use in HTML5 to mark the beginning and end of a block of JavaScript code? A . . . B . . . C . . . D . . .
B
. . .
Which characters can you use to start a single-line comment in JavaScript?
A
B
C //
Which of the following best describes the reason we use JavaScript event handlers?
A
To override JavaScript case-sensitivity.
B
To control when the JavaScript code is executed.
C
To create links to external files.
D
To control the font and color of the JavaScript code’s output.
B
To control when the JavaScript code is executed.
Which event handler would be best used to trigger JavaScript code when the mouse pointer touches an element? A onmouseover B onclick C oncontextmenu D ondblclick
A
onmouseover
Which of the following is the correct way to type the event handler that's triggered by clicking an element? A CLICK B onclick C On-Click D on click
B
onclick
Which of the following shows properly nested quotation marks? A onclick="alert('Hello")' B onclick='alert("Hello')" C onclick="alert('Hello')" D onclick="alert("Hello")"
C
onclick=”alert(‘Hello’)”
Which feature of JavaScript allows you to organize code into routines that can be called by name from event handlers in tags? A Functions. B Pages. C Comments. D Style rules.
A
Functions.
Which DOM object includes properties for determining the height and width of the user's screen in pixels? A location B document C navigator D screen
D
screen
What is the correct spelling of the document object method that allows you to reference an element on the page by its ID name (be sure to pay attention to case-sensitivity)? A .getElementById() B .getElementByID() C .GETELEMENTBYID() D .GetElementByID()
A
.getElementById()
Which object and property return the width of the user's screen as a whole? A navigator.width B window.width C document.width D screen.width
D
screen.width
Which object and method would you use to have JavaScript write tags or content directly into the page? A document.referrer B window.open() C document.write() D location.href
C
document.write()
Which of the following correctly creates a variable named fname and assigns the value Babs to that variable? A VAR F NAME = Babs B var fname = "Babs" C Bab = var fname D Var fname as "Babs"
B var fname = "Babs"
Which of the following stores a string in a variable named x? A var x = true B var x = 18932-2802 C var x = "somewhere@somplace.com" D var x = -32
C var x = "somewhere@somplace.com"
Which of the following is a valid way to express a number in JavaScript? A 9876.56 B 987-65-4321 C 12/31/2015 D (800) 555-1234
A
9876.56
Which of the following stores a Boolean value in a variable named isvalid? A var isvalid=87 B var isvalid = new Date() C var isvalid="true" D var isvalid=false
D var isvalid=false
Which of the following would be the correct way to multiply 2 by 5 (two times five) in JavaScript? A 2 * 5 B 2 == 5 C 2 / 5 D 2 < 5
A
2 * 5
Which of the following expressions asks the question Is price greater than or equal to 10? A price != 10 B price == 10 C price <= 10 D price >= 10
D
price >= 10
What’s the purpose of adding site: and a domain name to a Google or Bing search?
A
To limit the search results to one website (rather than the entire Web).
B
To make the search engine add the site to its index.
C
To make the search results open in a separate tab or window.
D
To exclude the site specified by the domain name from the search results.
A
To limit the search results to one website (rather than the entire Web).
If you executed var lookfor = document.getElementById(“txtlookfor”).value;, what would be the result?
A
It creates a variable named lookfor and stores in it a number indicating how many characters the user typed into the textbox named lookfor.
B
It creates a variable named lookfor and stores in it whatever the user typed into a textbox named txtlookfor.
C
It shows on the screen the word lookfor and the contents of a textbox named txtlookfor.
D
It creates a variable named lookfor and stores in it the ID name of a textbox named txtlookfor.
B
It creates a variable named lookfor and stores in it whatever the user typed into a textbox named txtlookfor.
If you have a variable named x and it contains the string "Hello", what would be the return value of x.length in JavaScript code? A Hello B A time expressed in milliseconds C 0 D 5
D
5
If your JavaScript code contains two variables named str1 and str2, and if both of those variables contain strings (text), not numbers, what would the expression str1+str2 return?
A
A new string consisting of str1 and str2 joined together.
B
A number that’s the sum of how many characters there are in str1 and how many characters there are in str2.
C
A new variable consisting of the two variable names stuck together as str1str2.
D
A new string with whatever letters were in str2 removed from str1.
A
A new string consisting of str1 and str2 joined together.
Why would you use the word selected in the tag of a drop-down list control?
A
To disable the control, making it look gray on the page and preventing the user from choosing any other option.
B
To combine multiple options into one.
C
To make the specified option the default selection.
D
To assign a value to each option.
C
To make the specified option the default selection.
Which are the recommended audio types for HTML5 audio? A AAC and WMA. B MP3 and OGG. C JPEG and GIF. D WAVE and AIF.
B
MP3 and OGG.
Which JavaScript property determines if the user's Web browser can play a particular type of sound file? A .getMimeAttribute() B .canPlayType() C .willPlayMime() D .playsFileType()
B
.canPlayType()
What JavaScript method allows you to specify a sound file for an HTML audio object to play? A .loadFile() B .setAttribute() C .play() D .transferFile()
B
.setAttribute(