LFZ Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

head element

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

Where do you put visible content about the HTML document?

A

body element

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

Where do the head and body tags go in a valid HTML document?

A

html element

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

What is the purpose of a !DOCTYPE declaration?

A

clarify version of html for compatibility

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

Give five examples of HTML element types.

A

h1, p, a, img, form, span, div

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

What is the purpose of HTML attributes?

A

modify or add functionality to elements

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

Give an example of an HTML entity (escape character).

A

& copy reg pound yen lt gt ;

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

How do block-level elements affect the document flow?

A

newline, take up full horizontal space

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

How do inline elements affect the document flow?

A

they do not, and adopt the width and height of their contents

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

What are the default width and height of a block-level element?

A

100% width

content-size height

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

What are the default width and height of an inline element?

A

content size

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

What is the difference between an ordered list and an unordered list in HTML?

A

ordered lists default to numbered,

unordered defaults to bullets

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

Is an HTML list a block element or an inline element?

A

block element

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

What HTML tag is used to link to another website?

A

a

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

What is an absolute URL?

A

a complete path to the location of a resource, often to external servers

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

What is a relative URL?

A

a partial url based on the filepath of the hosting server

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

How do you indicate the relative link to a parent directory?

A

../

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

How do you indicate the relative link to a child directory?

A

./child/

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

How do you indicate the relative link to a grand parent directory?

A

../../

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

How do you indicate the relative link to the same directory?

A

./

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

What is the purpose of an HTML form element?

A

to receive inputs and information from end users, UI to interact with website

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

Give five examples of form control elements.

A

label input button option select textarea

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

Give three examples of type attribute values for HTML input elements.

A

button checkbox date email image radio search url time

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

Is an HTML input element a block element or an inline element?

A

inline-block by default

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

What are the six primary HTML elements for creating tables?

A

thead tbody tfoot th tr tf td

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

What purpose do the thead and tbody elements serve?

A

they allow different formatting for header first row

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

Give two examples of data that would lend itself well to being displayed in a table.

A

high dimensional numerical data

long text comparison between options

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

What are the names of the individual pieces of a CSS rule?

A

selector declarations

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

In CSS, how do you select elements by their class attribute?

A

.class {

}

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

In CSS, how do you select elements by their type?

A

type {

}

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

In CSS, how do you select an element by its id attribute?

A
#id {
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

Name three different types of values you can use to specify colors in CSS.

A

RGB(a)
HSL(a)
#hexcode

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

What CSS properties make up the box model?

A

width height margin padding box-sizing

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property add space between a box’s content and its border?

A

padding

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

What is a pseudo-class?

A

a keyword modifier to a css selector that activates on specific states

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

What are CSS pseudo-classes useful for?

A

reactivity to user input

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

Name two types of units that can be used to adjust font-size in CSS.

A

px em %

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

What CSS property controls the font used for the text inside an element?

A

font-family: fontname, backups;

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

What is the default flex-direction of a flex container?

A

flex-direction: row

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

What is the default flex-wrap of a flex container?

A

flex-wrap: nowrap;

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

Why do two div elements “vertically stack” on one another by default?

A

they are block elements

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

What is the default flex-direction of an element with display: flex?

A

flex-direction: row

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

What are the four components of “the Cascade”.

A

inheritance
source order
specificity
!important

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

What does the term “source order” mean with respect to CSS?

A

the order in which the rulesets are being read

46
Q

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

it happens by default for some elements

47
Q

List the three selector types in order of increasing specificity.

A

element
class
id

48
Q

Why is using !important considered bad practice?

A

it breaks the cascade and leads to unpredictable hard to maintain behavior

49
Q

What is the default value for the position property of HTML elements?

A

static

50
Q

How does setting position: relative on an element affect document flow?

A

it does not

51
Q

How does setting position: relative on an element affect where it appears on the page?

A

it can get shifted relative to where it ought have been in static

52
Q

How does setting position: absolute on an element affect document flow?

A

it does not

53
Q

How does setting position: absolute on an element affect where it appears on the page?

A

it goes to the topleft of any nonstatic elements

54
Q

How do you constrain an absolutely positioned element to a containing block?

A

contain it inside of a position:relative

55
Q

What are the four box offset properties?

A

top bottom left right

56
Q

What is the purpose of variables?

A

to hold data

57
Q

How do you declare a variable?

A

let const var

58
Q

How do you initialize (assign a value to) a variable?

A

let a = 3;

59
Q

What characters are allowed in variable names?

A

most, but varnames cannot start with numbers or non $ special characters

60
Q

What does it mean to say that variable names are “case sensitive”?

A

name != NAME

61
Q

What is the purpose of a string?

A

hold text data

62
Q

What is the purpose of a number?

A

hold numeric data

63
Q

What is the purpose of a boolean?

A

hold true-false data

64
Q

What does the = operator mean in JavaScript?

A

assignment operator

65
Q

How do you update the value of a variable?

A

var = newval;

66
Q

What is the difference between null and undefined?

A

null is intentionally empty, or placeholder for missing data

undefined is yet to be declared

67
Q

Why is it a good habit to include “labels” when you log values to the browser console?

A

console logs are meant to be read and it lets you know what you’re looking at

68
Q

Give five examples of JavaScript primitives.

A

int string bool bigint null undefined

69
Q

What data type is returned by an arithmetic operation?

A

either a number or a bigint

70
Q

What is string concatenation?

A

combining two strings into a new string

71
Q

What purpose(s) does the + plus operator serve in JavaScript?

A

string concatenation, addition operator

72
Q

What data type is returned by comparing two values (, ===, etc)?

A

bool

73
Q

What does the += “plus-equals” operator do?

A

x += 1

x = x + 1

74
Q

What are objects used for?

A

store similar data / related functions together

75
Q

What are object properties?

A

properties are the key to the unordered key:value pairs of objects;

76
Q

Describe object literal notation.

A

object = {
property: value,
property2: value2
}

77
Q

How do you remove a property from an object?

A

delete object.property;

78
Q

What are the two ways to get or update the value of a property?

A

object.dotNotation

object[‘bracketNotation’]

79
Q

What are arrays used for?

A

ordered list of data

80
Q

Describe array literal notation.

A

array = [primitiveor, object]

81
Q

How are arrays different from “plain” objects?

A

the keys default to a 0-start index

ordered nature

82
Q

What number represents the first index of an array?

A

[0]

83
Q

What is the length property of an array?

A

the number of objects inside of an array

84
Q

How do you calculate the last index of an array?

A

array.length - 1

85
Q

What is a function in JavaScript?

A

a codeblock with an optional name, optional parameters, and optional return

86
Q

Describe the parts of a function definition.

A

function keyword
parameters for input
brackets for codeblocks

87
Q

Describe the parts of a function call.

A

functionName( argument, argument2 );

88
Q

When comparing them side-by-side, what are the differences between a function call and a function definition?

A

the call is a reference that sets up the codeblock that the definition uses

89
Q

What is the difference between a parameter and an argument?

A

parameters are the inputs for definitions

arguments are the inputs for calls

90
Q

Why are function parameters useful?

A

they can give clarity and hold preset values

91
Q

What two effects does a return statement have on the behavior of a function?

A

it breaks from the containing codeblock

it returns the value following the return keyword

92
Q

Why do we log things to the console?

A

for testing and understanding

93
Q

What is a method?

A

a function that is an object property

94
Q

How is a method different from any other function?

A

it must be called on an object, or the object must exist

95
Q

How do you remove the last element from an array?

A

.pop()

96
Q

How do you round a number down to the nearest integer?

A

Math.floor(x)

97
Q

How do you generate a random number?

A

Math.random()

98
Q

How do you delete an element from an array?

A

.splice(index, 1)

99
Q

How do you append an element to an array?

A

.push()

100
Q

How do you break a string up into an array?

A

.split(delim)

101
Q

Do string methods change the original string? How would you check if you weren’t sure?

A

no, console.log()

102
Q

Roughly how many string methods are there according to the MDN Web docs?

A

roughly 20-30

103
Q

Is the return value of a function or method useful in every situation?

A

no

104
Q

Roughly how many array methods are there according to the MDN Web docs?

A

roughly 20-30

105
Q

What three-letter acronym should you always include in your Google search about a JavaScript method or CSS property?

A

mdn js

mdn css

106
Q

Give 6 examples of comparison operators.

A

=== == != !== <= >=

107
Q

What data type do comparison expressions evaluate to?

A

boolean

108
Q

What is the purpose of an if statement?

A

execute code based on the result of a conditional

109
Q

Is else required in order to use an if statement?

A

no

110
Q

Describe the syntax (structure) of an if statement.

A

if (condition) {
return code;
}

111
Q

What are the three logical operators?

A

AND &&
OR ||
NOT !

112
Q

How do you compare two different expressions in the same condition?

A

chaining them with a logical operator