Intro to html css and JavaScript. 12 questions with multiple answers needed in <30 mins
JavaScript
1. Which of the following is not valid JavaScript code?
A. var x = "Failing is just another word for learning.";
b. var y = 3 + 4;C. variable a equals Welcome John Doe;D. var result = 8 * 3;e. // This is how you make a comment in JavaScript
2.which of the following code snippers properly declares a greet function that returns a greeting and then calls it?
A. var greet function namereturn "Hello, " + name
greet()
B. function(name) {return "Hello, " + name;
}
greet;
C. var greet = {"Hello, " + name;
}
greet();
D. function greet(name) {return "Hello, " + name;
}
greet("Grace Hopper");
A. A
B. B and D
C. A,B, AND D
D. D
E. B and C
3. With CSS, how could you be sure to give every <div> tag on a page a grey background?
A. #div {background: grey;
}
b. div {background: grey;
}
c. div {background: rgb(0, 0, 250);
}
d. DIV {background: rgb(0, 0, 250);
}
4. When you run eslint --version on your computer, what version does it report is installed?
a. Version 5 or higher
b. Version 17 or higher
c. v3.12.1
d. Version 2.0.0 or lower
I don’t have eslint installed on my computer.
5. With CSS, how could you be sure to give every <div> tag on a page a grey background?
A. #div {background: grey;
}
b. div {background: grey;
}
c. .div {background: rgb(0, 0, 250);
}
d. DIV {background: rgb(0, 0, 250);
}
6. Consider this JavaScript code:
var a = 42;
var b = "forty-two";
Which of the following options is true of this code?
A. To the computer, they are identical.
B. The variable a is a “number” type, and variable b is a “string” type.
C. This is invalid JavaScript code.
a > b
7. What CSS property, when applied to an image, positions the image toward the left, so that adjacent text flows beside and under it?
flow: right;
B. float: left;
C. layout: float;
D.image: left;
E. text: flow-right;
8. Which of the following statement best describes the body element inside an HTML document?
a. The body element can be embedded inside the head element.
b. There can be multiple <body> tags inside an HTML document
c. Heading tags such as <h1>, <h2> or <h3> cannot go inside the body element. They should be placed inside the head element for proper rendering.
d. Content, such as text or images, is placed within the body element.
9. Consider the following HTML code:
<!DOCTYPE html>
<html>
<head>
<title>HTML excercise</title>
</head>
<body>
<p>This exercise covers basic HTML topics</p>
</body>
</html>
Which of following choices best describes the code above?
A. The HTML code has all the necessary tags for a valid HTML document
B. The HTML code has duplicate html tags
C. The HTML code has misplaced title tag. Title tag should always be placed with the text inside the paragraph tag
D. The HTML code is invalid as it does not include any css or javascript tag
10. Consider the following conditional statement:
((2 * 90) === 180) && (false && 'true')
The result of this code is false because:
a. The statement contains false boolean in it and when combined with other variables it always turns them to false as well.
b. The statement is evaluating 2 different sub expressions. The results of these expressions are then compared with the “and” operator. Since one is false, the whole statement evaluates to false.
c. The statement is too complex and error prone, essentially resulting in false.
d. The statement is trying to combine numbers (2, 90, 180) with the wrong symbols and hence resulting in false.
11. Which of the following JavaScript “for loops” will have the maximum iterations?
a. for (var i = 1; i <= 24; i = i + 1) {}
b. for (var i = 4; i < 24; i = i + 2) {}
c. for (var i = 4; i < 24; i = i + 1) {}
d. for (var i = 4; i < 24; i = i + 24) {}
12. Which of following code snippets properly declares a greet function that returns a greeting, and then calls it?
Snippet A:
var greet function name
return "Hello, " + name
greet()
Snippet B:
function(name) {
return "Hello, " + name;
}
greet;
Snippet C:
Snippet C:
var greet = {
"Hello, " + name;
}
greet();
Snippet D:
function greet(name) {
return "Hello, " + name;
}
greet("Grace Hopper");
A. A
B. B and D
C. A,B,D
D. D
E. B and C
F.
JavaScript
1.
W
hich
of the following is not
valid JavaScript code?
A.
var
x
=
"
Failing is just another word for learning.
"
;
b.
var
y
=
3
+
4
;
C.
variable
a
equals
Welcome
John
Doe
;
D.
var
result
=
8
*
3
;
e
.
// This is how you make a comment in JavaScript
2
.which of the followin
g code snippers properly
declares
a greet function that returns a greeting and
then calls it
?
A.
var
greet
function
name
return
"
Hello,
"
+
name
greet
()
B.
function
(
name
)
{
return
"
Hello,
"
+
name
;
}
greet
;
C.
var
greet
=
{
"
Hello,
"
+
name
;
}
greet
();
D.
function
greet
(
name
)
{
return
"
Hello,
"
+
name
;
}
greet
(
"
Grace Hopper
"
);
A.
A
B.
B and D
C.
A,B, AND D
D.
D
E.
B and C
JavaScript
1. Which of the following is not valid JavaScript code?
A. var x = "Failing is just another word for learning.";
b. var y = 3 + 4;
C. variable a equals Welcome John Doe;
D. var result = 8 * 3;
e. // This is how you make a comment in JavaScript
2.which of the following code snippers properly declares a greet function that returns a greeting and
then calls it?
A. var greet function name
return "Hello, " + name
greet()
B. function(name) {
return "Hello, " + name;
}
greet;
C. var greet = {
"Hello, " + name;
}
greet();
D. function greet(name) {
return "Hello, " + name;
}
greet("Grace Hopper");
A. A
B. B and D
C. A,B, AND D
D. D
E. B and C