Topic C1 Flashcards

1
Q

How do client side programs avoid overloading of program related requests?

A

They distribute the load

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can client side programs replace server side programming?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Javascript is a programming language for ______-side programs

A

client

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can javascript code be implemented into an HTML file?

A

Either directly inserted or linked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where can the script element be placed in an HTML document?

A

Anywhere

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When does the browser process the script?

A

Whenever it reaches it within the HTML file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the difference between the async and defer attributes?

A

async tells a browser to parse the HTML and JS code together, while defer tells the browser to parse the script after the page has been completely loaded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Defering a script is equivalent to…

A

Adding the script in at the end of the HTML file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does a command indicate?

A

It tells the browser an action to take

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is debugging?

A

The process of locating and fixing a programming error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an object?

A

An entity within a browser or web page that has properties and methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A ________ defines an object

A

property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A _______ acts upon a object

A

method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the 4 types of javascript objects?

A

Built-in, browser, document, and customized

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

BOM and DOM stand for what?

A

Browser object model and document object model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Objects within the object hierarchy are referenced by their ______ names

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How can objects be referenced?

A

object1.object2.object3… where object 1 is at the top of the hierarchy, object2 is the child of object1, and so on

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is an object collection and how do you reference a specific member?

A

Objects organized into groups

collection[idref] or collection.idref

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is an efficient approach to reference an element? (Hint: id)

A

document.getElementbyId(id)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How do you access an objects property?

A

object.property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you modify an object using a method?

A

object.method(values)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How do you access the HTML code within an element?

A

element.innerHTML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the syntax of a javascript function?

A
function function_name(parameters){
     commands
     return value;
}
24
Q

A javascript command that runs after a specified amount of time has passed is called a ___-_______ command

A

time-delayed
Time delay is defined using
setTimeout(“command”, delay);
where commandis a JavaScript command and delayis the delay time in milliseconds before a browser runs the command

25
Q

What does a timed-interval command to?

A

It instructs browsers to run a command repeatedly at a specified interval
setInterval(“command”, interval);

26
Q

What value does javascript return when a mathematical operation is called involving non-numeric values?

A

NaN. Check is isNaN()

27
Q

How accurate does javascript store numbers?

A

16 decimal places of accuracy. Can be changed with value.toFixed(n)

28
Q

How could you convert a numeric value into a string?

A

testString = testNumber + “”;

29
Q

__________ extracts the leading integer value from a text string

A

parseInt()

30
Q

Are javascript arrays allowed to have multiple data types within them?

A

Yes

31
Q

How does sort() work on numeric values?

A

This function sorts numeric values only by their leading digits

32
Q

How do you apply a function to every element in an array?

A

array.method(callback[, thisArg])
where array is the array, method is the array method, and callback is the name of the function that will be applied to each array item

33
Q

What is an event handler?

A

A property that controls how an object will respond to an event

34
Q

How does an event handler work?

A

The event handler waits until the event occurs and then responds by running a function or command block to execute an action

35
Q

How do you add an event handler?

A

or

object.onEvent = function;

36
Q

What are some examples of events?

A

oncopy, oncut, onerror, onlaod, onpaste, onresize, etc

37
Q

An _____ ______ is an object that contains properties and methods associated with an event

A

event object. Ex a mouse click generates info of where, which button. what time it was clicked, etc

38
Q

How would you write an javascript inline style?

A

object.style.property= “value”;, with property written in camel case

39
Q

______ styles have precedence over ____ ______

A

inline, style, sheets

40
Q

How would you access the data of an event object in your function?

A

Pass it as an argument to the function handling the event

ex function myFunc(evt){ code};

41
Q

What are some examples of mouse events that Javascript supports?

A

click, contextmenu, dblclick, mousedown, etc

42
Q

On the event model, there are four different sections. From least to most specific, what are the sections?

A

window, document, section, and figure.

43
Q

How is an event processed in the event model?

A
  • First is the capture phase, going from least to most specific.
  • Second is the target phase, taking place in the figure.
  • Third is the bubbling phase, where it goes to least specific again
44
Q

How is the event listener and event model related?

A

The event listener listens for events as they propagate through all 3 phases in the event model, and allows a script to respond within any phase.

45
Q

What is a disadvantage of the event handler?

A

They only respond to events during the target phase of the event model, but not the capture or bubbling phase.

46
Q

What is the difference between and event handler and event listener?

A

Event handlers can only apply one function to an event, whereas event listeners can apply multiple functions.

47
Q

How do you add an event listener to an object?

A

object.addEventListener(event, function);

48
Q

What is the difference between the function declaration and the function operator format?

A
Declaration: Just like another other function definition
Operator: var hello = function() {code}
49
Q

Functions defined with function declarations are created and saved as the browser parses the code prior to the script being run. What does this allow for?

A

The statements that run the function can be placed prior ti the statement that declares the function.

50
Q

Function operators are evaluated as they appear in the script after the code has been parsed.

A

They are more flexible than function declarations, allowing them to be placed anywhere a variable can be placed.

51
Q

To create a dialogue box that halts the execution of the program until the user clicks okay, use…

A

alert(text)

52
Q

How do you add properties to objects?

A

{ property1 : value 1,
property2 : value2,

}

53
Q

How do you add methods to objects?

A

objectName.methodName = function(args) { commands}

54
Q

How do you store object data into text format?

A

JSON.stringify()

55
Q

How do you convert a string into a Javascript object?

A

JSON.parse()