Académique Documents
Professionnel Documents
Culture Documents
Level: ………………………. Group: ……………… / Major: ……….…….… Minor: ……………… / Master : ……………
Reminders
● Time: 60 minutes
● Note: There are 19 pages in this exam set. Please check the page numbers before you start to solve
questions.
● This is a closed-book exam. You are not allowed to use your own papers, documents, scripts, etc.,
nor any electronic equipment (notebook computers, calculators, cell phones, etc.)
● Note that only answers in the array (2nd page) will be evaluated.
● Choose the correct answer (s) and write the corresponding letter(s) option(s). (You must fill
this array)
1
1 2 3 4 5 6 7 8 9 10
(2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt)
Correct
option(s
)
11 12 13 14 15 16 17 18 19 20
(2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt)
Correct
option(s
)
21 22 23 24 25 26 27 28 29 30
(2pt) (4pt) (2pt) (2pt) (2pt) (2pt) (2pt) (6pt) (2pt) (2pt)
Correct
option(s
)
31 32 33 34 35 36 37 38 39 40
(2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt) (2pt)
Correct
option(s
)
41 42 43 44 45
(2pt) (2pt) (4pt) (2pt) (4pt)
Correct
option(s
)
2
------------------------------------------------------------- HTML Questions ---------------------------------------------
A target
B coords
C rel
A Tag
B Empty element
C Closed element
A rows
B steps
C cell
D columns
C In different folders
3
5. What does < a href = ”http : // www. google.com” target = ” _ blank ” > Google < /a > do?
C
Nothing
A <h1>
B <h6>
C <heading>
D <head>
7. Choose the correct the correct HTML code for inserting an image
A <img src=”image.gif”>
B <img href=”image.gif”>
C <image src=”image.gif”>
A i
B italic
C em
9. Default style and color of the unvisited link in any browser is ……….
4
10. What is the correct HTML for making a drop-down list?
A <list>
B <select>
C <input type=”dropdown”>
D <input type=”list”>
A Get method
B Post method
C Set method
D Put method
A name
B selected
C checked
D value
<!DOCTYPE html>
<html>
<body>
<h1>Midterm Exam</h1>
<p>This is a paragraph.
Choose the correct answer (s) and write
the corresponding letter(s) option(s). </p>
</body>
</html>
5
A
<!DOCTYPE html>
<html>
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>
<table style="width:100%">
<tr>
<td>Company</td>
<td>Contact</td>
<td>Country</td>
</tr>
<tr>
<td>Microsoft</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctez</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
</table>
</body>
</html>
6
A
<!DOCTYPE html>
<html>
<body>
<ul>
<li>Part1</li>
<ol>
<li>Piano</li>
<li>Mezzoforte</li>
<li>forte</li>
</ol>
<li>Part 2</li>
<ol>
<li>Piano</li>
<li>Mezzoforte</li>
<li>forte</li>
</ol>
</ul>
</body>
</html>
7
A
16. What is the correct HTML for referring to an external style sheet?
A <style src=”mystyle.css”>
B <stylesheet>mystyle.css</stylesheet>
17. Choose the correct propriety to set the color of all h1 elements to green
A background-color:green;
B color:green;
C h1:green;
A font:bold;
8
B style:bold;
C font-weight:bold;
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
text-align: center;
}
p{
color:white;
font-family: verdana;
font-size: 20px;
background-color:black;
}
</style>
</head>
<body>
<h1>Midterm Exam</h1>
<p>This is a paragraph.</p>
</body>
</html>
9
21. Choose the correct output(s):
<!DOCTYPE html>
<html>
<head>
<style>
p{
border: 1px solid black;
padding-left:20px;
padding-top: 25px;
padding-bottom:22px;
}
</style>
</head>
<body>
</body>
</html>
22. Choose the correct values of the border-style property for h1 and Div in order to obtain the following
output:
10
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
border-style: (1);
border-width:5px;
}
div {
border-style: (2);
border-width:5px;
}
</style>
</head>
<body>
<h1>Web Development</h1>
<div>CS220 - Midterm</div>
</body>
</html>
23. Choose the correct CSS rule-set to set a background-image (picture.jpg) for the “body” element
A background-image:"picture.jpg";
B background-image: url("picture.jpg");
C background-image: ref("picture.jpg");
24. Choose the correct CSS rule-sets to obtain the following output:
11
A ul { list-style-type:circle; }
ol { background:blue; }
B ol { list-style-type:square; }
ul { background:blue; }
C ul { list-style-type:square; }
ol { background:blue; }
25. Select the correct CSS rule-sets that change the size of the element with id="par" into 25px, and define
the color and the background of all elements with the class "cal" to white and black, respectively.
A <style>
#par { font-size:25px; }
.cal {background:black;color:white;}
</style>
<body>
<p id="par">Paragraph 1</p>
<p class="cal">Paragraph 2</p>
<p class="cal">Paragraph 3</p>
</body>
B <style>
par { font-size:25px; }
.cal {background:black;color:white;}
</style>
<body>
<p id="par">Paragraph 1</p>
<p class="cal">Paragraph 2</p>
<p class="cal">Paragraph 3</p>
</body>
C <style>
#par { font-size:25px; }
12
cal {background:black;color:white;}
</style>
<body>
<p id="par">Paragraph 1</p>
<p class="cal">Paragraph 2</p>
<p class="cal">Paragraph 3</p>
</body>
26. Choose the correct selector to select all h2 elements inside a div element.
A div +h2
B div h2
C div.h2
27. Choose the correct CSS rule-set to display a table with the following options:
The top border = 10 pixels, the bottom border = 5 pixels, the left border = 15 pixels and
the right border = 2 pixel.
3. The padding property declares the margin between an HTML element A. True
and the elements around it. B. False
29. Choose the correct “display” value to obtain the following output
13
<!DOCTYPE html>
<html>
<head>
<style>
h3{
display: …………………………………;
}
</style>
</head>
<body>
<h3>HTML</h3>
<h3>CSS</h3>
<h3>JavaScript</h3>
</ul>
</body>
</html>
A display:block;
B display:none;
C display:inline;
30. Choose the correct output
<!DOCTYPE html>
<html>
<head>
<style>
body {counter-reset: count1;}
h1{counter-reset: count2;}
h1::before { counter-increment: count1;
content: "Chapter " counter(count1) ". ";}
h2::before {counter-increment: count2;
content: counter(count1) "." counter(count2) " ";}
</style>
</head>
<body>
<h1>HTML</h1>
<h2>Introduction</h2>
<h2>Basic Concepts</h2>
<h2>Tutorial</h2>
<h1>CSS</h1>
<h2>Introduction</h2>
<h2>Basic Concepts</h2>
<h2>Tutorial</h2>
</body>
</html>
14
A
15
A JavaScript is a scripting language used to make the website interactive
32. Which of the following methods is used to access HTML elements using Javascript?
A GetElementbyId()
B GetElementsbyClassName()
C GetElementsbyTag()
D Both A and B
33. Which of the following is the correct output for the following JavaScript code:
Var x=5,y=1
var obj ={ x:10}
with(obj)
{
alert(y)
}
A 1
B Error
C 10
D 5
16
A Shows a warning
C Throws an error
35. In the JavaScript, which one of the following is not considered as an error:
A Syntax error
B Missing of semicolons
C Division by zero
D Missing of Bracket
36. Which of the following functions of the String object returns the character in the string starting at the
A slice()
B split()
C substr()
D search()
37. Suppose we have a text "human" that we want to convert into string without using the "new" operator.
A toString(
B String(human)
C String newvariable="human"
38. Which of the following is the correct output for the following JavaScript code:
17
<p id="demo"></p>
<script>
var js = 10;
js *= 5;
document.getElementById("demo").innerHTML = js;
</script>
A 10
B 50
C Error
D 5
39. Which of the following is the correct output for the following JavaScript code:
function test() {
document.write(a);
document.write(foo());
var a = 1;
function foo() {
return 2; }
test();
A 1
2
B undefined
2
C undefined
undefined
D 2
2
40. Up to how many functions can be written inside a single HMTL SCRIPT element:
18
A None
B None or one
C Exactly one
41. HTML5 event attribute ……………….. fires on a mouse click on the element.
A Onchange
B Onclick
C Onfocus
D Onreset
42. Choose the correct event in order to obtain the following output:
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
let x =
document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
</script>
</head>
<body>
</body>
</html>
19
A Onchange
B Onclick
C Onfocus
D Onsubmit
43. Choose the correct answer in order to obtain the following output:
<!DOCTYPE html>
<html>
<body>
<p>Please input a number between 1 and 10:</p>
<input id="numb">
<button type="button"
(1) ="myFunction()">Submit</button>
<p id="demo"></p>
<script>
function myFunction() {
let x = document.getElementById("numb").value;
let text;
// If x is Not a Number or less than one or greater
than 10
if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document. (2) .innerHTML = text;
}
</script>
</body>
</html>
(1) A. Onclick
B. Onfocus
C. Onsubmit
(2) A. getElementsByTagName("demo")
B. getElementById("demo")
C. getElementsByClassName("demo")
44. Choose the correct answer in order to change the text color of the <p> element to "red"
20
<p id="demo"></p>
<script>
document.getElementById("demo"). (1) = "red";
</script>
A .textcolor
B .color
C .style.color
D .background-color
E .element.innerHTML
45. Which event allows you when you enter the input field, a function is triggered which transforms the
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript HTML Events</h2>
Enter your name: <input type="text" id="fname"
(1) ="upperCase()">
<script>
function upperCase() {
const x = document.getElementById("fname");
x. (2) = x.value.toUpperCase();
}
</script>
</body>
</html>
(1) A. Onclick
B. Oninput
C. Onchange
(2) A. value
B. element
C. style
21