CGS3175 FINAL PRACTICE EXAM
What is the SassScript variable $new-color? $new-color: #a9d4ff - 4;
#a5d0fb
What is the value of SassScript variable $inverse-color?$inverse-color: invert(#000);
#fff
Select the HTML special character that completes the abbreviation: AT_____T.
&
In JavaScript, multiple lines are commented out using _____.
/**/
Which statement evaluates to true? let score = 10;
scrore == "10"
Which element is used to style a drop-down menu in web forms?
select
Which code segment defines a setter for the breed property, so that assigning to person1.breed sets person1.pet? let person1 = { firstName: "Sophie", lastName: "Hernandez", age: 25, pet: "", _____ };
set breed(value) { this.pet = value; }
What does stringify() return? JSON.stringify({"friends": [{ "name":"Bobby"}, {"name":"Celia"},{"name":"Judy"}]});
single string
What does this animation do to the object? #object { position: absolute; animation: slide 5s; } @keyframes slide { 0% { color:black; left:0px; top:0px; } 25% { color:blue; left:100px; top:0px; } 75% { color:red; left:0px; top:100px; } 100% { color:black; left:0px; top:0px; } }
starts in the top-left corner, moves the object to the right, then down and to the left, then up to return the starting position
Which variables are scoped to the entire function given? function addStrings() { let str1 = "This is string 1."; if (str1 == "") { let str2 = str1 + " This is string 2."; console.log(str2); } let str3 = "This is string 3."; console.log(str1 + " " + str3); }
str1 and str3
In JavaScript, 5 + "5" evaluates to a _____.
string
Complete the statement below to answer what is output to the console? let weather = "stormy"; _____ (weather) { case "rainy": message = "It is raining."; break; case "cloudy": message = "There is a chance it will rain."; break; case "thunder": message = "There is a storm out there."; break; default: message = "It is sunny."; } console.log(message);
switch it is sunny
What is the final output? let quote = "Talk and they will listen."; quote = quote.replace("talk", "Speak"); quote = quote.replace("they", "I"); quote = quote.replace("LISTEN", "be heard");
talk and i will listen
In a text box's keypress event handler, the event parameter's _____ property is the text box object where the keypress event occurred.
target
Why will this declaration not work?animation: linear 5s 3 alternate-reverse;
the animation name property is missing
Using the snippet of code below, what time is it? hour = 11; if (hour <= 10) { message = "Time for breakfast."; } else if (hour <= 14) { message = "Time for lunch."; } else if (hour <= 20) { message = "Time for dinner."; } else { message = "Time for a snack."; }
time for lunch
what attribute of an input element can be validated when text is entered on a webpage?
value
Given the following form, what is the request method? <form action="http://whereis.org/"> <input type="text" name="state"> <input type="text" name="city"> <input type="submit"> </form>
GET
What are the three key languages used in modern web design?
HTML, CSS, and JavaScript
Which two elements do not require a closing tag?
IMG,BR
Which method changes 10.2 to 11?
MAth.ceil(10.2);
What is browser caching designed to reduce?
Retrieval time of web content
What happens when type="i" is added to the <ol> tag? <ol type="i"> <li>Sam</li> <li>Mike</li> <li>Sandra</li> </ol>
The numbers change to lower-case Roman numerals
Why do web developers leave comments in HTML code?
To leave notes or reminders IDK
What do the developer guidelines state regarding attribute names and tag names?
Use all lowercase, no uppercase
What is the name of the organization that is currently setting the HTML standards?
WHATWG
What program is used for viewing HTML files?
Web browser
What is output to the console? let myPhrase = "Are you talking to me?"; console.log(myPhrase.split("a")); ["Are you t", "lking to me?"]
["Are you t", "lking to me?"]
What is the proper structure for creating a bulleted list?
<ul> <li>England</li> <li>Japan</li> <li>Australia</li> </ul>
_____ is a collection of related web pages.
A website
Which guideline is violated in the following example: <input type="button" id="button1" name="button1" value="submit" />
Avoid self-closing tags
Why would someone use CSS animations instead of JavaScript animations?
Css animations can look and work better on computers with limited resources
Why would someone use a domain name instead of an IP address?
Domain names are easy to remember, and IP addresses are not
Which HTML container is commonly used to house copyright information on a webpage?
FOOTER
What is the date?let day = new Date(2020, 9, 30);
Fri Oct 30 2020 03:00:00 GMT-0400 (Eastern Daylight Time )
What is the last number output by the loop? i = 5 while (i >= 0) { console.log(i); i--; }
0
What is the last number output by the loop? i = 5 while (i >= 0) { console.log(i); i--; } Group of answer choices6
0
Math.floor(Math.random() * 4); will produce random numbers between _____.
0 and 3
In the following snippet, what is the minimum number of items sent to the server when the submit button is pressed? <form> <input type="checkbox" name="checkbox" checked> <input type="radio" name="radio" value="1" checked> <input type="submit"> </form>
1
What does nums.indexOf(10) return?let nums = [4, 8, 10, 6, 2];
2
What is output for Math.pow(4,4);?
256
How many grid items are in this grid layout? dy { display: grid; grid-template-areas: "head head" "nav article" "foot aside"; }
5
Which message is output to the console? let size = 7; if (size >= 0 && size <= 2) { console.log(size + " is a small."); } else if (size > 2 && size <= 4) { console.log(size + " is a medium."); } else if (size > 4 && size <= 6) { console.log(size + " is a large."); } else { console.log(size + " is an extra large."); }
7 is an extra large
In this illustration with 4 images, if Image 4 has z-index value of 4, what is a possible z-index value for Image 2?
8
Which block of code will result in an error in the HTML validator?
<!DOCTYPE html> <html lang="english"> <meta charset="UTF-6"> <title>My Page</title> <body> <p>Hi</p> </body> </html>
Which code segment below converts the following image into a link?
<a href="http://www.artist.com/"><img src="vanGogh.jpg" alt="van Gogh self portrait"></a>
Which element properly follows the developer guidelines to assign a concise boolean value to an attribute?
<button type="submit" hidden>Submit</button>
The smallest heading is _____, while the largest heading is _____.
<h6>, <h1>
Which tag conveys the importance of the word "only" in the sentence below?Use in case of an emergency.
<strong>
Which HTML element displays the text "strong emphasis" in the style of strong emphasis?
<strong><em>strong emphasis</em></strong>
CSS rules may be placed within _____ tags of an HTML file.
<style>
What tag is used to add visual layout to a page?
<style>
What is the correct structure for creating a table?
<table> <tr> <th></th> </tr> <tr> <td></td> </tr> </table>
Which attribute makes the data span 4 rows?
<td rowspan="4">
https://www.google.com is an example of a(n) _____ URL.
absolute
If a web browser supports only ogg file format, which sound clip will be downloaded? <audio controls> <source src="audio.mp4">< source src="audio.ogg"><source src="audio.mp3"> </audio>
audio.ogg
Which string in wordNums matches the regex? let wordNums = ["blahblah!!", "yea", "N()P3", "H!"]; let re = /\wa\S!/;
blahblah!
When styling elements of a web form, which setting is defined for radio buttons and not for checkboxes?
border-radius
How are password fields protected when they are sent to a server upon form submission?
by using HTTPS
Which code segment changes the year to 2021?let changeYear = new Date (2020, 6, 20);
changYear.setFullYear(2021)
Which Date method changes the time from 12 noon to 4 pm?let changeTime = new Date(2020, 5, 2, 12);
changeTime.setHours(16);
What attribute is used to force a user to enter a value into a form?
required
parseFloat() is used with _____ numbers.
decimal
Fill in the blank to eliminate the owner property from the pokemon object. let pokemon = { name: "Eevee", color: "brown", evolution: "Jolteon", owner: "Ash" }; _____ pokemon.owner;
delete
Which of the following methods sets the text color in a div element to green? let div = document.querySelector("div");
div.style.setProperty("color", "green");
Which loop executes once before the condition is tested?
do-while
In the following example, how is the head element accessed from a DOM? <!DOCTYPE html> <html lang="en"> <meta charset="UTF-8"> <title>DOM example</title> <body> <p>DOM example.</p> </body> </html>
document.documentElement.children[2]
Assuming the following <div id="div1" ><p id="p1">Click Me </p></div>, what event listener declaration pair would result in the given message sequence: "You clicked on the p element." "You clicked the div element."
document.getElementById("p1").addEventListener("click", function() { alert("You clicked the p element."); }, false); document.getElementById("div1").addEventListener("click", function() { alert("You clicked the div element."); }, true);
which code segment removes the class "myClass" from the element <span id="myId" class="myClass"></span>
document.querySelector(#myId).classList.delete("myClass");
The CSS rule input:invalid _____.
does nnot require javascript to validate
A variable declared inside a function with var has _____ scope. A variable declared inside a function with let has _____ scope.
function, block
What is output to the console when the following code runs in a browser? var withVar = "Global declared with var"; let withLet = "Global declared with let"; console.log(withVar); console.log(withLet); console.log(window.withVar); console.log(window.withLet);
global declared with var global declared with let global declared with var undefined
Replace the grid-column and grid-row declarations using grid-area. #grid-item-x { grid-column: 2 / 4; grid-row: 3 / 5; }
grid-area: 3/2/5/4
What is output to the console? num = 5; console.log(num > 10 ? "Iron Man" : "Hulk");
hulk
Which if-else statement correctly conveys the following information?If age is at least 16, "You can learn to drive." is output.
if (age >= 16) { console.log("you can learn to drive."); } else { console.log("you need to wait a little longer."); }
An example of a falsy value is _____.
if("")
abSum is what type of function? function multiplyNums(x, y) { return x * y; } function findSum(a, b) { let abSum = function() { return a + b; } return abSum(); }
inner
an event occurs when someone enters their name in an input field is an ______ event
input
What is output to the console? let re = /i.+e/; result = re.exec("Moana is better than Frozen."); if (result === null) { console.log("No match"); } else { console.log(result[0]); }
is better than Froze
What expression iterates over all the animals properties? let animals = { "cat": 1, "dog": 1, "fish": 3, "hamster": 2 }; for (_____) { console.log(animal + " count = " + animals[animal]); }
let animal in animals
Which regular expression matches only the words burp, dirt, and right?let randomWords = ["burp", "try", "dirt", "right"];
let re = /[a-i]/
Which code snippet uses an anonymous function? Group of answer choices
let subNum = function(a, b) { return b - a;
Adding a target="_blank" attribute to a link results in a _____.
link that opens in a new browser window
The variable findCost has _____. function musicTix(people, price) { var findCost = people * price; return findCost; }
local scope
What does the following code snippet output to the console? let names = ["Mike", "Belinda", "Jonny", "Sophie"]; for (i = 0; i < names.length; i++) { console.log(names[i]); }
mike belinda jonny sophie
Given the following code, re.test() returns true for which string? let odWords = ["Body", "mood", "FOOD", "bode"]; let re = /od$/g; odWords.forEach(function (word) { if (re.test(word)) { console.log(word); } });
mood
What is the correct format for calling the function and using 1 and 2 as arguments? function multiplyNums(a, b) { return a * b; }
multiplyNums(1,2)
what is the preferred way to register an event handler that allows multiple handlers for the same event?
myButton.onclick = clickHandler;
Complete the line of code so the negative numbers are filtered out. function positiveNumsOnly(numbers) { function isItPositive(positive) { return positive >= 0; } console.log("positive numbers are: " + _____); } let numbers = positiveNumsOnly([1, 0, -5, -96, 41, -99, -7]);
numbers.filter(isItPositive)
How is the age field accessed after the following is executed: let obj = JSON.parse('{"name":"Bobby", "age":20}');
obj.age
how many DOM nodes are created from the paragraph?
one for the p element and one for the paragraph text
In HTML, <img> is an example of _____.
opening tag
Which strings match the regex? let words = ["dapper", "paper", "cat", "flack"]; let re = /pa|ac/;
paper,flack
What are the settings placed inside this element used for?input[type=radio] + label::before
place a custom radio button to the left if the label
Which statement changes the puppy object's name from Daisy to Darth? let puppy = { name: "Daisy", breed: "husky", color: "black" };
puppy.name="Darth";
What is output to the console? function changeThings(someMovie) { someMovie.title = "Race"; someMovie = { title: "42", rating: "PG-13" }; } let movie = { title: "Greater", rating: "PG" }; changeThings(movie); console.log(movie.title);
race
What is the aspect ratio of an image?
width:height
What JavaScript object and method is used to write HTML to the web page?
window.write()
Good practice is to ensure that web pages _____.
work acceptably on all established browsers
x = 4 ** 4 is the same as _____.
x = 4*4*4*4