Quiz Questions Flashcards
Where do you put non-visible content about the HTML document?
In the head element.
Where do you put visible content about the HTML document?
In the body element.
Where do the head and body tags go in a valid HTML document?
Inside the HTML element. head goes first then body .
What is the purpose of a DOCTYPE declaration?
First thing on the HTML doc, it declares which type of HTML the webpage is using.
Give five examples of HTML element tags.
<p>, <a>, <span>, , <div></div></span></a></p>
What is the purpose of HTML attributes?
They provide additional information about the element, either editing it or adding more details.
Give an example of an HTML entity (escape character).
& = & or &, < = < or
How do block-level elements affect the document flow?
They take up the whole width of the page. Must start on new line.
How do inline elements affect the document flow?
They take up as much width as needed, like the span element.
What are the default width and height of a block-level element?
Height is a high as the parent, width is the entire page.
What are the default width and height of an inline element?
both are as much as what the parent element size is.
What is the difference between an ordered list and an unordered list in HTML?
Ordered lists are ordered using numbers, unordered list use bullet points or other characters to list
Is an HTML list a block element or an inline element?
It is a block level element.
What HTML tag is used to link to another website?
The ‘anchor’ tag, <a></a>
What is an absolute URL?
URL that points to a specific system and to a specific part
What is a relative URL?
URL that is within the same site
How do you indicate the relative link to a parent directory?
by using the ‘..’ notation followed by ‘/’, to go out of the current file you are in.
How do you indicate the relative link to a child directory?
by naming the child directory followed by ‘/’.
How do you indicate the relative link to a grand parent directory?
like indicating the parent but with ‘../../’ notations.
How do you indicate the relative link to the same directory?
Simply using the file/directory name.
What is the purpose of an HTML form element?
The form element is the place where form controls should be placed in. The area/place where interactive controls are entered.
Give five examples of form control elements.
input, label, button, select, textarea
Give three examples of type attributes for HTML elements.
‘text’, ‘password’, ‘radio’
Is an HTML element a block element or an inline element?
They are inline elements.
What are the names of the individual pieces of a CSS rule?
The rule set and declaration block
In CSS, how do you select elements by their class attribute?
Using the period or dot notation followed by the name
In CSS, how do you select elements by their type?
Using the name of the tag or type. i.e p, body, h1 etc.
In CSS, how do you select an element by its id attribute?
Using the # before the name of the id
Name three different types of values you can use to specify colors in CSS.
The RGB, Hex code, color name, also there is HSL(hue, saturation, lightness)
What CSS properties make up the box model?
Margin, border, padding, content
Which CSS property pushes boxes away from each other?
The margin
Which CSS property add space between a box’s content and its border?
The padding
What is a pseudo-class?
It is a special keyword we can apply to CSS selectors
What are CSS pseudo-classes useful for?
Gives the selector a certain functionality or certain action depending on the pseudo class.
Name at least two units of type size in CSS.
Pixels (px), em, rem, percentage. 16px is 1rem and is usually default.
What CSS property controls the font used for the text inside an element?
The font-family
What are the four components of “the Cascade”.
Source order, Inheritance, Specificity, !important
What does the term “source order” mean with respect to CSS?
The ruleset or selector put last takes precedence.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Inheritance provides that functionality.
List the three selector types in order of increasing specificity.
- Type selectors (h1, body, p, and pseudo elements)
- Class selectors (.example, attribute selectors)
- ID selectors (#example).
Why is using !important considered bad practice?
Makes debugging difficult and overall considered bad practice.
What is the default flex-direction of a flex container?
A row.
What is the default flex-wrap of a flex container?
No wrap which is a row, all in one line
Why do two div elements “vertically stack” on one another by default?
Because they are block level elements
What is the default value for the position property of HTML elements?
Static or normal flow
How does setting position: relative on an element affect document flow?
It does not affect the document flow.
How does setting position: relative on an element affect where it appears on the page?
It does not affect where it appears, unless we use offset properties to move them.
How does setting position: absolute on an element affect document flow?
It removes it from the document flow.
How does setting position: absolute on an element affect where it appears on the page?
Yes, it will move it relative to the closest parent depending on where it was originally.
How do you constrain an absolutely positioned element to a containing block?
By setting the containing block or parent element to position other than static.
What are the four box offset properties?
Top, bottom, right, left.
What is the purpose of variables?
To store data
How do you declare a variable?
Using the assignment operator ‘=’ with ‘var’, ‘const’ and ‘let’
How do you initialize (assign a value to) a variable?
The assignment operator ‘=’.
What characters are allowed in variable names?
$, _ , any character. Can not start with numbers but can use numbers in.
What does it mean to say that variable names are “case sensitive”?
Can have two variables with the same spelling but different, coolname is not the same as coolName.
What is the purpose of a string?
To use text
What is the purpose of a number?
For calculations needed in the program
What is the purpose of a boolean?
Y or N answers or True or False.
What does the = operator mean in JavaScript?
To assign stuff
How do you update the value of a variable?
Use the variable name and assignment operator to a different value.
What is the difference between null and undefined?
Null is an intentional lack of value, undefined is a value that was never assigned.
Why is it a good habit to include “labels” when you log values to the browser console?
To better clarify when debugging.
Give five examples of JavaScript primitives.
Strings, Booleans, Numbers, null, undefined
What data type is returned by an arithmetic operation?
A number
What is string concatenation?
Combines strings together
What purpose(s) does the + plus operator serve in JavaScript?
Addition of number data types and concatenation of strings.
What data type is returned by comparing two values (, ===, etc)?
A boolean.
What does the += “plus-equals” operator do?
Adds the value and updates the variable.
What are objects used for?
Group together variables and functions to create a model. Used to model real world objects as well.
What are object properties?
They are called keys, they are variables attached to an object.
Describe object literal notation.
Listing out the key and value pair inside the curly brace
How do you remove a property from an object?
Using the delete operator and accessing the property in the object