Module 1 - Sample Quiz 1
Question 1
Given the following fragment of HTML, which CSS style definition will cause the bullets that normally appear next to each link to disappear?
<navbar>
<ul>
<li><a href="https://www.duke.edu/">Duke University</a></li>
<li><a href="https://www.cs.duke.edu/">Duke Computer Science</a></li>
<li><a href="http://www.goduke.com/SportSelect.dbml?SPID=1846">Duke Basketball</a></li>
</ul>
</navbar>
navbar ul { list-style-type: none; margin: 0; }
navbar li { list-style-type: none; margin: 0; }
navbar { margin: 0; }
Check Answer
navbar ul { list-style-type: none; margin: 0; }
navbar ul { list-style-type: none; margin: 0; }
Question 2
What is the right order of operations for the 3 basic GIT steps?
git push
git commit
git add
Check Answer
git add
git commit
git push
git add git commit git push
Question 3
What is wrong with the following HTML?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="COMPSCI 290">
<title>Quiz</title>
</head>
<body>
<h1>HTML rocks</h1></html>
</body>
Check Answer
The </html>
and </body>
tags are in wrong order
The
</html>
and</body>
tags are in wrong order
Question 4
Write an <input>
tag whose type
is radio
, has an initial value
of "Hello, HTML"
, and has an event handler that calls the JavaScript function named doSomething
(which takes no arguments) when clicked.
Check Answer
<input type="radio" value="Hello, HTML" onclick="doSomething()">
<input type="radio" value="Hello, HTML" onclick="doSomething()">
Question 5
What is the purpose of the HTML <div>
tag?
Check Answer
It defines a division (i.e., a section) used to group HTML elements, which can then be styled separately with CSS or manipulated with JavaScript.
It defines a division (i.e., a section) used to group HTML elements, which can then be styled separately with CSS or manipulated with JavaScript.
Question 6
Assuming the following web page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="COMPSCI 290">
<title>Quiz</title>
</head>
<body>
<h1>Quiz</h1>
<ul id='foo'>
<li id='bar'>1 <h3>2</h3> 3</li>
</ul>
</body>
</html>
Draw/describe what the entire web page will look like after the following JavaScript code is executed.
document.getElementById('bar').innerHTML = "<button>Hello, HTML</button>
Check Answer
A big heading that says Quiz followed by, on a separate line, a bullet followed by, on the same line, a button (rectangular box) with this text inside: Hello, HTML
A big heading that says Quiz followed by, on a separate line, a bullet followed by, on the same line, a button (rectangular box) with this text inside: Hello, HTML
Question 7
Write simple, definition of the JavaScript function named f
for which:
f(20, 10) === true
f(2, 3) === false
f("a", "b") === false
Check Answer
function f(a, b) {
return a > b;
}
function f(a, b) { return a > b; }
Question 8
What is the syntax for a comment in HTML?
Check Answer
<!-- comment -->
<!-- comment -->
Question 9
Write an example HTML tag that would be selected by the following CSS style definition:
.bar {
color: blue;
}
Check Answer
<span class="bar"></span>
<span class="bar"></span>
Question 10
What is wrong with the following HTML (note, the problem is not in the <style></style>
tag that just defines CSS styles within the page instead of a separate file)?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="author" content="COMPSCI 290">
<title>Quiz</title>
<style>
.blue {
color: blue;
}.big {
font-size: 120%;
} </style>
</head>
<body>
<h1 class="blue" class="big">Hello, HTML</h1>
</body>
</html>
Check Answer
A tag cannot have more than one attribute with the same name.
A tag cannot have more than one attribute with the same name.
Question 11
What color is represented by the following CSS-style hex code?
#FF0000
Check Answer
red
red
Question 12
Write JavaScript code to sum the values in this array:
99,-44, 55, -11 ] let numbers = [
;
Check Answer
let total = 0;
numbers.forEach(n => {
total += n;
});
let total = 0; numbers.forEach(n => { total += n; });