Quiz 1 Flashcards

1
Q

Assignment

A

An operation that takes the single value from the right side and attempts to set that value to the property or variable on the left side
Eg. myVar=10 + 5

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

Code block

A
  • a section of code that is grouped together

- in JavaScript this would generally refer to a set of statements grouped using curly brackets { }

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

code compilation

A

when code is evaluated and translated into one or more code units

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

code interpretation

A

when code is parsed statement by statement at runtime

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

conditional statements

A
  • conditional statements can be used in coding situations where different blocks of statement are executed depending on the conditions at run time
  • the two statements covered where: the IF… ELSE statement and the SWITCH statement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

conditional statements: if… else

A

the IF STATEMENT evaluates a condition and executes a block if it’s true

  • optionally this is followed by an else part which is for false conditions
  • often another if statement is chained to the else part and this is sometimes referred to as an ELSE IF
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

conditional statements: switch

A

switch statements are used when a single condition is checked to see if it matches exact values or cases

  • the switch is followed by the expression to check, which can be anything that resolves to a single value to check
  • CASE statements follow, each should be an exact match for the checked expression
  • following the case are the instructions which would generally end with a BREAK that exists in the block
  • optionally a final DEFAULT case can be supplied to deal with all left over scenarios
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

comments

A
  • one or more text lines that are ignored by the interpreter
  • can be used to leave developer remarks
  • can also be used to temporarily exclude statements from execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

concatenation

A
  • an operation that puts two strings together into one

- e.g. “hello” + “there” = “hellothere”

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

Data type conversion

A
  • in javascript loosely typed variables can be changed after the fact by:
    IMPLICIT CONVERSION: is done by the interpreter as needed. For example a number will convert to a string if passed to a window.alert()
    EXPLICIT CASTING: is done by way of a set of specific methods. For example see parseInt() or parseFloat() in the Week 3 and 4 review.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

implicit conversion

A

is done by the interpreter as needed. For example a number will convert to a string if passed to a window.alert()

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

explicit casting

A

done by way of a set of specific methods. For example see parseInt() or parseFloat() in the Week 3 and 4 review.

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

data types

A
  • a declared variable or function return has an underlying datatype which defines the behaviour or potential operations that:
  • in JS variables are “loosely typed” meaning the data type can be changed after initial declaration
  • There are 7 data types in JS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

data type: boolean

A
  • a primitive data type that can only contain a true or false value
  • can be explicitly/implicitly converted to:
    • 1 or 0 for numbers
    • “true or false for strings
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

data type: number

A
  • a primitive data type that can contain numbers
  • all numbers in JS are floating decimal place values even if they appear to be whole numbers
  • can be explicitly/implicitly converted to:
    • true or false for booleans where any value >=1 is true and <0 is false
  • -“100” for strings
    • invalid attempted conversions result in NaN (not a number)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

data type: string

A
  • a primitive data type for holding character sets of zero or more characters
  • strings can be continued using either ‘single quotes’ or “double quotes”
  • all other data types can be explicitly/implicitly converted to a string
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

type: other

A
  • NULL: an abstract type representing a variable that contains no value
  • UNDEFINED: an abstract type representing a variable that has no assignment
  • SYMBOLS: an abstract type used to wrap existing objects to alter or add to existing members
  • OBJECT: used to create custom objects in addition to those provided by the DOM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Depose

A

a variable is said to be deposed when it is released from memory

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

document object model

A
  • a cross-platform standardized approach to defining HTML elements
  • includes a number of standardized properties and methods (see objects) for these elements. E.g. document.getElementById()
  • AKA DOM
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

ECMAScript

A
  • the European Computer Manufacturers Association standardized scripting specification
  • typically considered synonymous with javascript
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Escape Sequences

A
  • are used in character strings to tell the interpreter to treat a given character as it’s ASCII value and not as a jacascript character
  • Most commonlyused in JS to keep quotes from terminating a string
  • e.g. “People often use "your" when they mean"you're" all too often”
    would write as People often use “your” when they read “you’re” all too often
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

events

A
  • a user or system triggered action that in turn can invoke a function or statement

– HTML elements can have EVENT HANDLERS detailed in the tag as attributes with the value being the JS to execute when the event is triggered

– e.g.

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

Function invocation

A
  • calling a user-defined or DOM function or method by its name
  • always followed by the brackets with or without parameters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

function parameters

A
  • parameters are one or more values that are passed to a function to allow it to behave differently from invocation to invocation
  • function parameters have local scope and are deposed after completion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

function returns

A
  • a function can return a single value to the caller upon completion
  • this is done using the keyword RETURN followed by the value to return
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

functions

A
  • a discrete set of instructions contained using the block chaacters { } and given a unique signature (i.e. name) to allow for invocation
  • when a process might need to be completed any number of times
  • to facilitate collaborative or re-usable code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Literal value

A
  • the explicit usage of a static value in an expression, often just referred to as a literal

– e.g. myVal=10 + 5 … the 10 and 5 are literals

– e.g. myVal= “hello” + strName … “hello” is literal, but strName is not

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

objects

A
  • a type of data storage unit that may contain a number of pieces of data or have built in functionality (called members)
    • PROPERTIES: the data members of a given object
    • METHODS : the functions that can be called for a given object
  • object properties and methods are commonly called using “DOT NOTATION” using a period to separate the object and the member
  • e.g. window.innerWidth … a property that tells the current width of the window
  • e.g. window.alert(“hello”) … a method that produces a dialog box
  • can also use bracket notation e.g. window[”’
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

operations

A
  • a single calculation or process defined using:
    • OPERATORS: the symbol used to define the operation
    • OPERANDS: the values applied to the operation
  • the value an operation returns is known as the RESULTANT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

operators

A
  • operators are in most cases a single symbol that is used to denote an operation
  • operators can be:
    • UNARY: expects a single operand which might be on the left or right of the operator depending on the usage (e.g. myVale++ or ++myVal)
    • BINARY: expects two operands on either side of the operator
  • -TERNARY: expects three operands, in JS there is only the conditional operator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

script blocks

A
  • in HTML the tags are used to define a script block
  • within this block the rules of the scripting language (default is JS) apply and the client will attempt to interpret the statements contained within
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

statement

A
  • a single instruction
  • can contain multiple nested operations or expressions
  • often referred to as a “line of code” although it could span multiple lines
  • literally terminated (ending marked) by the semi-colon although the most interpreters will imply the termination
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

syntax

A
  • the rules for a given language including coding language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

variables

A
  • named containers for holding values that might be used in multiple locations
  • variable names should be unique to their scope and can either be:
    • read and writeable if declared using the VAR keyword
    • read-only (aka constant) if declared using the CONST keyword
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

variable scope

A
  • the scope of a variable is determined by where it’s been declared and sets where the variable can be accessed from as well as how long its exists before it is DEPOSED.

–GLOBAL VARIABLES are created whenever a variable is declared in a script block but outside of a function

– LOCAL VARIABLES are created when a variable is declared either as a parameter for a function or within the function but not within a block (see below)

– BLOCK VARIABLES are created when a variable is declared within a code block using LET (as in for loop from week 5)

36
Q

web scripting

A
  • the use of technologies to produce dynamic web page content by way of interpreted code or scripted statements
    • SERVER-SIDE: when the interpretation is attempted by the web server software before sending the page to the client
    • CLIENT-SIDE: when the interpretation is attempted by the browser (or other client
37
Q

ternary operator

A

expects three operands, in JS there is only the conditional operator

38
Q

ternary operator

A

expects three operands, in JS there is only the conditional operator

39
Q

white space

A
  • characters that are generally ignored by the script interpreter and used to promote read-ability of code
  • incl. spaces, tabs, line returns
40
Q

white space

A
  • characters that are generally ignored by the script interpreter and used to promote read-ability of code
  • incl. spaces, tabs, line returns
41
Q

document.getElementById(id)

A
  • a method of the document object that will return an element based on the passed id
  • if no element is found the returned value is undefined
42
Q

location.href

A

a property of the location object that returns the fully URL of the current page

43
Q

number.isNaN(value)

A

returns true if the passed value currently holds aa NaN (not a number) status

44
Q

number. parseFloat(string)

number. parseInt(string)

A
  • attempts to convert a string into either a float (decimal value) or integer (whole value)
  • if a string such as “cat”, cannot be converted the value NaN is set instead
45
Q

number.toFixed(number)

A

displays a value with the number of decimal places passed as the parameters showing

46
Q

object.checked

A
  • returns the checked value as a true or false for some HTML form objects specifically a checkbox or radio button
  • can be used to both set and get
47
Q

object.innerHTML

A
  • a property available to any HTML object capable of containing mark-up (e.g. span, div, p, h1, li, and td)
  • can be used to both set and get values
48
Q

object.style

A
  • the style property in turn has child properties of specific CSS style elements e.g. object.style.color
  • these children elements can in most cases be both set and get
49
Q

object.value

A
  • a property available to most HTML form controls (e.g. textbooks and combo-boxes)
  • can be used to get values in all cases and set in most (e.g. cannot be used to set a combo box)
50
Q

onclick

A
  • a event that is triggered when an HTML element has been clicked
  • commonly used with buttons
51
Q

onload

A
  • a event that is triggered when an HTML element has been fully loaded
  • commonly used in the body tag
52
Q

window.alert(text_string)

A

a method of the window object that will invoke a dialog box on screen displaying the text_string parameter as a the message

53
Q

window. innerWidth

window. innerHeight

A

two properties of the window object that given the current inner dimensions (ie without menus, toolbars, or scroll bars

54
Q

break

A

used to break out of a block, specifically in week 1-4 used to break out of a SWITCH STATEMENT after the desired statements have completed

55
Q

const

A

the keyword used to declare a READ ONLY VARIABLE

56
Q

default

A

optionally used a SWITCH STATEMENT to provide a final case

57
Q

function

A
  • the keyword used to define the following block as a discrete function
  • E.g. function myProcess(){/statement here/}
58
Q

if… else

A

used to create an IF STATEMENT where the if is followed by a condition to check and the else optionally follows the true block to contain the false block

59
Q

switch… case

A

used to create a SWITCH STATEMENT where the switch is followed by the condition in brackets and the case(s) are followed by the value to match to

60
Q

var

A

they keyword used to declare a READ/WRITE VARIABLE

61
Q

/

A

arithmetic division

62
Q

%

A
  • arithmetic modulus, which means the remainder of a division operation

– e.g. 100% 5 would return 0 because 5 goes into 100 exactly 20 times

– e.g. 20% 6 would return 2 because 6 goes into 20, 3 times (i.e. 18) and leaves a remainder of 2

63
Q

*

A

arithmetic multiplication

64
Q

-

A

arithmetic subtraction

65
Q

+

A

arithmetic addition

66
Q

++

A
  • increment can be used both pre and post depending on whether the operator is on the left or right of the operand

– e.g. where myValue is 10

– window.alert(myValue++); … would show the display 10 and then change to 11

– window.alert(++myValue); … would change to 11 and show 11

  • conventionally if it doesn’t matter the operator is placed on the right side
67
Q

A

as above but with decrements, i.e. subtracts 1

68
Q

*=

A
  • takes the variable on the left and multiplies it by the expression on the right and then assigns it to itself

– e.g. where myValue is 10

69
Q

/=

A

as above with division

70
Q

+=

A

as above with addition

71
Q

-=

A

as above with multiplication

72
Q

==

A

equal to: returns true if the two operands are the same

73
Q

!=

A

not equal to: returns true if the operands are not the same

74
Q

===

!===

A

STRICT EQUALITY and STRICT INEQUALITY: as above but also check if the data type is the same or not the same

75
Q

>

A

greater than

76
Q

> =

A

greater than or equal to

77
Q
A

less than

78
Q

<=

A

less than or equal to

79
Q

!

A

the unary NOT operator, flips a boolean value

80
Q

&&

A

the AND operator, returns true if both operands are true

81
Q

||

A

the OR operator, returns true if either operand are true

82
Q

//

A

the single line comment character

83
Q

/several lines/

A

the multi-line comment character sequence

84
Q

{ }

A

the block symbols used to mark: function blocks, conditional blocks, or loop blocks

85
Q

+ with string operands

A

concatenates two strings together into one

86
Q

?:

A
  • the ternary conditional operator, expecting three operands
    • a boolean value
    • what to return if true
    • what to return if false
  • e.g. (myNum>250) ? myNum:0 … would return myNum if it were greater than 250 otherwise it would return 0
87
Q

\

A
  • the ESCAPE CHARACTER, paired with specific characters to indicate that the character should be treated as a string character and not a code symbol
  • recognized escape sequences include:
    • " or ' … for single or double quotes to stop the outer string from terminating
    • \ … for a backspace, common when creating urls
    • \n, \r, \t and \b … for line returns, tabs and backspaces.. most commonly used when using strings that might be written to a file or database
    • e.g. myVar=”in some languages\is the"modulus"division character”