java 2 Flashcards

(54 cards)

1
Q

java functions can be

A

built-in or customized

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

java provides several built-in functions that have a rich collection of methods for performing

A

common math calculations, string manipulations, date manipulations, and array manipulations

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

customized function template

A

function name (input parameters, if any) {
//function code
}

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

three ways to return control to the point at which a function was invoked

A
  • reaching function-ending right brace
  • executing statement return;
  • executing statement “return expression;” to return value of expression to caller script
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

t/f: a function can be considered as an object and referenced by a variable

A

true

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

function as object code

A

var obj = function(){
console.log(“Hello”);};

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

a function without a name is an

A

anonymous function

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

t/f: a function cannot be used as an argument to another function

A

false

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

function as arg for another function

A

window.setTimeOut(obj, 5000);

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

array

A

group of variables that have same name and are normally of same type

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

individual variable in array is called

A

element

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

refer to element in array by

A

giving array’s name followed by position number of element in square brackets

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

t/f: first element in array is zeroth element

A

true

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

5th element in array c is referred to as

A

c[4]

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

find length attribute of array

A

arrayname.length

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

java arrays are array _____

A

objects

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

what operator is used to create new array and to specify number of elements in an array

A

new operator

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

create new array ex

A

var n1 = [];
var n2 = new Array();
var n3 = [“Ford”, “Toyota”];

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

6 array methods

A
  • push
  • pop
  • shift
  • concat
  • sort
  • indexOf
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

push()

A

adds new element to end of array

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

pop()

A

removes last element in array and returns the removed element

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

shift()

A

removes first element in array and returns it

23
Q

concat()

A

concatenates two arrays into one

24
Q

sort()

A

sorts an array

25
indexOf()
search array for an element and returns its position index
26
var nums =[3, 6, 2]; console.log(nums.concat([3,5]));
//[3,6,2,3,5]
27
java events
allow scripts to respond to user interactions and modify the page accordingly
28
event examples
click, dblclick, change, submit, mouseover, mouseout
29
java events and event handling help make ______
web applications more dynamic and interactive
30
click
when user single-clicks HTML element
31
dblclick
when user double-clicks element
32
change
when user makes selection change in select element
33
submit
when form's data is submitted
34
mouseover
when mouse cursor enters an element, mouseover event occurs
35
event handler
function that responds to an event
36
registering an event handler
assigning an event handler to an event on a DOM node
37
method addEventListener
can be called multiple times on a DOM node to register more than one event-handling method for an event
38
if a script in head attempts to get a DOM node for an HTML element in the body,
getElementbyId returns null bc body has not yet been loaded
39
window object
represents open window in browser
40
if a document contains frames (