COP 2500 FINAL

¡Supera tus tareas y exámenes ahora con Quizwiz!

33. When developing JavaScript programs the developer must set the <script> tag element's language attribute to __________.

"javascript"

25. When developing JavaScript programs the developer must set the <script> tag element's type attribute to __________.

"text/javascript"

13. What operator is used for concatenation?

+

36. What is the primary difference between ++x and x++?

++& is pre-increment, x++ is post-increment

30. Which of the following is a valid block comment in JavaScript?

/* This is a block comment */

5. When using the Math.random() function of the Math object random numbers returned are between

0 (inclusive) and 1 (exclusive)

6. Website lifecycle is a request/response loop. A request is made when __________.

A user types in www.cf.edy in the URL text box of a web browser and hits the enter key

29. Given <p id="course">COP 2500<p/>, what is the innerHTML when using document.getElementById("course").innerHTML?

COP 2500

37. What type of JavaScript array is displayed below using key/value pairs? var states = new Array(); states["CA"] = "90210"; states["ME"] = "01234"; states["MT"] = "55641"; states["FL"] = "32829";

associative array

38. The array declaration statement var weekdays = new Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday"); is an example of creating an array using the __________ format.

condensed

2. Which of the following is not a valid data type of that a variable can hold?

const

31. To declare a constant, a value that cannot be changed during programming execution requires the use of keyword __________.

const

3. When creating a Date object in JavaScript using var myDate = new Date();, Date () is called a __________.

constructor

25. Given var data = "10"; how would data be explicitly converted to the primitive data type Boolean?

data = Boolean(data);

13. When calling a declared function setLetter(word, letter, display) how many arguments must be passed for the function to compile?

none are required to compile or run

16. When calling declared function setLetter(word, letter, display) how many arguments must be passed for the function to compile?

none are required to compile or run

6. In computer science the UNIX start date is defined as starting on __________.

January 1, 1970 00:00:00

7. What date would be outputted when using the Date(year, month, date) constructor to instantiate a JavaScript core object Date with the following code:

Thu Oct 22 1914

37. The three types of dialog boxes inherit to JavaScript for user interaction include confirm();, prompt();, and __________.

alert();

20. When passing data to a function in JavaScript which of the following statements is true?

all of the above

24. Core objects in JavaScript include which of the following?

all of the above

30. In JavaScript computer programs can execute a sequence of statements, branch to an alternative sequence of statements based on evaluating a condition, and repeat a sequence of statements based on evaluating a condition. What is this called?

all of the above

34. When laying out data in an HTML document in a table format, to create rows and columns which tag elements must be used?

all of the above

13. document.getElementById("theDashes").innerHTML in the above code references what?

an HTML element with the id attribute set to theDashes

1. A closure function includes what?

an anonymous function within the function definition

16. Operands can be of data type __________.

any combination of the above

8. After a function has been declared in the <head></head> section of the HTML document, how many times can it be used in the <body></body>?

as many times as required

26. Two commonly used validation tools are __________ and __________.

both a and b

5. Variables declared outside of functions that can be used or changed anywhere in the program are called __________.

global variables

9. Composite data types, also known as complex types, consist of more than one component. Valid composite data types include all of the following except __________.

undefined

17. Once declared, functions in JavaScript can be used how many times?

unlimited

24. Anonymous functions in JavaScript are unique because its definition is assigned to a __________ since they don't have a __________.

variable,name

21. Variable scope in JavaScript defines where the variable is __________in the program or where it can be used.

visible

22. UNIX start time in computer science is called __________.

epoch

1. JavaScript is the same as Java and as HTML

false

12. When using functions from the Math object you must declare an instance of the Math object, for example var mathClass = new Math();.

false

18. When using anonymous functions in JavaScript arguments cannot be passed to the function.

false

21. When using the Math object in JavaScript an instance of the object MUST be created using the keyword new before any properties or methods can be used.

false

6. The keyword return can be used anywhere in a <script></script> tag element.

false

23. JavaScript is a __________ programming language.

loosely typed

2. In computer science the date/time is measured in ¬¬¬¬¬¬¬¬¬¬__________.

milliseconds

20. There are two attributes of the Date object that start at 0 rather than 1, just to mess with us mere humans ☺, which attributes illogically start at 0 even though day of the month starts at 1?

month and day of the week

3. The following JavaScript code is an example of what type of loop? <script> var asterisk = "*"; for (var row = 0; row < 10; row++) { for (var column = 0; column < row; column++) { document.writeln(asterisk); } document.writeln("<br>"); } </script>

nested loop

10. The variable named data is initialized as follows: var data = "Data data data"; and is reused later in the JavaScript program. Which of the following is not a valid reuse of the variable data?

none of the above, they are all valid

38. JavaScript is a client-side language because it works __________.

on the local computer

14. Local variables are declared inside of JavaScript functions and can be used or modified __________.

only in the function they are declared

34. Precedence in JavaScript determines how the __________ binds to its __________.

operator, operands

22. When a function is defined in JavaScript the expected received data values are called?

parameters

18. If the value of variable index equals 6, which element of array words would be returned by function getWord()?

repetition

12. The JavaScript logical not operator (!) results in the __________.

reverse evaluation of the condition

15. var index = word.search( letter ); uses which String object method?

search

32. When naming variables in JavaScript, which of the following would not be valid?

var *32829;

8. When asked to develop unobtrusive JavaScript this means that the JavaScript is __________.

stored in an external file with a .js file extension

19. What would the output be in the alert dialog box based on the following JavaScript code?

string result is 8675309

14. word = word.substr( 0, index ) + '-' + word.substr( index + 1 ); uses which String object method?

substring

28. What would the result of Math.floor(12.5) be?

12

11. Where in an HTML document are functions called?

all of the above

30. Which part of the statement returns the element with the id attribute of the specified value?

getElementById("theword")

29. Primitive data types are assigned __________.

single literal values

25. When does an HTML document become a document object?

when it is loaded into a web browser

28. Including comments in HTML and JavaScript is good programming practice. An example of an inline comment in JavaScript is __________.

// This is an inline comment

17. What are the potential values of variable index based on the Math object function calls var index = Math.floor( Math.random() * words.length );?

0-12

26. One second is equals how many milliseconds?

1,000 milliseconds

given var result= eval("100 / 5-4"); what would result's value be?

16

17. Given the expression var sum = 19 + 83; which parts of the expression are operands?

19 and 83

10. Based on the String declaration var word = "COP 2500 Concepts in Computer Science";, what would the result of word.length be?

37

11. Well-formed statements written in JavaScript end with __________.

; (semi-colon)

22. Including comments in HTML and JavaScript is good programming practice. An example of block comment in HTML is __________.

<!-- This is an block comment -->

19. The HTML tag element creates a table row in a table?

<tr>

32. Which part of the statement is explicitly setting the text associated with the specified element to some value?

=word

36. When using Math.random(), if values greater than 0-1 are desired what should be programmed?

A and B

35. String comparison in computer science evaluates the data alphabetically based on the __________ which is based on the _________ value of the letter.

ASCII, numeric

7. JavaScript is used to enhance ________ Web pages for an interactive experience.

HTML

9. The HTML tag element <div> is used for a __________.

a division or section in an HTML document

1. What is the output of the HTML tag element <hr /> when the HTML file is loaded in a web browser?

a horizontal rule

7. Recursion is a function that __________.

calls itself

27. Given var data = "45.12"; how would data be explicitly converted to a float?

data = parseFloat(data);

29. Given var data = "76.45"; how would data be explicitly converted to an integer?

data = parseInt(data);

39. Which is not one of the three ways to create an array in JavaScript?

decaffeinated

which of the following is a valid looping constructs in javascript?

do/while

15. The comparison operator = = = is used to determine what?

if two operands are identical in value and type

32. The ternary operator mimics which conditional in JavaScript?

if/else

4. The HTML tag <img> is used to insert an __________ in the document.

image

4. JavaScript can __________.

improve website usability

31. Which part of the statement gets the text associated with the specified element?

innerHTML

21. JavaScript programs are executed by a JavaScript ¬¬_________ in a Web browser.

interpreter

15. Which of the following is true about a nested loop?

is a loop within a loop

3. Which of the following is not part of the three layers of a Web page?

java

19. Given the following code example, what are rowLoop and columnLoop called in JavaScript? rowLoop: for (var row = 0; row < 10; row++) { columnLoop: for (var column = 0; column < row; column++) { document.writeln("*"); if(column == 7) break rowLoop; } }

labels

31. When using functions parseInt("Route 66"); and parseFloat("Route 66.5"), what order is the data evaluated to convert to an integer and floating point number respectively?

left to right

8. In HTML the <br /> tag element is known as a __________.

line break

14. &&, ||, and ! are called what in JavaScript?

logical operators

26. Which of the following is a valid decision-making construct in JavaScript?

switch

11. What does would var date = new Date(); return when printed?

the day of the week, date, time, and time zone of the time the function was executed

27. Assuming good HTML form and embedded <script></script>, when using concatenation what output would display based on the statement: document.write("The weather is " + 54 + " degrees and raining");

the weather is 54 degrees and raining

10. Functions must be declared before they can be used.

true

12. A common use for using nested loops is to display data in a table format using rows and columns.

true

2. The following call to a JavaScript function is valid. <form> <input type="button" value="Welcome" onClick="greetings('Students');"/> </form>

true

23. JavaScript allows for any data type to be assigned to a variable

true

23. The Math object in JavaScript allows for performing mathematical tasks.

true

24. HTML Web page files are saved using file extension .htm or .html.

true

27. The Math object has built in properties, such as Math.PI, and 19 built in methods.

true

33. In HTML DOM everything is a node.

true

35. HTML tag element <input> is an HTML button.

true

4. A JavaScript function can be called using the HTML anchor tag element, for example <a href="JavaScript:greetings()">Click here</a>

true

5. Numeric literals can be integers (whole numbers) and floating point (fractional numbers with a decimal point)

true

9. In JavaScript, based on the function definition in the <head> and the function call in the <body>, is the function call valid? <head><script> function mileage(inMiles, inGas) { var miles = parseInt(inMiles); var gas = parseInt(inGas); return miles/gas; } </script></head> <body> <script> var gasMileage = mileage(200, 5, 4); alert("Gas mileage is " + gasMileage + " miles to the gallon"); </script> </body>

yes


Conjuntos de estudio relacionados

Anatomy and Physiology- Ch 11 HW

View Set

Phases of Wound healing Acute Wound/ Wound Healing

View Set

Microbiology Chapters 1,2,3,4 Microorganisms are best defined as organisms that

View Set

Linux Quiz 1 - Chapter 1-4 / Lecture 1-4

View Set

Key Concepts in Communication & Culture

View Set