-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.js
68 lines (67 loc) · 3.08 KB
/
data.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
export const multiQuiz = [
{
question: "Which of the following is NOT a primitive data type in JavaScript?",
choices: ["boolean", "string", "array"],
answer:"array"
},
{
question: "If you want to delare a variable that's value cannot later be reassigned, what would you use?",
choices: ["var", "let", "const"],
answer:"const"
},
{
question: "How do you write an 'if statement' in JavaScript?",
choices: ["if (hour < 12) { greeting = 'good morning!'}", "if [hour < 12] {greeting = 'good morning'}", "if (hour < 12; greeting = 'good morning!')"],
answer: "if (hour < 12) { greeting = 'good morning!'}"
},
{
question: "What is the correct way to write a 'for loop' in JavaScript?",
choices: ["for (let i = 0; i < array.length; i+){code to be executed}", "for (let i = 0; i < array.length; i++){code to be executed}", "(let i = 0; i < array.length; i++){code to be executed}"],
answer: "for (let i = 0; i < array.length; i++){code to be executed}"
},
{
question: "Which of the following is the correct way of defining a function in JavaScript?",
choices: ["myFunction{code to be executed}", "myFunction() {code to be executed} function", "function myFunction() {code to be executed}"],
answer: "function myFunction() {code to be executed}"
},
{
question: "For which of the following would you expect to see 'false' logged out?",
choices: ["console.log(0 == false)", "console.log(1 === '1')", "console.log(1 == '1')"],
answer: "console.log(1 === '1')"
},
{
question: "What does the preventDefault method do in JavaScript?",
choices: ["Executes the default behavior of an event", "Prevents the default behavior of an event", "Removes an event listener from an HTML element"],
answer: "Prevents the default behavior of an event"
},
{
question: "How would you describe the function of (||), the Logical OR operator?",
choices: ["Returns true only if both operands are false", "Returns true if both operands are true", "Returns true if at least one of the operands is true"],
answer: "Returns true if at least one of the operands is true"
},
{
question: "Which method would you use to delay a function for a specified amount of time?",
choices: ["setTimeout()", "setInterval()", "setDelay()"],
answer: "setTimeout()"
},
{
question: "What is the purpose of the math.floor method?",
choices: ["Rounds a number down to the nearest integer", "Returns the absolute value of a number", "Rounds a number up to the nearest integer"],
answer: "Rounds a number down to the nearest integer"
},
{
question: "What will be logged out? let fruits = ['apple', 'banana', 'cherry'] console.log(fruits[1])",
choices: ['apple', 'banana', 'cherry'],
answer: 'banana'
},
{
question: "What will be logged out? let fruits = ['apple', 'banana', 'cherry'] console.log(fruits.pop())",
choices: ['apple', 'banana', 'cherry'],
answer: "cherry"
},
{
question: "What will be logged out? let fruits = ['apple', 'banana', 'cherry'] console.log(fruits.shift())",
choices: ['apple', 'banana', 'cherry'],
answer: "apple"
}
]