Dashboard / Courses / BLENDED 1923T.
B / BL-CS-301-LEC-1923T / Week 14: Final Exam / Finals
Started on Tuesday, 7 January 2020, 2:06 PM
State Finished
Completed on Tuesday, 7 January 2020, 2:22 PM
Time taken 15 mins 23 secs
Marks 44.00/50.00
Grade 88.00 out of 100.00
Question 1 Which of the following would correctly generate a random number between 0 and 7?
Correct
Mark 1.00 out of Select one:
1.00
a. var rand_int= Math.floor(Math.random()*7);
b. None of the choices
c. var rand_int= Math.floor(Math.random()*8);
d. var rand_int= Math.floor(Math.random());
Your answer is correct.
Question 2 Which of the following is a valid use of the window.alert() method?
Correct
Mark 1.00 out of Select one:
1.00
a. win.alt("This is text");
b. None of the choices
c. window.alert('This is text");
d. window.alert("This is text);
Question 3 Which of the following would be a valid function name in JavaScript?
Correct
Mark 1.00 out of Select one:
1.00
a. function if ()
b. None of the choices
c. function get_text ()
d. function my function ()
Question 4 What is the purpose of the <script> and </script> tags?
Correct
Mark 1.00 out of Select one:
1.00
a. All of the choices
b. To point to an external JavaScript file
c. To tell the browser where a script begins and ends
d. To let the browser know the scripting language to be used
Your answer is correct.
Question 5 What is the output of the script below? <script> var text1 = "Hello"; var text2 = "World!";
Incorrect document.write(text1.concat(" ",text2));
Mark 0.00 out of
1.00 Select one:
a. World
b. Hello World
c. Hello" "World
d. None of the choices
Your answer is incorrect.
Question 6 An event handler is a predefined JavaScript property of an object that is used to handle an event on a Web page.
Correct
Mark 1.00 out of Select one:
1.00
a. False
b. True
Question 7 Which of the following is a valid name for an array?
Correct
Mark 1.00 out of Select one:
1.00
a. soap
b. 2ndarray
c. None of the choices
d. my array
Question 8 Which of the following is the open and closing tags of PHP?
Correct
Mark 1.00 out of Select one:
1.00
a. <?php /?>
b. <?php ?>
c. None of the Choices
d. <? /php>
Your answer is correct.
Question 9 What is the result of the script below?
Correct <script>
Mark 1.00 out of var n = ["Maria", "Isabella", "Georgina"];
1.00 n.shift();
n.unshift("Maria");
document.write(n);
</script>
Select one:
a. Isabela,Georgina,Maria
b. Maria,Isabela,Georgina,Maria
c. Maria,Isabela,Georgina
d. None of the choices
Your answer is correct.
Question 10 In naming a variable in PHP what is the required Special Character?
Correct
Mark 1.00 out of Select one:
1.00
a. & (Ampersand Sign)
b. $ (Dollar Sign)
c. @ (At Sign)
d. None of the choices
Your answer is correct.
Question 11 Which of the following correctly codes an alert on the click event?
Incorrect
Mark 0.00 out of Select one:
1.00
a. <input type=“button” onChange=“window.alert(“Hey there!”);”>
b. None of the choices
c. <input type=“button” onclick=“window.alert(“Hey there!”);”>
d. <input type=“button” onClick=“window.alert(‘Hey there!”);”>
Your answer is incorrect.
Question 12 Is a property use to display document within the frame.
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. name
c. method
d. document
Question 13 JavaScript is _________.
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. Object based
c. server-side language
d. object deficient
Question 14 Which of the following is not an include statement?
Correct
Mark 1.00 out of Select one:
1.00
a. <?php include 'include/external.php'; ?>
b. <?php include_all 'include/external.php' ?>
c. <?php require 'include/external.php'; ?>
d. <?php include_once 'include/external.php'; ?>
Your answer is correct.
Question 15 It is a PHP function wherein the data will be transmitted to the server in the http header when the form is
Correct submitted for processing.
Mark 1.00 out of
1.00 Select one:
a. None of the Choices
b. $_GET
c. $_POST
d. $_GET
Your answer is correct.
Question 16 JavaScript reserved words can be used as function names.
Correct
Mark 1.00 out of Select one:
1.00
a. False
b. True
Question 17 JavaScript has similarities to other programming and scripting languages.
Incorrect
Mark 0.00 out of Select one:
1.00
a. True
b. False
Question 18 Which of the following statements would be valid in JavaScript?
Correct
Mark 1.00 out of Select one:
1.00
a. document.write("John said, \"Hi!\"");
b. None of the choices
c. document.write('John said, "Hi!"");
d. document.write("John said, "Hi!"");
Question 19 Which of the following comparisons will return false?
Correct
Mark 1.00 out of Select one:
1.00
a. 4!=3
b. None of the choices
c. 4<=3
d. 3==3
Your answer is correct.
Question 20 Which of the following string declarations is invalid?
Correct
Mark 1.00 out of Select one:
1.00
a. var mytext= “Here is \n some text!”;
b. var mytext=“Here is some text!”;
c. var mytext=‘Here is some text!’;
d. None of the choices
Question 21 The keydown event occurs when a viewer presses down a key on the keyboard.
Correct
Mark 1.00 out of Select one:
1.00
a. True
b. False
Question 22 What are two reasons why a function can be useful?
Correct
Mark 1.00 out of Select one:
1.00
a. They make simple scripts more complex, and they make it harder for noncoders to read the script.
b. They provide a way to organize the various parts of the script into the different tasks that must be
accomplished, and they can be reused.
c. They make simple scripts more complex, and they can be reused.
d. None of the choices
Question 23 If a = 5 and b = a++ + 10 * 3, what is the value of y?
Correct
Mark 1.00 out of Select one:
1.00
a. 35
b. 36
c. None of the choices
d. 45
Your answer is correct.
Question 24 Active scripting is not a programing language instead it is a plain text interpreted to make a dynamic and
Correct interactive web pages.
Mark 1.00 out of
1.00 Select one:
a. True
b. False
Question 25 Which of the following correctly calls myFunction() whenever a user clicks a button?
Correct
Mark 1.00 out of Select one:
1.00
a. <input type = "button" value = "Submit" onClick="checkForm(this.form)">
b. <button> myFunction () </button>
c. None of the choices
d. <submit> onclicked=myFunction () </submit>
Your answer is correct.
Question 26 Which of the following is not recommended feature in choosing a script editor?
Correct
Mark 1.00 out of Select one:
1.00
a. The Script Editor should have Syntax checking
b. The Script Editor should have Syntax checking
c. The Script Editor should have Line numbering
d. None of the Choices
Your answer is correct.
Question 27 Is JavaScript code case sensitive?
Correct
Mark 1.00 out of Select one:
1.00
a. No
b. Yes
Question 28 What do the properties and methods of the Math object enable you to do?
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. Take the square roots and other such values of strings and return a number
c. Perform mathematical calculations
d. Go to math class to learn new theorems
Question 29 The _______ signals the end of a JavaScript statement.
Correct
Mark 1.00 out of Select one:
1.00
a. colon
b. period
c. None of the choices
Question 30 Which of the following does not correctly create an array?
Incorrect
Mark 0.00 out of Select one:
1.00
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 31 Is an object collection for all internal frames in the document.
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. document.form.elements
c. document.plugins
d. document.frames
Question 32 Which of the following comparisons will return true?
Correct
Mark 1.00 out of Select one:
1.00
a. 4<3
b. 4==3
c. None of the choices
d. 4!=3
Your answer is correct.
Question 33 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.00 out of
1.00 Select one:
a. False
b. True
Question 34 Why should you use the type attribute in the opening script tag?
Correct
Mark 1.00 out of Select one:
1.00
a. To be sure the browser does not interpret your JavaScript as another scripting language and to ensure the
Web page validates in XHTML
b. None of the choices
c. To let the browser know what type of coder you are
d. To create a typing script
Question 35 Which of the following is not a commenting style?
Correct
Mark 1.00 out of Select one:
1.00
a. //
b. % %
c. #
d. /* */
Your answer is correct.
Question 36 What are two of the benefits of using variables?
Incorrect
Mark 0.00 out of Select one:
1.00
a. They make the purpose of your code clearer, and they make it harder for noncoders to understand the
script.
b. They can save you time in writing and updating your scripts, and they make it harder for noncoders to
understand the script.
c. None of the choices
d. They can save you time in writing and updating your scripts, and they can make the purpose of your code
clearer.
Question 37 Which of these would be valid as the first line of a for loop?
Correct
Mark 1.00 out of Select one:
1.00
a. for (x=1;x<6;x+=1)
b. for (x==1;x<6;x+=1)
c. for (x+=1;x<6;x=1)
d. None of the choices
Your answer is correct.
Question 38 What surrounds the code inside a function?
Correct
Mark 1.00 out of Select one:
1.00
a. Square brackets - []
b. Curly brackets - {}
c. None of the choices
d. Nothing
Your answer is correct.
Question 39 Which of the following would be valid as the first line of an if/else statement?
Correct
Mark 1.00 out of Select one:
1.00
a. if (x==2) && (y > x)
b. if (x=2)
c. if (y ! 7)
d. None of the choices
Your answer is correct.
Question 40 Where should we write the event handler?
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. inside a script
c. inside a function definition
d. inside an html tag
Question 41 You should avoid using JavaScript reserved words as variable names.
Incorrect
Mark 0.00 out of Select one:
1.00
a. True
b. False
Question 42 If str = "Jose, Enrique, Vicente" and res = str.slice(15,22), what will be the resulting value of res?
Correct
Mark 1.00 out of Select one:
1.00
a. Vicente
b. ,Vicent
c. None of the choices
d. Enrique
Question 43 The getMonth() method returns the same number as the number that represents the current month (for
Correct example, returns 1 if the current month is January).
Mark 1.00 out of
1.00 Select one:
a. True
b. False
Question 44 Which of the following statements would be valid in JavaScript?
Correct
Mark 1.00 out of Select one:
1.00
a. None of the choices
b. document.write("John said, "Hi!"");
c. document.write('John said, "Hi!"");
d. document.write("John said, \"Hi!\"");
Question 45 Which of the following variable declarations uses a variable with a valid variable name in JavaScript?
Correct
Mark 1.00 out of Select one:
1.00
a. var 2cats;
b. var default;
c. var my dog;
d. None of the choices
Question 46 To write a string of text on a Web page, the _________ method is used.
Correct
Mark 1.00 out of Select one:
1.00
a. window.print()
b. document,type()
c. None of the choices
d. document.print()
Question 47 Which of the following declares a variable named pagenumber and gives it a value of 240?
Correct
Mark 1.00 out of Select one:
1.00
a. var pagenumber=240;
b. None of the choices
c. var PageNumber=240;
d. pagenumber=220;
Question 48 Which of the following will correctly access the fifth element of an array named "age"?
Correct
Mark 1.00 out of Select one:
1.00
a. age[5];
b. age(5);
c. age[4];
d. None of the choices
Question 49 Which of the following correctly assigns the result of a function named get_something () to a variable named
Correct shopping?
Mark 1.00 out of
1.00 Select one:
a. var shopping=“get_something”;
b. var shopping=get_something ();
c. None of the choices
d. var Shopping=get_Something;
Your answer is correct.
Question 50 Function names are case sensitive.
Correct
Mark 1.00 out of Select one:
1.00
a. False
b. True
◄ Quiz 006 Jump to...