Skip to content

Instantly share code, notes, and snippets.

@hamouj
Forked from mikedao/b2_intermission_work.md
Last active January 26, 2023 21:59
Show Gist options
  • Save hamouj/07557667416c2fb9d865c1ec0e8a21f9 to your computer and use it in GitHub Desktop.
Save hamouj/07557667416c2fb9d865c1ec0e8a21f9 to your computer and use it in GitHub Desktop.
B2 Intermission Work Submission

B2 Intermission Work

HTML

  1. What is HTML?

    Answer: Hyper Text Markup Language (HTML) is the standard markup language for web pages and consists of elements.

  2. What is an HTML element?

    Answer: Elements are labels for pieces of content and determines how to display the content. Elements consist of a start tag, content, and an end tag unless it is an empty element.

  3. What is an HTML attribute?

    Answer:An HTML attribute provides additional information about elements. Not all elements have HTML attributes. If an element has an attribute, it is housed within the start tag.

  4. What is the difference between a class and an id? When would you use one vs. the other?

    Answer: A class can be shared among elements while an id is unique and is only associated to one element. You would use an id when you want the styling of a specific element to be different than others and you would utilize a class when you want specific shared elements to have the same styling.

  5. What HTML would you write to create a form for a new dog with a "name" and an "age"?

    Answer:

<form>
 <label for="dname">Dog Name:</label><br>
 <input type="text" id="dname" name="dname"><br>
 <label for="dage">Dog Age:</label><br>
 <input type="text" id="dage" name="dage"><br>
</form>
  1. What are semantic tags? When would you use them over a div?

    Answer: Semantic tags convey meaning. You would use a semantic tag such as <section> over <div> when the content contained within the section has a common theme.

  2. Explain what each of the following HTML tags do and when you would use them:

  • <h1>, <h2>, etc. => These tags create different levels of headings
  • <p> => This tag creates paragraphs
  • <body> => This tag denotes the document's body where elements such as headings, paragraphs, images, etc. are written
  • <a> and the href attribute => This tag and attribute combo creats a link
  • <img> and the src attribute => This tag and attribute combo loads an image on the Web page
  • <div> => This tag defines a section/division of the Web page, but the division doesn't convey any meaning
  • <section> => This tag defines a section and is a semantic element; it denotes that everything within the section relates to a single theme
  • <ul>, <ol>, and <li> => The <ul> tag is used for unordered lists, the <ol> tag is used for ordered lists, and <li> is used to write the items within the list.
  • <form> => This tag is used to indicate a form in which user input is collected
  • <input> => Input is a for element, and when combined with the type attribute, determines the type of user input that will be collected(i.e. text, checkbox, radio button, etc.).

CSS

  1. What is CSS?

    Answer: CSS is the language used to style a Web page.

  2. What is a CSS selector? How do you use the ID selector? The class selector?

    Answer: CSS selectors are used to indicate which HTML element you are styling. The ID selector is denoted with a # and describes the style for the element with that specific id attribute. The class selector is denoted with a period and describes the style for all elements that share that class attribute.

  3. What are the three ways to include CSS in your HTML documents? What are the pros and cons of each?

    Answer: There are three ways that you can include CSS in your HTML documents. First, you can use an external style sheet which is linked within the section and allows the programmer to change an entire website by changing a single file. You can also use an internal style sheet which is included within the <style> element of an HTML page. This is best used when a single page has unique styling. Finally, you can utilize an inline style which is included in the specific element it is styling and is best when one element has unique styling.

  4. What is the Box Model? Describe each component of the Box Model.

    Answer: The Box Model is used to describe everything that wraps around an element. In the center is the content where text/images are displayed. Outside of the content is padding which is a transparent space that wraps the content. The border wraps the padding and content. Finally, on the outside is the margin which is the transparent space that wraps all the other components (border, padding, content).

SQL

Jumpstart Lab Tutorial

  1. What is a database?

    Answer: A database stores data/information and makes it accessible to SQLs.

  2. What is SQL?

    Answer: Structured Query Language(SQL) allows us to interact with databases; using SQL we are able to access, manipulate and calculate with data stored within databases.

  3. What is SQLite3?

    Answer: SQLite3 is a SQL in which the data is stored in plain-text files.

  4. What is a Table?

    Answer: A table stores data in rows and columns(headers).

  5. What is a primary key?

    Answer: A primary key is the column name(header) of the table you are working within.

  6. What is a foreign key?

    Answer: A foreign key references the key/data of another table.

  7. Explain what each of the following SQL commands do:

  • insert: adds a row to a table
  • select: selects and displays a row of data
  • where: sets criteria for the command
  • order by: orders the table data by a specified column
  • inner join: joins data from 2 tables

PG Exercises

  1. How can you limit which columns you select from a table?

    Answer: You can limit which columns you select by naming them after the SELECT command (i.e. SELECT name FROM table_name;).

  2. How can you limit which rows you select from a table?

    Answer: You can limit which rows you select using the command WHERE (i.e. SELECT id FROM table_name WHERE id < 4;)

  3. How can you give a selected column a different name in your output?

    Answer: You can use the AS command to name a column in your output table (i.e. SELECT id AS memberid FROM table_name;)

  4. How can you sort your output from a SQL statement?

    Answer: You can utilize the ORDER BY command to sort your output in ascending order; add DESC to the end to sort in descending order (i.e. SELECT id FROM table_name ORDER BY id;).

  5. What is joining? When do you need to join?

    Answer: Joining is combining tables based on a join expression. You need to join when you are cross-referencing data to create a subset of data.

  6. What is an aggregate function?

    Answer: An aggregate function takes a column of data, performs a function on it, and returns a single-value (integer).

  7. List three aggregate functions and what they do.

    Answer: SUM() adds together everything in the designated column. COUNT() counts the number of instances in a set. MAX() chooses and returns the set with the highest value based on the input.

  8. What does the group statement do?

    Answer: GROUP BY bundles the data together into groups and runs the aggregation for each group.

  9. How does the group statement relate to aggregates?

    Answer: The GROUP BY statement creates subsets for the aggregate to run through.

Rails Tutorial: Task Manager

Task Manager: https://github.com/hamouj/task_manager

Static Challenge: https://github.com/hamouj/static_challenges

  1. Define CRUD.

    Answer: CRUD stands for Create, Read, Update, Delete. They are the functionality you want to include within your application.

  2. Define MVC.

    Answer: MVC stands for Model, View, Controller. It is a method used to split a large application into specific sections that all have their own purpose.

  3. What three files would you need to create/modify for a Rails application to respond to a GET request to /tasks, assuming you have a Task model.

    Answer: You would need to modify the config/routes file to include the get request and route, create an app/views/tasks/index.html.erb file to determine what the page view will contain, and create an app/task_controller.rb file with the appropriate method(#index).

  4. What are params? Where do they come from?

    Answer: Params are hashes that contain information and are automatically created with the creation of a controller (class).

  5. Check out your routes. Why do we need two routes each for creating a new Task and editing an existing Task?

    Answer: We need two routes because the first route is a get, which gets the needed data, but since both creating and editing require changes to the data set, they need an additional route to modify the data set with the post and patch requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment