Está en la página 1de 22

Q1

Question 1.

Question :

What is the primary tool a client uses to interact with a web server?

Student Answer: Instructor Explanation:

Web Browser

Points Received: Comments:

10 of 10

Question 2.

Question :

What are the top 3 web clients seen by web sites (be sure to cite your source, e.g., StatsCounter.com, and your assumptions) Google Chrome Mozilla Firefox Internet Explorer Source: w3schools.com/browsers

Student Answer:

Points Received: Comments:

10 of 10 No source or assumptions

Question 3.

Question :

JavaScript is run on the: Client Server It must run on both the client and the server No one knows

Student Answer:

Points Received: Comments:

10 of 10

Question 4.

Question :

What are the top 2 devices used to access web sites (cite your source and assumptions)? smart mobile phone and Tablet Source:Techcrunch and splashtop.com

Student Answer:

Points Received: Comments:

10 of 10

Question 5.

Question :

What is the name of the protocol used by a client to communicate with with a web server?

Student Answer: Instructor Explanation:

HTTP (Hypertext Transfer Protocol)

(A correct answer: http)

Points Received: Comments:

10 of 10

Question 6. Student Answer:

Question :

A web page with fixed content is called: (A correct answer: static)

static website

Instructor Explanation:

Points Received: Comments:

10 of 10 this is really a page, not a site.

Question 7.

Question :

An important view to see errors reported by JavaScript is the: Javascript Console

Student Answer: Instructor Explanation:

Points Received: Comments:

10 of 10

Question 8.

Question :

What is the value of this statement?

NaN === NaN


Student Answer:

true false It depends on the browser It is an error

Points Received: Comments:

10 of 10

Question 9.

Question :

Please provide any information that will help in evaluation of your quiz.

Student Answer:

Prefer questions that help different techniques to web development.

Points Received: Comments:

1 of 1

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q2
Question 1. Question : Student Answer: True JavaScript identifiers are case sensitive False

Points Received: Comments:

10 of 10

Question 2. Question : Student Answer: Instructor Explanation:

Declare a variable named x initialized to the numeric value zero. (A correct answer: var x=0;)

var x = 0;

Points Received: Comments:

10 of 10

Question 3. Question :

Declare a single string variable named top initialized to represent this two-line string: title followed by subtitle on the second line. (A correct answer: var top='title\nsubtitle';)

Student Answer: Instructor Explanation:

var Top = 'title followed by \n' + 'subtitle on the second line';

Points Received: Comments:

9 of 10

Question 4. Question :

Which of the following are legal identifiers in JavaScript

Student Answer:

us$currency cloud9 topsy-turvy 23skidoo one_fine_day

Points Received: Comments:

10 of 10

Question 5. Question :

Write an assignment to variable average that adds up the 5 numbers 93, 96, 89.5, 79, and 85.5, in that order, and divides the result by 5 using addition and division operators

Student Answer:

function sum(myArray) { var (A correct answer: var total=0; for (var i = 0; i < average=(93+96+89.5+79+85.5)/5.) myArray.length; i+=1) { total += myArray[i]; } return total; } function average(myArray) { var s=sum(myArray), count=myArray.length; return s / count ; } var scores = [93, 96, 89.5, 79, 85.5]; var tot = sum(scores); var avg = average(scores); console.log("// Scores: "+scores+"; Average: "+avg);

Instructor Explanation:

Points Received: Comments:

6 of 10 No assignment to variable "average". Rather this is ends up as a function which performs that (e.g., average(scores) rather than average, as requested.

Question 6. Question :

Mark the ones that are true, given these initial assignments:

var x=[], y=[]; var z = Number("three"); var u='3', v=2+1, w=3.0;


Student Answer: x==y x===y z==NaN isNaN(z)

u==v u===v v==w v===w

Points Received: Comments:

10 of 10

Question 7. Question :

How many times is the following while loop executed:

var i=3; while (i < 10) { i += 1; }


Student Answer: Instructor Explanation: 10 (A correct answer: 7)

Points Received: Comments:

4 of 10

Question 8. Question :

What will the following code fragment output?

var a=0; if ( true) { var a = 9; } console.log(String(a));


Student Answer: Instructor Explanation: 9 In JavaScript, unlike other languages you may have encountered, it is not an error to declare the same variable twice. Nor does an if statement, even with curly braces, create a new scope for variables.

Points Received: Comments:

10 of 10

Question 9. Question :

What will the following code fragment output?

var x='3';

var y='4'; console.log(x+y);


Student Answer: Instructor Explanation: 34 As strings, the "+" is concatenation.

Points Received: Comments:

10 of 10

Question 10. Question : Student Answer: Instructor Explanation:

What does the window prompt method do when the user clicks Cancel? (A correct answer: returns null)

nothing happens

Points Received: Comments:

0 of 10

Question 11. Question : Student Answer:

Please provide any information that will help in evaluation of your quiz. This quiz required alot of testing before answering the questions. I dont have a enough space to see the code, had to cut and paste

Points Received: Comments:

1 of 1 The short answer questions should not have a lot of code. That should warn you that you are probably off on a tangent.

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q3
1. Question : Student Answer: What happens if you call a function with too few parameters? NaN

Points Received: Comments:

0 of 10

Question 2. Question :

What value with myValue have after this computation: var myValue=72.925; myValue=parseInt(myValue);

Student Answer: Instructor Explanation:

72

Points Received: Comments:

10 of 10

Question 3. Question :

What expression can be used to compute the length of s1? var s1='99 bottles of beer'; (A correct answer: s1.length)

Student Answer: Instructor Explanation:

var olu = s1.length;

Points Received: Comments:

10 of 10

Question 4. Question : Student Answer:

What happens if you call a function with too many parameters? The function ignores other parameters, if they where defined. If the parameters were not defined you would get an not defined error

Points Received: Comments:

5 of 10 They don't match parameter names, but they are not ignored.

Question 5. Question :

Is it possible to write a function in JavaScript that takes an arbitrary number of parameters? In one, concise sentence summarize why or why not. Yes, by passing the function objects in a global object

Student Answer:

Points Received: Comments:

3 of 10 No. Review this area before the final exam. See the info on the 'arguments' pseudo-array

Question 6. Question :

Here is a function which is inconsistent in how it capitalizes rectangleArea. What does it return when called as getArea(4,5)?

function getArea(w,h) { var rectangleArea; rectanglearea = w*h; return rectangleArea;

}
Student Answer: Instructor Explanation: undefined The function is returning the value of the uninitialized (and therefore undefined) var.

Points Received: Comments:

10 of 10

Question 7. Question :

What expression returns the number of elements in an array named myArray? (A correct answer: myArray.length)

Student Answer: Instructor Explanation:

var olu = s1.length;

Points Received: Comments:

7 of 10 Wrong array!

Question 8. Question :

Given this code fragment, what is output to the log?

var grades = [ 92, 94, 96.2 ]; grades.push(89); grades.push(91); console.log(grades.pop());


Student Answer: Instructor Explanation: 91

Points Received: Comments:

10 of 10

Question 9. Question : Student Answer:

Please provide any information that will help in evaluation of your quiz. I guess I need more training with functions.

Points Received: Comments:

1 of 1 Please ask questions and we'll work our way through it!

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q4

1.

Question :

Write a one-line statement that retrieves the "x" value of the object at index 7 in the array "myLocations" and assigns it to the variable "myLatitude".

Student Answer: Instructor Explanation:

var myLatitude = myLocations[7];

(A correct answer: var myLatitude = myLocations[7].x;)

Points Received: Comments:

6 of 10 missing the 'x'

Question 2. Question :

The model of the HTML page accessible to JavaScript is stored in the (please provide both the acronym and what the acronym stands for): Document Object Model (DOM) DOM Document Object Model

Student Answer: Instructor Explanation:

Points Received: Comments:

10 of 10

Question 3. Question :

Select the best description of the scope for the variable myVariable:

// Line 0 function myFunction(x,y) { Line 1 var square; Line 2 square = x*x + y*y; Line 3 var myVariable = Math.sqrt(square); Line 4 return myVariable; Line 5 } Line 6
Student Answer: myVariable is visible globally (Line 0 to Line 6) myVariable is visible from Line 2 through line 5

// // // // // //

myVariable is visible from Line 4 to Line 5 None of the above All of the above Instructor Explanation: A var is "hoisted" to the top of the function block it is declared in.

Points Received: Comments:

4 of 10

Question 4. Question :

The finally clause of a try/catch/finally statement is executed (check as many as are true): No matter what happens in the try/catch part of the block. After the try block if at least one statment in it is executed, and after the catch block if it is invoked after that After the try block if it is successfu After the catch block if there is an exception raised None of the above

Student Answer:

Points Received: Comments:

10 of 10

Question 5. Question :

If a variable is declared twice within the same function, the second declaration: Creates and initializes a brand new variable with the same name Throws an Error Logs a warning in the console Is silently ignored and treated as an assignment.l

Student Answer:

Points Received: Comments:

1 of 10

Question 6. Question :

What value is stored in msg?

var headline="USA expects to do well in Sochi"; var msg = headline.substr(0,3).toLowerCase();


Student Answer: Instructor Explanation: "usa" (A correct answer: usa)

Points Received: Comments:

10 of 10

Question 7. Question :

Write an expression that retrieves the contents of the section of an HTML document with the id 'orchestra'

Student Answer: Instructor Explanation :

);

document.getElementById("orchestra" (A correct answer: document.getElementById('orchestra' ))

Points Received: Comments:

10 of 10

Question 8. Question :

By coding convention, if a JavaScript function or object (like Date) begins with a capital letter, one creates it and assigns it to a var using the keyword create new with in None of the above

Student Answer:

Points Received: Comments:

10 of 10

Question 9. Question :

Which expression to assigns the contents of the text input field with id 'email' to the variable theEmail var theEmail = email;

Student Answer:

var theEmail = document.email; var theEmail = document.getElementsByTagName('email'); var theEmail = window.document.getElementById('email'); var theEmail = document.getInputField('email');

Points Received: Comments:

10 of 10

Question 10. Question :

If an assignment is made in a function to a variable not declared in that function, the variable has what scope?

Student Answer:

local to the function global to the entire JavaScript runtime restricted to the block it is defined in, as marked by curly braces An error if "use strict"; is the first line of the function It is temporary, in that statement only.

Points Received: Comments:

6 of 10

Question 11. Question :

Please provide any information that will help in evaluation of your quiz. still working on functions

Student Answer:

Points Received: Comments:

1 of 1

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q5
1. Question : Because JavaScript does not have a class structure and hierarchy, it cannot support inheritance

Student Answer:

True

False (Darn tootin' JavaScript supports object inheritance.)

Points Received: Comments:

0 of 10 Sorry! This is a topic which we went over most of last week when you were unfortunately gone.

Question 2. Question :

When an object (or function yielding an object) in JavaScript begins with a capital letter, this indicates The object should be created using new The object is really an Array The object is a constant The object has global scope The object is important

Student Answer:

Points Received: Comments:

10 of 10

Question 3. Question :

When an object method is invoked, and the object has not defined that method, its _____________ is checked next for the method (A correct answer: prototype)

Student Answer: Instructor Explanation:

properties

Points Received: Comments:

2 of 10

Question 4. Question :

In the following piece of code, Superman's archrival from the 5th dimension has injected his favorite number into 'person'. Does superman now have a mxyzptlk property?

var person = {}; var superman=Object.create(person); // Oh-oh! It's Mr. Mxyzptilk! person.mxyzptlk = 77; // Does superman have a mxyzptlk property now?

Student Answer:

True

False

Instructor Putting a property in the parent or base object does Explanation: carry through to all inheriting from it! Worse yet, try deleting the property from superman!

Points Received: Comments:

10 of 10

Question 5. Question :

What method allows you to check if a property is actually in the variable you are checking, and not in an ancestor? (A correct answer: hasOwnProperty)

Student Answer: Instructor Explanation:

Enumerating Object Properties

Points Received: Comments:

6 of 10 Yes, but through what method?

Question 6. Question :

For this code, what is the value output on the console? var w = { get jersey { return 77; }, name: 'Jeff'' }; w.jersey=10341; console.log(w.jersey);

Student Answer:

77 10341 undefined it is an error

Points Received: Comments:

10 of 10

Question 7. Question :

Since an object's properties are not indexed with integers, like an array, what construct is used to iterate over all of the properties of object myObject using var p for (var p in myObject)

Student Answer:

Instructor Explanation:

Points Received: Comments:

10 of 10

Question 8. Question : Student Answer:

What is the difference between setTimeout and setInterval setTimeout is about network traffic, and setInterval is about user events setTimeout takes a function parameter and a time parameter, while setInterval takes an array parameter and a time parameter setTimeout and setInterval do the same thing; one is the modern version of the other. setTimeout fires one event, while setInterval repeatedly fires events

Points Received: Comments:

10 of 10

Question 9. Question :

Setting the location property of the document will navigate to whatever page it was assigned. False

Student Answer:

True (Fantastic, isn't it?)

Points Received: Comments:

10 of 10

Question 10. Question :

JavaScript event handler functions are passed one parameter. What does that parameter represent? (A correct answer: event)

Student Answer: Instructor Explanation:

eventlistener

Points Received: Comments:

5 of 10 It is the actual event

Question 11. Question :

Please provide any information that will help in evaluation of your quiz.

Student Answer:

Great quiz.

Points Received: Comments:

1 of 1

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q6
1. Question : The canvas, since it is an HTML5 element, cannot be interacted with by programming in JavaScript. True False

Student Answer:

Points Received: Comments:

10 of 10

Question 2. Question :

The 'document', which is a property of the 'window' global in a browser is a: Event representing a change in the HTML page Function called to get parts of the HTML page DOM representing the HTML page Array containing the elements on the HTML page An anachronism provided to confuse the unwary

Student Answer:

Points Received: Comments:

10 of 10

Question 3. Question :

Which of the following was can document elements be selected and returned in the DOM API? By id By color By CSS class

Student Answer:

By CSS selector By font

Points Received: Comments:

8 of 10

Question 4. Question : Student Answer:

When an event handler is called, what is the value of 'this'? The global object null The event, also provided as a parameter The source object of the event The 'document' object

Points Received: Comments:

2 of 10

Question 5. Question :

Scalable Vector Graphics (SVG) drawings, which can be embedded in HTML documents, can also be created and edited by drawing editors such as Adobe Illustrator and InkScape False

Student Answer:

True

Points Received: Comments:

10 of 10

Question 6. Question :

What goes in the blank to test if our event handler was triggered by a mouse event?

function handler(e) { if ( e ___________ MouseEvent) { // Omitted code ... } }


Student Answer: Instructor Explanation: .type === (A correct answer: instanceof)

Points Received: Comments:

5 of 10

Question 7. Question :

When a 'var' is declared in an anonymous event handler function ,what scope does it have? Globally scoped Scoped to the containing function of the event handler From the point of declaration to the end of the event handler function Everywhere within in the event handler function

Student Answer:

Points Received: Comments:

10 of 10

Question 8. Question :

Name the event method that keeps the default action from proceeding preventDefault

Student Answer: Instructor Explanation:

Points Received: Comments:

10 of 10

Question 9. Question :

Creating a new 'p' element to put into the HTML document is done with: var p = document.createElement('p'); var p = document.createTextNode('p'); var p = new Element('p'); var p = HTML.addParagraph(); var p = { };

Student Answer:

Points Received: Comments:

10 of 10

Question 10. Question :

Adding the newly created element stored in p, and adding it as a child of the element with id 'status' is done with: document['status'] += p; document.getElementById('status').appendChild(p); document['status'].push(p); document.getElementById('status').push(p); document.addAfter('status',p);

Student Answer:

Points Received: Comments:

10 of 10

Question 11. Question :

Please provide any information that will help in evaluation of your quiz. Trying to better understand the mathematics representation of DOM

Student Answer:

Points Received: Comments:

1 of 1

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

Q7
1. Question : A single event (say, a MouseEvent) in JavaScript can be handled by two different handlers True False

Student Answer:

Instructor This is the job of addEventHandler Explanation:

Points Received: Comments:

10 of 10

Question 2. Question : Student Answer: Instructor Explanation: events

What is passed as the parameter to an event handler? (A correct answer: event)

Points Received: Comments:

10 of 10

Question 3. Question :

In the previous problem, you might have checked your answers using this string function: function chkStringMatch(string, regularExpression) { if ( string.______________(regularExpression) ) { return true; } return false; }

Student Answer:

regex match pattern strike trim

Points Received: Comments:

10 of 10

Question 4. Question :

Which of the following string inputs will match this regular expression? /[A-Z]{2}[0-9]/

Student Answer:

Welcome to ICT4570 (Matches CT4) This course is loads of fun! Even if I have to drive down I25 (The I25 doesn't match. We need 2 letters and one number.) I usually head up to the mountains in my RX7 After I put on WD40, everything works better! (Matches WD4) I have to begin preparing the IRS 1040 for my taxes (The space spoils it.)

Points Received: Comments:

6 of 10

Question 5. Question : Student Answer: True

A single event handler can handle multiple events False

Instructor Absolutely. Explanation:

Points Received: Comments:

10 of 10

Question 6. Question :

If we want to check many things against a regular expression, we might create a function as follows. What RegEx method is used to fill in the blank? function chkRegEx(regEx,string) { if ( regEx._____________(string) ) { return true; } return false; }

Student Answer: Instructor Explanation:

test

Points Received: Comments:

10 of 10

Question 7. Question : Student Answer: True

An HTML canvas can support event handlers False

Points Received: Comments:

10 of 10

Question 8. Question : Student Answer: True

Scalable Vector Graphics (SVG) elements can support event handlers False

Points Received: Comments:

10 of 10

Question 9. Question :

What object's methods are needed to draw on a canvas?

Student Answer: Instructor Explanation:

fillStyle,fillRect,arc

(A correct answer: context)

Points Received: Comments:

3 of 10 These are the drawers--but not the object, which is the context.

Question 10. Question :

In the following function, what operator can be placed in the blank to check if e is derived from a Date? function chkIfDate(d) { if ( d ___________ Date ) { return true; } return false; }

Student Answer: Instructor Explanation:

typeof

(A correct answer: instanceof)

Points Received: Comments:

5 of 10 Almost

Question 11. Question :

Please provide any information that will help in evaluation of your quiz. Not sure about question 4, reviewed it a few times and still came up with same answer. Not sure if question was clear enough

Student Answer:

Points Received: Comments:

1 of 1

* Times are displayed in (GMT-07:00) Mountain Time (US & Canada)

También podría gustarte