Question 1 of 36 | 2.0 Points |
All methods in an interface must be abstract methods. | | [removed] A. True | [removed] B. False |
|
Reset Selection |
Question 2 of 36 | 2.0 Points |
All methods in an abstract class must be declared as abstract methods. | | [removed] A. True | [removed] B. False |
|
Reset Selection |
Question 3 of 36 | 2.0 Points |
PHP does not allow multiple inheritance. | | [removed] A. True | [removed] B. False |
|
Reset Selection |
Question 4 of 36 | 2.0 Points |
PHP does not allow constructor overriding. | | [removed] A. True | [removed] B. False |
|
Reset Selection |
Question 5 of 36 | 2.0 Points |
Given a class named Person: class Person { private $name; public function __construct($name) { $this->name = $name; } }
Which of the following creates an object from the Person class?
[removed] A. $judy = new Person(); | | [removed] B. $aPerson = new Person("judy"); | | [removed] C. $p = Person(); $p->setName("judy"); | | [removed] D. $p = __construct("judy"); | |
Reset Selection |
Question 6 of 36 | 2.0 Points |
Which of the following is NOT true regarding a PHP class constructor? [removed] A. A constructor is called whenever a new instance is created. | | [removed] B. A constructor can not accept any parameter. | | [removed] C. A constructor is always named __construct. | | [removed] D. A constructor could inherit code from a parent class. | |
Reset Selection |
Question 7 of 36 | 2.0 Points |
Which of the following creates a default constructor for the class called Animal? [removed] A. public function __construct() { } | | [removed] B. public function Animal() { } | | [removed] C. public function __construct($name) { } | | [removed] D. public function __Animal() { } | |
Reset Selection |
Question 8 of 36 | 2.0 Points |
In OOP, class data are usually private so access to class data is restricted. This design practice is called _______. [removed] A. data composition | | [removed] B. data hiding | | [removed] C. data restriction | | [removed] D. data abstraction | |
Reset Selection |
Question 9 of 36 | 2.0 Points |
The template or blueprint that defines abstract characteristics of all real world objects of the same kind is called a(n) ______ in OOP. [removed] A. object | | [removed] B. constructor | | [removed] C. class | | [removed] D. function | |
Reset Selection |
Question 10 of 36 | 2.0 Points |
In OOP, the practice of deriving new classes from existing classes is called __________. [removed] A. inheritance | | [removed] B. encapsulation | | [removed] C. polymorphism | | [removed] D. composition | |
Reset Selection |
Question 11 of 36 | 2.0 Points |
Which of the following statement is NOT true? [removed] A. An abstract method contains no implementation. | | [removed] B. A class that contains one or more abstract methods must be declared as "abstract". | | [removed] C. An abstract class can't be instantiated. | | [removed] D. A class that extends an abstract class can not be abstract. | |
Reset Selection |
Question 12 of 36 | 2.0 Points |
The public methods of a class are also known as the class's _____. [removed] A. accessor | | [removed] B. interface | | [removed] C. implementation | | [removed] D. constructor | |
Reset Selection |
Question 13 of 36 | 2.0 Points |
Given a class method named myMethod: class A { ____ function myMethod { //code omitted } } If you don't want the method to be overridden, what keyword should be used in the blank?
[removed] A. final | | [removed] B. static | | [removed] C. private | | [removed] D. abstract | |
Reset Selection |
Question 14 of 36 | 2.0 Points |
Given classes named Parent and Child: class Parent { public function aMethod($name) { //code omitted } } class Child extends Parent { //insert a method here } Which of the following methods in class Child overrides the method aMethod defined in class Parent? [removed] A. public function aMethod($a, $b) { //code omitted } | | [removed] B. public function bMethod($name) { //code omitted } | | [removed] C. public function aMethod($name) { //code omitted } | | [removed] D. public function bMethod($a, $b) { //code omitted } | |
Reset Selection |
Question 15 of 36 | 2.0 Points |
Which of the following is NOT a valid PHP visibility modifier? [removed] A. protected | | [removed] B. private | | [removed] C. friendly | | [removed] D. public | |
Reset Selection |
Question 16 of 36 | 2.0 Points |
In OOP, composition is sometimes referred to as a(n) ______ relationship. [removed] A. has-a | | [removed] B. is-a | | [removed] C. inheritance | | [removed] D. interface | |
Reset Selection |
Question 17 of 36 | 2.0 Points |
A _____ variable represents classwide information that is shared by all the objects of the class. [removed] A. public | | [removed] B. final | | [removed] C. abstract | | [removed] D. static | |
Reset Selection |
Question 18 of 36 | 2.0 Points |
Given an OOP interface: interface Shape { public function getArea(); public function getName(); } class A ______ Shape { //code omitted } What should be inserted into the blank in class A?
[removed] A. implements | | [removed] B. inherits | | [removed] C. extends | | [removed] D. overrides | |
Reset Selection |
Question 19 of 36 | 2.0 Points |
Given a class named Person: class Person { private $name; private static $count; public function __construct($theName) { ______ = $theName; //other code omitted } } What should be inserted into the blank?
[removed] A. $name | | [removed] B. $self->name | | [removed] C. $this->name | | [removed] D. $this->$name | |
Reset Selection |
Question 20 of 36 | 2.0 Points |
Given a class named Person: class Person { private $name; private static $count; public function __construct($name) { _________ //other code omitted } } What should be inserted into the blank so that the variable $count increments by 1 everytime a Person object is created?
[removed] A. $count++; | | [removed] B. $this->count++; | | [removed] C. $self->count++; | | [removed] D. self::$count++; | |
Reset Selection |
Question 21 of 36 | 2.0 Points |
A is-a relationship is implemented via __________. [removed] A. interface | | [removed] B. inheritance | | [removed] C. polymorphism | | [removed] D. encapsulation | |
Reset Selection |
Question 22 of 36 | 2.0 Points |
Polymorphism is one of the three major OOP principles. It means ______________. [removed] A. that a class can contain another class. | | [removed] B. that data fields should be declared private. | | [removed] C. that a class can extend another class. | | [removed] D. that a variable of supertype (e.g. animal) can act as a subtype object (e.g. cat or dog). Therefore, a method operating on a supertype can operate on a subtype properly. | |
Reset Selection |
Question 23 of 36 | 2.0 Points |
Composition means ______________. [removed] A. that a class can contain another class. | | [removed] B. that data fields should be declared private. | | [removed] C. that a class can extend another class. | | [removed] D. that a class can implement another interface. | |
Reset Selection |
Question 24 of 36 | 3.0 Points |
In a UML class diagram, the symbol "+" or "-" before a member name specifies accessibility of the member. "-" indicates that the member is [removed] . |
Question 25 of 36 | 2.0 Points |
In OOP, _________ can be used to provide functionality to be inherited by related or unrelated classes. [removed] A. superclass | | [removed] B. inhiertiance | | [removed] C. interface | | [removed] D. polymorphism | |
Reset Selection |
Question 26 of 36 | 2.0 Points |
Which of the following statements is true? [removed] A. A final class can have instances. | | [removed] B. A final class can be extended. | | [removed] C. A final class can be abstract. | | [removed] D. A final class can not be a child class of another class. | |
Reset Selection |
Question 27 of 36 | 2.0 Points |
What keyword can be used to reference a method defined in the superclass from a subclass? [removed] A. super | | [removed] B. this | | [removed] C. parent | | [removed] D. self | |
Reset Selection |
Question 28 of 36 | 3.0 Points |
In an UML class diagram, inheritance relationship between a parent class and its child class is graphically shown with the arrow pointing to the [removed] class. |
Question 29 of 36 | 3.0 Points |
Given a class diagram below: https://a.gfx.ms/i_safe.gif
Note: the three circles and the numbers next to them are not part of the class diagram. Object oriented programming supports three types of class relationship:composition, inheritance, and interface. Identify the three types of class relationship in the above diagram. The symbol in Circle 1 indicates[removed] relationship; the symbol in Circle 2 indicates [removed] relationship; and the symbol in Circle 3 indicates [removed]relationship. |
Question 30 of 36 | 5.0 Points |
People often refer to an object in OOP programing as a black box. Explain your understanding of this analogy. (Maximum number of characters: 60000)
Show/Hide Rich-Text Editor |
|
Question 31 of 36 | 3.0 Points |
Given a JavaScript function named search: function search() { //code omitted } The following is the HTML code for a textbox: <input id="keyword" [removed] > The event handler for handling key release is onkeyup. What code should be filled in the blank above so that when a key is released in the textbox, the search function will be invoked? |
Question 32 of 36 | 2.0 Points |
Given an XML document segment: <year>2011</year>
The type of the node that contains the string value "2011" is ______. [removed] A. Document node | | [removed] B. Element node | | [removed] C. Text node | | [removed] D. Attribute node | |
Reset Selection |
Question 33 of 36 | 2.0 Points |
This question refers to an XML document named book.xml. Click here to display the document. Given a JavaScript variable named xmlDoc which refers to the XML document book.xml. Which of the following answers can you use to retrieve the the author of the second book, whose id is "bk102"? [removed] A. xmlDoc.getElementsByTagName("author")[1].firstChild.nodeValue; | | [removed] B. xmlDoc.getElementById("author")[2].firstChild.nodeValue; | | [removed] C. xmlDoc.getElementsById("author").firstChild.data; | | [removed] D. xmlDoc.getElementsByTagName("author")[1].nodeValue; | |
Reset Selection |
Question 34 of 36 | 2.0 Points |
One way a web server responds to an asynchronous AJAX request is sending an XML document back to the client. To extract the XML document, you may use the ________ property of the XMLHttpRequest object. . [removed] A. value | | [removed] B. responseText | | [removed] C. responseXML | | [removed] D. xmlDoc | |
Reset Selection |
Question 35 of 36 | 2.0 Points |
Given an XMLHttpRequest object named xmlHttp. Which of the following is the correct code for defining an asynchronous AJAX request? [removed] A. xmlHttp.open("POST", "guess.php?guess=" + guess, true); | | [removed] B. xmlHttp.open("POST", "guess.php?guess=" + guess, false); | | [removed] C. xmlHttp.open("GET", "guess.php?guess=" + guess, true); | | [removed] D. xmlHttp.open("GET", "guess.php?guess=" + guess, false); | |
Reset Selection |
Question 36 of 36 | 3.0 Points |
The readyState property of the XMLHttpRequest object indicates the current state of the object. The event handler that can be used to monitor status changes of the object is[removed] . |