click below
click below
Normal Size Small Size show me how
cist 1520 final
| Question | Answer |
|---|---|
| You must know which of the following to be able to use JavaScript? | HTML |
| Which of the following is something you should have to use JavaScript? | A Web browser |
| The choice of a Web browser is up to you, as long it's compatible with . | JavaScript |
| is the international standard name and specification used for the JavaScript language. | ECMAScript |
| Before its release as JavaScript, JavaScript was called . | LiveScript |
| JavaScript is . | prototype-based |
| In what ways can a fancy code editor help a JavaScript programmer? | It may offer features such as code highlighting, completion, debugging tools, and more. |
| A language doesn't require a program to be compiled before it is run. | interpreted |
| In JavaScript, what handles errors in a script? | The client |
| How is JavaScript added to a Web page? | It is added to an HTML document |
| JavaScript and Java are the same language | False |
| JavaScript has similarities to other programming and scripting languages | True |
| A fancy code editor is necessary to edit JavaScript files. | False |
| JavaScript can only be used in a Web browser environment. | False |
| What is added to a Web page to insert JavaScript code? | <script> and </script> tags |
| What is the purpose of the <script> and </script> tags? | All of the above |
| Why would you use the type attribute in the opening script tag? | To ensure the Web page validates when using XHTML |
| Is JavaScript code case sensitive? | Yes |
| The noscript tag provides ___ for those without ___. | content, JavaScript |
| An external JavaScript file commonly uses a filename extension of _. | .js |
| Which of the following correctly points to an external JavaScript file named yourfile.js? | <script src="yourfile.js"></script> |
| In HTML, the script tag is not case sensitive. However, with XHTML, the script tag must be in _. | Lowercase |
| The _ signals the end of a JavaScript statement. | Semicolon |
| To write a string of text on a Web page, the _ method can be used. | document.write() |
| When would it be a good idea to use external JavaScript file? | When the script is very long or needs to be placed in more than one HTML document. |
| JavaScript comments can be very useful for the purpose of _ or _ your code. | documenting, debugging |
| Which of the following indicates that a single line of commentary will follow it within JavaScript code? | // |
| Which of the following indicates that more than one line of commentary will follow it within JavaScript code? | /* |
| Which of the following indicates the end of a multiple-line JavaScript comment? | */ |
| When you use multiple-line JavaScript comments, you need to be careful to _ them. | Close |
| A variable represents or holds a ___ | value |
| What are the benefits of using variables? | They can save you time writing and updating your scripts, and they can make the purpose of your code clearer. |
| To declare a variable, you use the ___ keyword | var |
| What symbol is used as the assignment operator in JavaScript? | = |
| Which of the following declares a variable named pagenumber and gives it a value of 240? | var pagenumber=240; |
| Variable names are not case sensitive. | False |
| A variable name must begin with a ____,____,____character. | letter, a dollar, or an underscore |
| You should avoid using JavaScript keywords and reserved words as variable names. | TRUE |
| Which of the following variable declarations uses a variable with a valid variable name in JavaScript? | var my_house; |
| In JavaScript, the data types include | number, string, boolean, null, undefined, symbol, and object. |
| To denote an exponent in JavaScript, you use the letter ___ right after the base number and before the exponent. | e |
| Which of the following string declarations is invalid? | var mytext="Here is some text!'; |
| Which of the following statements would be valid in JavaScript? | document.write("John said,\"Hi!\""); |
| ____enable you to add things to your strings that could not be added otherwise. | Special characters |
| Which of the following successfully displays the value of a variable named myhobby by adding it to a string? | document.write("I like to " +myhobby+ " every weekend"); |
| In general, a ____ is a little script within a larger script that is used to perform a single task or a series of tasks. | function |
| What are two reasons why a function can be useful? | They provide a way to organize the various parts of the script into the different tasks that must be accomplished, and they can be reused. |
| On the first line of a function, ________ whether it accepts any arguments. | you declare it as a function, name it, and indicate |
| To declare a function, you use the ____ function. | keyword |
| What surrounds the code inside a function? | {} (curly brackets) |
| Function names are case sensitive. | TRUE |
| JavaScript keywords can be used as a function names. | FALSE |
| Which of the following would be a valid function name in JavaScript? | function get_text() |
| Arguments are used to allow a function to import ____ values from somewhere outside the function. | one or more |
| Arguments are set on the first line of a function, inside a set of _____ | () (parentheses) |
| Multiple argyments are separated by what symbol? | Comma |
| Which of the following is a valid use of the window.alert() method? | window.alert("This is text"); |
| Which of the following correctly calls a function named some_alert() and sends it two string values as arguments? | some_alert("some","words"); |
| Which of the following correctly assigns the result of a function named get_something() to a variable named shopping? | var shopping=get_something(); |
| A ___ variable can be used anywhere in JavaScript. | global |
| The _____ keywords create values in the current block context. | const and let |
| _____ is a symbol or word in JavaScript that performs some sort of calculation, comparison, or assignment on one or more values. | An operator |
| ____ operators are most often used to perform mathematical calculations on two values. | Arithmetic |
| The ____ operator adds two values. | addition |
| When the increment operator is placed before the operand,__________, and then the rest of the statement is executed. | it increases the value of the operand by 1 |
| Which of the following is not a JavaScript operator? | $# |
| What does an assignment operator do? | Assigns a new value to a variable |
| The ____ opertor adds the value on the right side of the operator to the variable on the left side and then assigns the new value to the variable. | add-and-assign(+=) |
| What does comparison operator do? | Compares two values or statements, and returns a valie of true or false. |
| Which of the following comparisons will return true? | 4 !=3 |
| Which of the following comparisons will return false? | 4 <= 3 |
| The logical operators allow you to compare two conditional statements to see if ____ of the statements are true and to proceed accordingly. | one or both |
| Which of the following statements will return true? | !(17>=20) |
| Which of the following statements will return false? | (4 >=4) && (5<=2) |
| ____ operators are logical operators that work at the bit level. | Bitwise |
| In JavaScript, the operators have a certain order of _____. | Precedence |
| Which method is used to get data stored during a drag and drop? | getData() |
| Which object can be used to store or retrieve data during the drag-and-drop process? | event.dataTransfer |
| The ___ event occurs when an element begins being dragged. | dragstart |
| By default, all elements are draggable. | FALSE |
| JavaScript ___ may make some advanced coding tasks easier by making the code easier to write. | libraries |
| The ____ attribute of an element defines whether or not the element can be dragged. | draggable |
| When drawing on a canvas, you can use the fillCircle() method to draw a circle. | FALSE |
| The ____ elements allows you to use JavaScript to draw on a defined area of the page. | <canvas> |
| The jQuery library makes it easier to write code that is ____. | Cross-browser |
| ___ syntax is used to select elements in jQuery. | CSS |
| Which of the following lines would hide an element with an id of "story" using jQuery? | $("#story").hide(); |
| Which of the following is used to see if a document is ready in jQuery? | $(document).ready() |
| The acronym for JavaScript Object Notation is ___. | JSON |
| JavaScript can retrieve data from the server other than an XML document. | TRUE |
| ___ stands for Asynchronous JavaScript and XML. | AJAX |
| What object allows you to get data from the server in JavaScript? | XMLHttpRequest |
| Which of the following HTML5 form attributes is used for fields that must be filled in by the user to validate? | required |
| The ___ method allows you to submit a form without the viewer clicking the submit button. | submit() |
| One way to help with form accessibility is to use the ___ tags to identify what field a piece of text is describing. | <label></label> |
| Which of the following would add a valid meter tag to the document to show 8 on a scale of 0 to 10? | <meter min="0" max="10" value="8">8</meter> |
| The ____ method allows you to reset a form using your script. | reset() |
| The ___ attribute in HTML5 allows you to give a form field a regular expression it must validate. | pattern |
| The ___ property is an array that allows you to access each element in a specific form. | elements |
| The ___ property allows you to access the value of the action="url" attribute in the opening form tag. | action |
| Which of the following accesses the value of an element named e1 in a form f1? | document.f1.e1.value |
| Using form ___ or ___ allows you to name the forms on the page that you want to access later. | names ids |
| Which of the following holds the value of the number of forms in a document? | document.forms.length |
| Which of the following would find the number of elements in the third form on a page? | document.forms[2].length |
| Which of the following would access the fourth form on a page? | document.forms[3] |
| The forms ____ allows you to access a form using an index number. | array |
| The ____ objects provides properties and methods to get information about string or to modify strings. | String |
| What are the two ways in which you can create String objects? | Creating an instance of the String object and creating a string literal |
| You can create a string ____ by assinging a string value to a variable. | literal |
| A regular text string is able to use the String object's methods because: | JavaScript takes the string literal and turns it into a temporary String object |
| Which property of the String object can you use with both String objects and string literals? | Length |
| The ____ property returns the length of a string. | length |
| Which of the following correctly creates a string literal? | var the_text ="Look at me!"; |
| Which method of the String object can you use to find which character is at a given position in a string? | charAt() |
| The ___ method adds <big> and </big> tags around a string value. | big() |
| The concat() method ___ two or more string together and returns the new combined string value. | combines |
| Which one of the following statements is true? | The indexOf() method returns a numeric value that is the position of a character sent as a parameter, but only the position of the first occurrence of that character. |
| Cookie information is stored in the ____ property. | document.cookie |
| The ___ method returns the string literal value of a string. | toString() |
| Each time you add a set of <form> and </form> tags to an HTML document, a(n) ___ object is created. | form |
| What is the difference between the setInterval() method and the setTimeout() method? | The setInterval() method is used to repeat a function at aset time interval, while setTimeout() executes a function only once after a set time delay. |
| When setting the toolbar attribute as part of the third parameter in the open() method, what values may the attribute have? | yes, no, 1, and 0 |
| The prompt() method is used to ___ the viewer to enter information. | prompt |
| The ___ method enables the viewer to print the current window. | print() |
| What value is returned by the confirm() method if the viewer clicks the OK button? | True |
| The ____ method pops up a message to the viewer, and the viewer has to click an OK button to continue. | alert() |
| What is the difference between the parent and top properties? | The parent property goes to the top o the current frame set, while the top property goes to the top window of all frame sets on the page. |
| Why would this code not work: onmouseover="window.status='Page 2'; return true;" | Newer browsers do not allow the window status to be changed by default, so the user would need to change security settings in order for it to work. |
| The ___ property is another way of saying "the current window" in JavaScript. | Self |
| The calls to properties and methods of the window object can often be shortend because: | The window object is the global object for JavaScript in Web browsers. |
| The ___ property holds the name of the current window and also allows you to give the window a name. | Name |
| The location property can cause instant redirection of the browser to a new page. | TRUE |
| The ____ property returns the number of frames within a window. | Length |
| The closed property is used to check whether or not a window has been closed. | TRUE |
| A ___ object is created for each browser window | window |
| The ____ method compares a regular expression and a string to see whether they match. | match() |
| To replace information in a string, you can use regular expressions and the ____ method of the String object. | replace() |
| A _____ loop looks at a comparison and repeats until the comparison is no longer true. | while |
| To correctly access the fifth item of an array named "cool", you can write cool[5] | FALSE |
| What property of the Array object will return the numeric value of the length of an array? | The length property |
| When you need to use a variable to access a property name, you can use _____ notation. | bracket |
| A _____ function can be used to create an object structure. | CONSTRUCTOR |
| A(n) _____ of an object can be created using the new keyword. | INSTANCE |
| You can only have one instance of an object. | FALSE |
| Which of the following correctly assigns the day of the week for an instance of the Date object named rightnow to a variable named weekday? | var weekday=rightnow.getDay(); |
| The getMonth() method returns the same number as the number that represents the current month (for example, returns 1 if the current month is January). | FALSE |
| The ___ method returned the number of days into the week. | getDay() |
| What must be created in most cases before the Date object's properties and methods can be used? | An instance of the Date object |
| The ____ method returns the square root of a number sent to it as an argument. | sqrt() |
| Which of the following would correctly generate a random number between 0 and 7? | var rand_int=Math.floor(Maath.random()*8); |
| The pow() method returns the numeric value of the ____ argument raised to the power of the ____ argument. | first, second |
| The ____ method returns the arcsine of a number sent to it as an argument. | asin() |
| The abs() method returns the ____ value of a number sent to it as an argument. | ABSOLUTE |
| The ___ property holds the value of the square root of 2. | SQRT2 |
| Which of the following would correctly write the value of pi on a Web page? | document.write(Math.PI); |
| The LOG10E property holds the value of the logarithm of 10*E | FALSE |
| The LN10 property holds the value of the natural ____ of 10. | logarithm |
| The ____ property holds the value of Euler's constant. | E |
| What do the properties and methods of the Math objects enable you to do? | A Take the square roots and other such values of strings and return a number. |
| You can use a ___ clause to return only the rows in a table that meet certain criteria. | WHERE |
| You should give all users of your database permission to delete data. | FALSE |
| An Express ____ can be used to handle what happens when users try to access a certain route from your Web app. | router |
| The default port used when you type a URL into your Web browser is ____. | 80 |
| The ____ module can be used to create a Web server in Node.js. | express |
| What symbol is used to return all columns when querying a database? | * |
| The ____ module can be used to query your database from a Node script. | pg |
| You should always use the superuser account to query your database from your Web application. | FALSE |
| The ___ stack uses MongoDB, Express, AngulatJS, and NodeJS. | MEAN |
| One one type of database can be used with Node.js. | FALSE |
| Which of the following extensions would be used for a custom module? | .js |
| A ____ module allows you to define your own reusable code. | custom |
| Which of the following would require the built-in fs module without an error? | const fs = require('fs'); |
| Which of the following would run the Node script hello-world.js from the command window? | node hello-world.js |
| Node.js runs in a Web browser. | FALSE |
| The ____ method and the ____ method are two new ways to register events. | addEventListener() , attachEvent() |
| In Internet Explorer prior to the version 9, the event object can be accessed by using ____. | window.event |
| The keydown event occurs when a viewer presses down a key on the keyboard. | TRUE |
| The submit event occurs when the viewer ___ on a Web page. | submits a form |
| The ____ property of an event contains the type of event that occurred. | type |
| The ____ object contains properties and methods for an event. | event |
| The blur event is the opposite of the ____ event. | focus |
| The ____ event occurs when the viewer leaves the current Web page. | unload |
| A mouseout event occurs when a viewer clicks an element on the page. | FALSE |
| A mouseover event occurs when: | The viewer moves the mouse cursor over an element on the page |
| The ____ event occurs when a Web page has finished loading. | Load |
| Which of the following correctly codes an alert on the click event? | <input type="button" onclick="window.alert('Hey there!');> |
| To use an event handler, you place it in the ____ or the _____ code. | HTML , JavaScript |
| Event handlers are useful because they enable you to gain _____ to the _____ that may occur on the page. | access, events |
| An event handler is a predefined JavaScript property of an object that is used to handle an event on a Web Page. | TRUE |
| What statements are most common between a document.open() and a document.close() statement? | document.write() and document.writeln() statements. |
| What is the getElementsByName() method commonly used to obtain? | All the elements that have the same value for the name attribute (most commonly radio buttons). |
| How does the writeln() method differ from the write() method? | It adds a JavaScript newline character at the end of the line. |
| Which property return the complete URL of the current document? | URL |
| You can use the title property to display the title of a Web page someplace other than in the top bar of the browser window. | TRUE |
| The Document Object Model (DOM) allows JavaScript (and other scripting languages) to access the structure of the document in the browser. | TRUE |
| The ____ property holds the value of the date and time the current document was last modified. | lastModified |
| The ____ DOM node property allows you to change the HTML content of an element node | innerHTML |
| The ____ property of the document object is an array that contains all the anchor (<a>) tags on the page. | ANCHORS |
| You cannot remove nodes from the document once they have been added. | FALSE |
| The appendChild() DOM node method allows you to add a child node as the first child node of a specified node. | FALSE |
| The _____ method of the document object allows you to get an element by the value of its id attribute. | getElementById() |
| You can use the DOM node property style to alter the style sheet attributes of an element. | TRUE |
| The _______ Property of the document object returns the URL of the document that referred the viewer to the current document. | REFERRER |
| The _______ object is an object that is created by the browser for each new HTML page that is viewed. | DOCUMENT |
| Which of the following is not a property of the navigator object? | appType |
| The _____ object gives you access to the various properties of the viewer's browser. | NAVIGATOR |
| In JavaScript, there are many ____ objects you can use to gain access to certain properties and methods you may need. | PREDEFINED |
| assuming the myhouse object exists, the kitchen property is assigned a new string value of :big: or is initialized with the value "big". | What could you say about the following code? myhouse.kitchen = "big"; |
| Which of the following would send an alert to the viewer that tells the name of the browser being used? | window.alert("You are using" + navigator.appName); |
| If a property cannot be found in the object instance, JavaScript will look in the object's _________. | PROTOTYPE |
| What could you say about the following code: let x = myhouse.kitchen; | Assuming the myhouse object exists, it assigns the value of the kitchen property of the myhouse object to the variable x. |
| In JavaScript, you typically access object properties through the use of the? | dot operator (.) |
| When using object literal notation, the properties and values are enclosed within curly brackets ({}). | TRUE |
| When creating single objects, you can use the object ____ or object literal notation. | CONSTRUCTOR |
| An object is a collection of _______ and _______. | PROPERTIES, VALUES |
| Rather than executing every single line of code within the script, a conditional statement allows certain sections of the script to be executed only when a particular condition is met | TRUE |
| Which of the following would be valid as the first line of an if/else statement? | if(y<7) |
| Which of these would not be advisable as the first line of a while loop (it creates an infinite loop)? | while (x=7) |
| Which of these would be valid as the first line of a for loop? | for (let x = 1; x<6; x+=1) |
| A loop is useful because it forces you to type lines of code repeatedly. | FALSE |
| A do while loop is special because the code within the loop is performed at least once, even if the comparison used would return false the first time. | FALSE |
| The last line of a do while block contains only a curly bracket. | FALSE |
| How many times can you nest a code block within another? | As many times as you like (through enough nesting could make the browser run out of memory) |
| An ____ is a way of storing a list of data. | array |
| By default, how does the sort() method sort the contents of an array? | it sorts the content using string character codes |
| The ____ method is used to remove the last element from an array. | pop() |
| ___ arrays provide the ability to create arrays of more than one dimension. | Nested |
| The ____ method is used to combine the items of an array into a single string, with each item separated by a specified character. | join() |
| The____ method is used to combine the items of two or more arrays and return a new array containing all of the items. | concat() |
| What does the following code do? let s_list = new Array(5); | Creates an array with five items |
| Which of the following does not correctly create an array? | let myarray = new Array[10]; |
| You can use JavaScript keywords as array names. | FALSE |
| In JavaScript, there are ____ ways to define an array. | two |
| A ____ is a block of code that allows you to repeat a section of code certain number of times. | loop |
| You can use a ___ to cycle through all of the items in an array. | loop |
| The ___ statement allows you to take a single variable value and execute a different line of code based on the value of the variable. | SWITCH |
| You can think of a conditional statement as being a little like _____. | cause and effect |
| What do you use to enclose the blocks of code in conditionals and loops? | curly brackets |
| In an array, access to an element is achieved through the use of a ___. | index |
| Array literal notation allows you to create an array using square brackets, without the need to write out "____". | new Array |
| A conditional statement is a statement that you can use to ____________, or do something else if that condition is not met. | execute a bit of code based on a condition |