Question
Q1 (a) Which of the following CSS property(ies) or values is used to place elements side-by-side or beside each other? Note: Select all that apply.
Q1
(a)
Which of the following CSS property(ies) or values is used to place elements side-by-side or beside each other?
Note: Select all that apply.
Note: Writing some code to test the responses would be recommended
Group of answer choices
float
group
inline-block
set
align
None of the answers are correct
inline
position
(b)
Look at the following code below:
What is document? What is getElementById? What is innerHTML?
Note: Select 1 response for each question for a total of 3 responses.
Group of answer choices
innerHTML is a property, which is used to get or set a value, in this case, setting the content in an HTML element
getElementById is a method, which is used to perform some action, in this case, getting an HTML element by a particular ID
document is referencing the DOM by calling the DOM API, if you want to access any element in an HTML page with JavaScript you always start with accessing the DOM
None of the answers are correct
getElementById is a property, which is used to perform some action, in this case, getting an HTML element by a particular ID
document is an event which is fired after the DOM has finished loading
document is the HTML code, if you want to access any element in an HTML page you always start with accessing the original HTML code
getElementById is a event which is fired after the DOM has loaded in order to get an HTML element by a particular ID
innerHTML is a method, which is used to get or set a value, in this case, setting the content in an HTML element
innerHTML is a property, which is used to get or set a value, in this case, getting the content in an HTML element
innerHTML is an event which is fired after the DOM has loaded in order to set the content in an HTML elemen
(c)What is the best visual representation of the DOM that developers are able to see?
Group of answer choices
None of the answers are correct
Looking at the elements panel in the developer tools on Chrome is a visual representation of the DOM
Looking at the Console in Chrome has a visual representation of the DOM and tells us if there are any compiler errors with JavaScript
Using JavaScript to print out our HTML is a visual representation of the DOM
Looking at the "View Source" tab in Chrome is the exact HTML code written and a visual representation of the DOM
There are no visual representations of the DOM. Developers know HTML is loaded in the browser and that HTML generates objects. Those objects are then represented in a hierarchical tree like structure where developers can use the DOM's API to manipulate those objects. However, we are not able to visualize the DOM.
Looking at the HTML source code on your local machine in a text editor like Brackets is a visual representation of the DOM
(d)
True or False: Is the following code valid JavaScript, considering standard web development practices and the proper use of JavaScript. Valid means there are no errors and will run properly while following proper programming techniques.
var subtract = function(x, y) { var z = x - y; return z; }; var result = subtract(4,3);
Question: Why does this or does this not run correctly?
Note: Select 1 response for True/False and 1 response for the question for a total of 2 responses.
Group of answer choices
This is a properly written function expression and functions can be passed into variables in JavaScript
You can pass functions into variables as in "var result = subtract(4,3);" but you must use the "new" operator when creating the function
True
This is a properly written function expression, but an error occurs when you pass the function into a variable
False
There is a syntax error since there is a ";" semicolon after the function close bracket '}'
The function is written wrong, there should be a function name and no variable in front. You get another error when you try to pass the function into a variable during "var result = subtract(4,3);"
If you had defined the function like this "function subtract(x, y) { ... }" then it would be the correct way to declare the function and then "var result = subtract(4,3);" would also work.
None of the answers are correct
There is no compiler error, the code runs, but you do not get the correct output
(e)
Which jQuery function is used to run code AFTER the DOM is finished loading?
Note: Select all that apply.
Note: Determine which responses jQuery supports instead of only selecting the ones shown in class.
Note: Check the jQuery documentation and you can try to run some examples in Chrome as well.
Group of answer choices
Hello World
$(body).onload(function);
#(document).ready = function(){ };
$(document).loaded(function(){ });
function imReady(jQuery){ } $(document).ready(imReady);
$(document).ready = function(){ };
$(document).ready(function(){ });
$(function() { });
None of the answers are correct
document.ready(function(){ });
(f)
What is the correct syntax for referring to an external script called "myScript.js" which is in the same directory as the HTML file using HTML5?
Note: Think of the proper programming techniques shown in class.
Group of answer choices
None of the answers are correct
(g)
Where can JavaScript be placed in an HTML5 document?
Note: Select one or more responses
Note: Remember the examples shown in class and proper programming techniques
Note: Technically JavaScript can be placed in many places but remember the proper places as shown in class.
Group of answer choices
Anywhere in the tag
At the beginning of the
onlyJavaScript can only be externally linked in the
After but before the tag
Before
Anywhere in the
JavaScript can only be externally linked in the
None of the answers are correct
At the bottom fo the
(f)
Fill in the Blanks: In JavaScript, the third statement in a for loop is _____________ but often _______________ of the initial variable.
True/False: Therefore, the following code below will compile without errors and run correctly.
var cars = ["BMW", "Volvo", "Saab", "Ford"]; var i = 0; var len = cars.length; var text = ""; for (; i < len; ) { text += cars[i] + " "; i++; }
Note: Select 1 response for each blank and 1 response for the last sentence whether it is true/false for a total of 3 responses.
Note: The best place to check whether JavaScript compiles and runs correctly is in the console on Chrome, which means you can write the code and run it to check.
Group of answer choices
None of the answers are correct
Creates a control variable
Required
Optional
Initializes the for loop
Sets the termination condition
Increments a counter
False
True
Recommended
(g)
A div element has the following style:
div { width: 656px; height: 500px; padding: 25px 14px 75px 10px; margin: 5px; border: 5px solid black; }
Using the standard box model, what horizontal distance does the div occupy on the web page known as it's physical width?
Note: Enter the width below, remember to put your units. However, make sure your response has no spaces in it. For example: 1pt, 1px, 1em, etc.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started