Knowledge Checks / Quizzes
Which of the following is NOT true about Canvas? A) Canvas can define an area of any shape, as long as it is specified B) Canvas origin (0,0) is located in the upper-left corner of the canvas C) Canvas is declared in HTML D) In order to use canvas for interactivity, you need to use JavaScript
A) Canvas can define an area of any shape, as long as it is specified
Which of the following is true of Global Code? - All global code is contained in a function - Global code only executes when called - Global code is any code outside of any functions - Global code is automatically executed by the JavaScript engine
- Global code is any code outside of any functions - Global code is automatically executed by the JavaScript engine
Write the comment "A comment" as you would is a CSS file, using the correct syntax.
/ (asterisk) A comment (asterisk) /
What is the value of numBoxes at the end of this code segment? var numApples = 4; var numOranges = 2; var numBoxes = 0; if (numApples > 0) { if (numOranges > 10) { numBoxes = 4; } numBoxes = numBoxes + 1; } else { numBoxes = 45; }
1
Which of these are advantages of using jQuery? Choose all that apply. A) Consistent and cross-browser way of working with the DOM B) Simplified code for accessing the DOM C) Faster performance when modifying the DOM D) Quicker loading times E) Using plugins to extend website functionality
A) Consistent and cross-browser way of working with the DOM B) Simplified code for accessing the DOM E) Using plugins to extend website functionality
Which of the following is considered an event in JavaScript? A) Loading a webpage B) Generating a random number C) An infinite loop D) Concatenating a String
A) Loading a webpage
Which of the following are advantages of separating JavaScript from HTML? Select all that apply. A) Simplifies HTML files B) Makes the code more efficient C) Code can be shared or reused D) None of these - we should always keep the JavaScript within our HTML file
A) Simplifies HTML files B) Makes the code more efficient C) Code can be shared or reused
Which of the following is NOT a primary attribute for an <input> tag? A) alt B) type C) id D) value
A) alt
Which of the following attributes is an example of a boolean attribute? A) checked B) type C) value D) id
A) checked
What is missing from the code below to register the concatString() function as a click event handler? function loadedHandler() { var concatBtn = document.getElementById("concatBtn"); concatBtn.addEventListener("click", _______); } A) concatString B) concatString() C) concatString("hello", "there") D) concatString();
A) concatString
What method do we use to access data in forms? A) getElementById(string) B) getElementById C) getElementByName(string) D) getElementByName
A) getElementById(string)
Which of the following is NOT a defined object in JavaScript? A) var x B) String C) Math D) Dath
A) var x
Which of the following are benefits of using functions? A) Helps us to divide large problems into sub problems B) Helps us to divide and conquer big software projects with teams C) Makes it easier to debug our code D) Allows us to use the same code multiple times
All of the above (A, B, C, & D)
Which of the following is the correct HTML code to display a link to the University website? a) <a href = "University of Maryland"> http://www.umd.edu </a> b) <a link = "http://www.umd.edu" display = "University of Maryland"> </a> c) <link> http://www.umd.edu </link> d) <a href = "http://www.umd.edu"> University of Maryland </a>
d) <a href = "http://www.umd.edu"> University of Maryland </a>
View the switch statement below. If the item is "apple," what variables are incremented (added to)? switch (item) { case "apple": case "orange": fruits++; break; case "milk": drinks++; case "cheese": dairy++; break; case "beef": case "chicken": meat++; break; default: other++; }
fruits only
In the code below, what is autos.length? var autos = ["Chevrolet", "Dodge", "Ford", "Ram"]; A) 4 B) Infinite C) 3 D) 5
A) 4
What is the output to the console? var pies = ["Cherry", "Peach", "Pecan", "Chocolate"]; for (i = 0; i < pies.length; i++) { if (i % 2 == 0) { console.log(pies[i]); } } A) undefined B) Cherry, Pecan C) Cherry, Peach, Pecan, Chocholate D) Peach, Chocolate
B) Cherry, Pecan
Which of the following is NOT a principle of effective web design? A) Always consider the spacing, grouping, similarity, and overall visual logic of the patterns in design B) Focuses on incorporating as much detail as possible C) Groups elements within defined regions D) Uses modules and chunks web content for ease of scanning
B) Focuses on incorporating as much detail as possible
What is the output to the console? var names = []; names[0] = "Peter"; names[1] = "Paul"; names[2] = "Mary"; console.log(names[2] + names[1]); A) PaulMary B) MaryPaul C) PaulPeter D) PeterPaul
B) MaryPaul
Which of the following is NOT a responsibility of ICANN? A) Coordinates internet naming system B) Reviews validity of published websites C) Ensures every IP address is unique D) Oversees distribution of IP addresses and domain names E) Accrediting domain name registrars
B) Reviews validity of published websites
Which statement below declares the variable average without assigning a value to average? A) average; B) let average; C) let average = 0; D) average = 0;
B) let average;
When this code runs, what is the last number output to the console? var b = 20; do { console.log(b); b--; } while (b >= 10);
10
Convert the following hexadecimal (base-16) number to binary (base-2): 13DA
1001111011010
Convert the following decimal (base-10) number to binary (base-2): 238
11101110
Convert the following binary (base-2) number to decimal (base-10): 10101111
175
If the grid container has 10 grid items, what grid-template-columns value creates a grid with 2 rows and 5 columns? #grid-container { width: 600px; display: grid; grid-template-columns: ____________; }
200px auto auto auto 200px
What's the size of an IP address in IPV4?
32 bits
What is the final value of numItems? var bonus = 11; var numItems; if (bonus < 12) { bonus = bonus + 2; numItems = 3 * bonus; } else { numItems = bonus + 10; }
39
Convert the following hexadecimal (base-16) number to decimal (base-10): 13DA
5082
What is the final value of numItems? var bonus = 15; var numItems = 4; if (bonus > 10) { numItems = numItems + 3; }
7
Which of the following represents a complete HTML element? - <h1>My stuff</h1> - <h1>My stuff<h1> - </h1>My stuff<h1> - <h1>My stuff
<h1>My stuff</h1>
Of the following heading tags, which is the largest? - <h4> - <h3> - <h5> - <h2>
<h2>
The correct sequence of HTML tags for starting a website is:
<html>, <head>, <title>, <body>
Which of the following is the correct way to link an external stylesheet in our HTML file?
<link rel="stylesheet" type="text/css" href="MyCSS.css">
Which of the following is the correct way to add inline style to a paragraph tag to change the font color to blue?
<p style="color: blue;">
Which of the following is NOT an HTML tag associated with a table? - <table> -<td> -<row> -<th>
<row>
What does the keyword "const" mean when used in JavaScript? A) A universal constant, like Pi B) A constant reference to a value set by the user C) It's just another keyword for a variable D) This is not a valid keyword in JavaScript
B) A constant reference to a value set by the user
Using jQuery, which line of code removes the class "myClass" from all elements currently using the "myClass" class? A) $(".myClass").removeClass(".myClass"); B) $(".myClass").removeClass("myClass"); C) $("div").removeClass(".myClass"); D) $("div").removeClass("myClass");
B) $(".myClass").removeClass("myClass");
What numbers are output by the following code segment? for(e = 2; e<14; e+=2){ console.log(e); } A) 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 B) 2, 4, 6, 8, 10, 12 C) 2, 4, 6, 8, 10, 12, 14 D) 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
B) 2, 4, 6, 8, 10, 12
Which of the following variable names is illegal in JavaScript? A) my_variable B) PHONENUMBER C) $money D) 7to8
D) 7to8
Which of the following is NOT a method (function) associated with arrays? A) reverse B) push C) pop D) lock
D) lock
Using jQuery, which line of code selects all <p> elements in a document? A) $("<p>") B) $("#p") C) $("p") D) $(p) E) $(#p)
C) $("p")
What is the rectangle's width in the code below? context.strokeStyle = "rgb(255, 0, 0)"; context.strokeRect(10, 20, 40, 60); A) 10 B) 20 C) 40 D) 60
C) 40
If you want to play audio on your page, which tag should include the src attribute? A) <audio> B) </audio> C) <source> D) </source>
C) <source>
Which of the following is NOT a primitive data type in JavaScript? A) Boolean B) Number C) Object D) String
C) Object
The question below is an example of which criteria to evaluate web data? "Is the document part of an organization with a philosophical or political agenda?" A) Authorship B) Publishing Entity C) Point of View D) Currency E) Context Author Situates Work F) Accuracy
C) Point of View
Use the object below the answer the question: var book = { title: "Hatching Twitter", published: 2013, keywords: ["origins", "betrayal", "social media"], author: { firstName: "Nick", lastName: "Bilton" } } A) book.Published = 2018; B) book.Published: 2018; C) book.published: 2018; D) book.Published = 2018
C) book.published: 2018;
Which loop always executes the loop body at least once? A) for B) while C) do-while D) All of the above E) None of the above
C) do-while
To access an object's properties, which keyword would b need to use in the blank below: getAuthorName: function() { return __________.author.name; } A) Author B) object C) this D) String
C) this
Using String concatenation, what will the output be of the following expression in Java? 13 + 14 + "Hey There!" + 15 + 18 A) 1314Hey There!1518 B) 27Hey There!33 C) 1314Hey There!33 D) 27Hey There!1518
D) 27Hey There!1518
umd.edu is an example of a/an _________
Domain name
A DNS server's primary role is to convert ___________
Domain name to IP address
Does the if statement below evaluate to True or False? score = 2; if (score == 50) { score = 100; }
False
Refer to the pie array. var pie = ["Cherry", Peach", "Pecan", "Chocolate", "Mud"]; True or False: pie.indexOf("Pecan") returns 3.
False
True or False: A function must always return a value
False
True or False: Local variables are visible outside of their function
False
True or False: The actions a web browser notices are called handlers.
False
True or False: The canvas must be surrounded by a border.
False
True or False: When using jQuery's methods which modify elements, you can only select one element at a time
False
True or False: When using the POST method with forms, the content is included in the URL.
False
HTML stands for:
HyperText Markup Language
Which of the following are examples of attributes in an HTML tag? I. width II. src III. img IV. th
I and II
What type of list is the following list an example of? My Favorite Foods 1. Pizza 2. Burgers 3. Chocolate
Ordered
Which of the following is NOT a common HTTP request method? GET HEAD POST SEND
SEND
What is the purpose of HTML in creating a webpage?
Specifies document structure
Does the if statement below evaluate to True or False? status = 10; if (status > 5) { length = 0; }
True
True or False: A form is the means by which information is passed from the user to a server.
True
True or False: A method may be defined inside or outside an object literal.
True
True or False: Both lists and tables must include nesting
True
True or False: Class selectors, written in the CSS, are meant to be used multiple times within the HTML code, while id selectors are meant to be used only once.
True
True or False: For arrays , the sort() method sorts an array in increase order based on the String's Unicode value.
True
True or False: The form tag has two attributes: the action and the method.
True
Match the following selector examples with the category of selector they are: a) a:link b) :first-letter c) li a d) p.center e) .main-list f) #special-list
a) a:link --> pseudo-class b) :first-letter --> pseudo-element c) li a --> descendant d) p.center --> chained e) .main-list --> class f) #special-list --> id
Identify what is returned in the function defined below: function myAge( dateObj, myBirthday){ var age = myBirthday.getFullYear() - dateObj.getFullYear(); return age; }
age
Which fo the following attributes MUST be included within the <img> tag? - width - alt - src - title
alt and src
View the code snippet below. What condition makes the loop output the even numbers 2 through 100? var b = 2; while (_____) { console.log(b); b = b + 2; }
b <= 100
Which of the following is NOT true about shorthand properties? a) Using shorthand allows you to specify several properties by using only one b) If you don't specify a particular property, no value will be used c) Commonly used shorthand properties include background, font, list-style, margin, border, and padding d) Using shorthand allows you to group common properties on the same theme
b) If you don't specify a particular property, no value will be used
Which of the following are properties present in the code snippet below? p{ background-color: #000000; border-width: 2px; }
background-color and border-width
Identify the parameter(s) in the function defined below: function myAge( dateObj, myBirthday){ var age = myBirthday.getFullYear() - dateObj.getFullYear(); return age; }
myBirthday dateObj