You are on page 1of 4

Dashboard / Courses / BLENDED 1923T.

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

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


State Finished
Completed on Wednesday, 8 January 2020, 2:08 PM
Time taken 6 mins 13 secs
Marks 9/10
Grade 90 out of 100

Question 1 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. index number 

b. None of the choices

c. string

d. random number

Question 2 What is the result of the script below? 


Correct
<script>
Mark 1 out of 1 var x = 0;
var e = "gsbatingggl.x";
var domain = "";
for(var ctr = 0; ctr < e.length; ctr++)
{
if(e[ctr] == "@")
{
domain = e.substring(ctr);
if((domain == "@yahoo.com.ph") ||
(domain == "@yahoo.com") ||
(domain == "@edu.gov"))
{
x++1;
}
}
}
document.write(x);
</script>

Select one:
a. 1

b. None of the choices

c. 12

d. 0 

Your answer is correct.


Question 3 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. None of the choices

b. Georgina 

c. Isabella

d. Maria

Your answer is correct.

Question 4 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 5 Which of the following does not correctly create an array?


Incorrect

Mark 0 out of 1 Select one:


a. var myarray= new Array(5);

b. var myarray= new Array(“hello”,”hi”,”greetings”);

c. None of the choices 

d. var if= new Array[10];

Question 6 Which of the following would be valid as the first line of an if/else statement?
Correct

Mark 1 out of 1 Select one:


a. if (x==2) && (y > x)

b. if (y ! 7)

c. None of the choices 

d. if (x=2)

Your answer is correct.


Question 7 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 

b. Isabela,Georgina,Maria

c. None of the choices

d. Maria,Isabela,Georgina,Maria

Your answer is correct.

Question 8 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. None of the choices

b. Good day 

c. Good morning

d. Good evening

Your answer is correct.

Question 9 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. The lengthOf property

b. None of the choices

c. The length property 

d. The getlength property

Question 10 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. Square brackets

c. Parentheses

d. None of the choices



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

You might also like