Answer these Check for Understanding questions as you work through the assignments.
- What is HTML? A markup-based language that provides structure and hierarchy to all webpages.
- What is an HTML element? An HTML tag and whatever is inside that particular tag.
- What is an HTML attribute? Similar to methods, they change the behavior of an HTML element.
- What is the difference between a class and an id? When would you use one vs. the other? Classes can be used for many elements whereas an id is to only be used once.
- What HTML would you write to create a form for a new dog with a "name" and an "age"?
<form>
<input type='text' name='name'>
<input type='text' name='age'>
<input type='submit'>
</form>
- What are semantic tags? When would you use them over a
div
? They are more descriptive tags that aid in better SEO for a webpage. - Explain what each of the following HTML tags do and when you would use them:
<h1>
,<h2>
, etc. - Headers for titles<p>
- Paragraph for lots of copy.<body>
- wrapper that holds the structure for all of a page's content.<a>
and thehref
attribute - link and the hyperlink reference the link points to.<img>
and thesrc
attribute - image along with the path to the image<div>
- non-descriptive divisor that lends structure for dividing up a webpage.<section>
- more descriptive version of div.<ul>
,<ol>
, and<li>
- unordered and ordered lists.li
refers to a singular list item.<form>
- used to obtain user input that is sent to another resource through GET/POST protocols.<input>
- different methods to structure user input (e.g. text, drop-downs or buttons).
- What is CSS? A language often paired with HTML to provide aesthetics and formatting to a webpage.
- What is a CSS selector? How do you use the ID selector? The class selector? Its a reference to whatever HTML element is to be altered. The concept is the same for IDs and classes, but the syntax is slightly different.
- What are the three ways to include CSS in your HTML documents? What are the pros and cons of each? Inline, which makes sense for small tweaks, but would be impossible to style an entire page. Can also cluster chunks of css at the bottom of each webpage, but this also doesn't scale. The best way would be to have a separate css file that multiple pages reference so branding/formatting stays consistent.
- What is the Box Model? Describe each component of the Box Model. Each element is composed of multiple surrounding shells (or boxes) that can be tailored to provide flexible spacing. Padding and margin are the two important ones that provide customized padding and space away from other elements. Border is simply an outside border that is useful for seeing individual elements.
-
What is a database? Robust and organized set of data that allows applications a place to store and fetch data.
-
What is SQL? A standardized language by which we interact with most databases.
-
What is SQLite3? A database engine based on SQL that's useful for testing, but not deploying apps on.
-
What is a Table? A thematic and discrete subsection of a database that holds multiple data entries using the same columns.
-
What is a primary key? Typically a unique ID number that points to a singular row of data.
-
What is a foreign key? Its a reference to the primary key of another entry in another table. It links data between two tables.
-
Explain what each of the following SQL commands do:
- insert - inserts new data entry as a row
- select - returns rows of data from a table
- where - adds a conditional statement for what data gets returns
- order by - returns ordered data when used with a select query
- inner join - a method to create a new symbolic table to visualize data from two separate tables.
- How can you limit which columns you select from a table? List columns separately, as opposed to using *.
- How can you limit which rows you select from a table? By using a where conditional clause that applies a filter to some data.
- How can you give a selected column a different name in your output? Using the 'as' keyword.
- How can you sort your output from a SQL statement? Use the 'ORDER BY' operator.
- What is joining? When do you need to join? Joining is used to produce a combination of data that live in two separate tables. It's used to uncover more hidden relationships.
- What is an aggregate function? An aggregate function is a short query that is used to find out information about the data set.
- List three aggregate functions and what they do. MAX returns the highest value in a particular column, AVG returns the mean and COUNT returns the count of a particular case.
- What does the
group
statement do? It subdivides rows from a SELECT statement so one can apply aggregate functions to each group. - How does the
group
statement relate to aggregates? It's typically used in conjunction with aggregates so we can make calculations on each data point when returned en masse.
- Define CRUD. CRUD stands for Create, Read, Update and Delete: these 4 operations are utilized many many times in applications to interact with data.
- Define MVC. Model View Controller is a design architecture where controllers intake user input, pass on the request to a model, which then gets passed onto a view where the user receives what they were interested in.
- What three files would you need to create/modify for a Rails application to respond to a
GET
request to/tasks
, assuming you have aTask
model.config/routes.rb
,controllers/tasks
, andviews/tasks
. - What are params? Where do they come from? Params are data in a hash that is passed through a GET/POST request-- typically a form that the user entered information into.
- Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?
Because an
:id
doesn't need to exist for creating, but it does for editing. Additionally, the method (GET/PATCH) by which the data is transferred is different.