You are on page 1of 3

Dashboard / Courses / BLENDED 1923T.

B / BL-CS-301-LEC-1923T / Week 13: JavaScript Functions / Quiz 006

Started on Wednesday, 8 January 2020, 2:24 PM


State Finished
Completed on Wednesday, 8 January 2020, 2:26 PM
Time taken 2 mins 30 secs
Marks 10/10
Grade 100 out of 100

Question 1 What is the result of the script below?


Correct <script>
Mark 1 out of 1 var n = ["Maria", "Isabella", "Georgina"];
n.shift();
n.unshift("Maria");
document.write(n);
</script>

Select one:
a. Maria,Isabela,Georgina,Maria

b. Maria,Isabela,Georgina 

c. None of the choices

d. Isabela,Georgina,Maria

Your answer is correct.

Question 2 What property of the Array object will return the numeric value of the length of an array?
Correct

Mark 1 out of 1 Select one:


a. None of the choices

b. The length property 

c. The getlength property

d. The lengthOf property

Question 3 Rather than executing every single line of code within the script, a conditional statement allows certain sections
Correct of the script to be executed only when a particular condition is met.
Mark 1 out of 1
Select one:
a. True 

b. False
Question 4 What is the result of the script below?
Correct <script>
Mark 1 out of 1 var greeting;
var time = 10;
if (time < 10) {
greeting = "Good morning";
} else if (time < 20) {
greeting = "Good day";
} else {
greeting = "Good evening";
}
document.write(greeting);
</script>

Select one:
a. Good day 

b. Good morning

c. Good evening

d. None of the choices

Your answer is correct.

Question 5 Which of the following will correctly access the fifth element of an array named "age"?
Correct

Mark 1 out of 1 Select one:


a. age[5];

b. age(5);

c. None of the choices

d. age[4]; 

Question 6 What is the result of the script below?


Correct <script>
Mark 1 out of 1 var n = ["Maria", "Isabella", "Georgina"];
var new_n = n.pop();
document.write(new_n);
</script>

Select one:
a. Isabella

b. Georgina 

c. Maria

d. None of the choices

Your answer is correct.

Question 7 What do you use to enclose the blocks of code in conditionals and loops?
Correct

Mark 1 out of 1 Select one:


a. Curly brackets 

b. None of the choices

c. Parentheses

d. Square brackets
Question 8 In a regular array, access to an element is usually through the use of a(n) __________.
Correct

Mark 1 out of 1 Select one:


a. string

b. random number

c. None of the choices

d. index number 

Question 9 Which of these would be valid as the first line of a for loop?
Correct

Mark 1 out of 1 Select one:


a. None of the choices

b. for (x+=1;x<6;x=1)

c. for (x=1;x<6;x+=1) 

d. for (x==1;x<6;x+=1)

Your answer is correct.

Question 10 What does the following code do?


Correct var s_list= new Array()
Mark 1 out of 1
Select one:
a. Creates an empty array named list

b. Creates an array named s_list with the default number of elements, 10

c. Creates an array that can never have any elements added to it

d. None of the choices 

◄ Lesson 11: JavaScript Functions Jump to... Finals ►

You might also like