java 1 Flashcards

(49 cards)

1
Q

why use java script?

A

adds interactivity and visual enhancement

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

java mainly used for

A

client-side scripting

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

using java with client-side scripting means that there’s no _____

A

internet traffic or server processing of client requests

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

java cons

A
  • client may not have sufficient processing resources
  • java can be turned off for security reasons
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

t/f: javascript is the same as JAVA

A

false

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

JavaScript is not JAVA because:

A
  1. no graphical user interface
  2. no read/write file access
  3. not a class-based object model
  4. no multithreading
  5. does not need the Java Virtual Machine, needs a browser
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what java can do (client-side):

A
  • control browser features
  • modify document appearance
  • modify document content
  • stored and use info abt user
  • manipulate images
  • react to state of browser and client system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

CSS can handle (Java not necessary):

A
  • hover and focus events
  • image swaps
  • basic animation
  • drop-down menus
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

java script can achieve (that CSS can’t):

A
  • visual enhancements
  • advanced animation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

2 places to put JavaScript

A

under title in HTML head, put Java in its own file

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

how to embed Java in HTML

A

under title in script element in head section

<script>
CODE GOES HERE
</script>

</head>

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

t/f: JavaScript code can be inserted anywhere in HTML, including the body

A

true

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

t/f: there are limits on how many script tags can be embedded in the HTML code of a web page

A

false

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

how to put javascript in its own file

A

<head>
<title></>


</head>
</title></head>

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

src attribute of script element specifies

A

the URL of external code source

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

which way to use java is the best way for code reuse

A

putting java in own file

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

valid variable names consist of

A

letters, digits, underscores, and dollar signs

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

valid variable names do not begin with

A

a digit, not a reserved java keyword

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

t/f: java is not case sensitive

A

false

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

what statement declares a variable

A

var or let
var varName = 1;

21
Q

java variables have ____ data types

22
Q

what is var cars = [“Saab”, “Volvo]

23
Q

what is var x = {firstname:”John”, lastname:”Doe”};

24
Q

%

A

modulus (remainder)

25
++/- -
increment, decrement
26
var a = 10; b=a++; b=++a;
(a=11, b=10) (a=11, b=11)
27
var a = 3; var b = "3"; var c = (a==b); var d = (a===b);
c = true d = false
28
and, or, not operators
&&, ||, !
29
java comment
//
30
multiple line java comment
/* */
31
number
java function that converts a value to numeric data type
32
x = "hello" + 5
x = "hello5"
33
x = "5" + 5
x = "55"
34
x = number("5") + 5
x = 10
35
get length of variable x="Virginia Tech:
var y = x.length
36
change variable to all caps or all lower
x = x.toUpperCase() x = x.toLowerCase()
37
how to get current date and time
var a = newDate()
38
2 control structures
conditions and loops
39
3 types of loops
while, do, for
40
if condition
if (condition) { code } else { code };
41
while loop
while (condition) { //loop code goes here };
42
do loop
do { //loop code goes here } while (condition);
43
for loop
for(statement 1; condition; statement 2){ //loop code }; **statement 1 starts before loop, statement 2 is done after every iteration
44
input/output in java is limited bc of
security
45
output
- window.alert() - document.writeln() or document.write()
46
input
- window.prompt() - confirm() (ok/cancel box)
47
debug
- console.log() - console.error()
48
date methods are based on
time since a given date
49
date methods
getHours, getDay, getDate, getMinutes, getMonth, getFullYear