F Exam
Last updated: 2021-08-24 14:54:59
F.1 Topics
The material for the exam includes Chapters 1–5 and Chapter 7, except for the following topics:
- Using
python
to start up local server (Section 5.6.2) - Using GitHub to start up local server (Section 5.6.3)
- The Leaflet library (Sections 7.5–7.6 and 7.8.1–7.8.2)
- The geojson.io and mapshaper web applications (Sections 7.4.1–7.4.2)
Some technical details about the exam:
- The exam will consist of 10 multiple-choice questions.
- Exam duration is 3 hours.
- The exam takes place in a regular class, with pen and paper (not in front of a computer).
F.2 Sample questions
F.2.1 Question 1
Which HTML element is used to create a top-level (largest) heading?
<h1>
<h6>
<heading>
<head>
F.2.2 Question 2
Given the following HTML code for a list with three items:
<ul>
<li class="hot" id="first">Coffee</li>
<li class="hot">Tea</li>
<li class="cold">Milk</li>
</ul>
which CSS code, when linked to the HTML document, will result in the first and third item displayed with the same color?
.hot {color: black} .cold {color: blue}
#first {color: red}
#cold {color: blue}
.cold {color: blue}
F.2.3 Question 3
What will be the value of arr
after running the following expressions?
let obj = {type: "Point", coordinates: [20, 30]};
let arr = obj.coordinates;
.push(arr[1]); arr
[20, 30, 1]
3
[20, 30]
[20, 30, 30]
F.2.4 Question 4
What will be the value of y
after running the following expressions?
let x = [{value: 3}, {value: 4}, {value: 5}];
let y = [];
.forEach(function(element) { y.push(element.value); }); x
undefined
[]
[{value: 3}, {value: 4}, {value: 5}]
[3, 4, 5]
F.2.5 Question 5
Given the following static website directory structure:
|-- www
|-- css
| |-- style.css
|-- js
|-- jquery.js
|-- main.js
|-- index.html
which HTML element should one use to include style.css
in index.html
?
<link rel="stylesheet" href="style.css">
<script src="style.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css+style.css">
F.2.6 Question 6
What will appear in the main browser window when loading an HTML document with the following contents?
<!DOCTYPE html>
<html>
<head></head>
<body>
<p id="intro">Hello
world</p>
</body>
</html>
The words “Hello” and “world,” on two separate lines
The phrase “Hello world,” on one line
Blank page
The phrase “intro Hello world,” on one line
F.2.7 Question 7
What is the right expression to clear the contents of a paragraph that has id="main"
?
document.getElementById("main")[0].innerHTML = "";
document.getElementById("#main").innerHTML = "";
document.getElementById("main").innerHTML = "";
document.getElementById("main").innerHTML = 0;
F.2.8 Question 8
What will be the value of y
after running the following expressions?
let x = {value: [41, 42, 43, 44]};
let y = x.value[x.value.length - 2];
41
42
43
44
F.2.9 Question 9
What will be the value of x
after running the following expressions?
let obj = {course: "JavaScript", year: 2021, semester: "B"};
let x = JSON.stringify([obj.course, obj.year]) + obj.semester;
["JavaScript",2021]B
["JavaScript",2022]
[{"course":"JavaScript"},{"year":2021}]B
[{"course":"JavaScript"},{"year":2022},B]
F.2.10 Question 10
Which text will appear in the main browser window when loading an HTML document with the following contents, and clicking on the button twice?
<!DOCTYPE html>
<html>
<head></head>
<body>
<p id="intro">Hi All</p>
<input type="button" id="button" value="Click me!">
<script>
document
.getElementById("button")
.addEventListener("click", function() {
let el = document.getElementById("intro");
let html = el.innerHTML;
.innerHTML += html;
el
})</script>
</body>
</html>
Hi All
Hi AllHi All
Hi All Hi All Hi All Hi All
Hi AllHi AllHi AllHi All