Which of the following creates an object from the person


Question 1

 

All methods in an interface must be abstract methods.

A. True
B. False

 

Question 2

 

All methods in an abstract class must be declared as abstract methods.

A. True

B. False

 

Question 3

 

PHP does not allow multiple inheritance.

A. True

B. False

 

Question 4

 

PHP does not allow constructor overriding.

A. True

B. False

 

Question 5

 

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?

A. $judy = new Person();

B. $aPerson = new Person("judy");

C. $p = Person(); $p->setName("judy");

D. $p = __construct("judy");

 

Question 6

 

Which of the following is NOT true regarding a PHP class constructor?

A. A constructor is called whenever a new instance is created.

B. A constructor can not accept any parameter.

C. A constructor is always named __construct.

D. A constructor could inherit code from a parent class.

 

Question 7

 

Which of the following creates a default constructor for the class called Animal?

A. public function __construct() { }

B. public function Animal() { }

C. public function __construct($name) { }

D. public function __Animal() { }

Question 8

 

In OOP, class data are usually private so access to class data is restricted. This design practice is called _______.

A. data composition

B. data hiding

C. data restriction

D. data abstraction

 

Question 9

 

The template or blueprint that defines abstract characteristics of all real world objects of the same kind is called a(n) ______ in OOP.

A. object

B. constructor

C. class

D. function

 

Question 10

 

In OOP, the practice of deriving new classes from existing classes is called __________.

A. inheritance

B. encapsulation

C. polymorphism

D. composition

 

Question 11

 

Which of the following statement is NOT true?

A. An abstract method contains no implementation.

B. A class that contains one or more abstract methods must be declared as "abstract".

C. An abstract class can't be instantiated.

D. A class that extends an abstract class can not be abstract.

 

Question 12

 

The public methods of a class are also known as the class's _____.

A. accessor

B. interface

C. implementation

D. constructor

Question 13

 

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?

A. final

B. static

C. private

D. abstract

Question 14

 

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?

A. public function aMethod($a, $b) { //code omitted }

B. public function bMethod($name) { //code omitted }

C. public function aMethod($name) { //code omitted }

D. public function bMethod($a, $b) { //code omitted }

Question 15

 

Which of the following is NOT a valid PHP visibility modifier?

A. protected

B. private

C. friendly

D. public

Question 16

 

In OOP, composition is sometimes referred to as a(n) ______ relationship.

A. has-a

B. is-a

C. inheritance

D. interface

Question 17

 

A _____ variable represents classwide information that is shared by all the objects of the class.

A. public

B. final

C. abstract

D. static

Question 18

 

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?

A. implements

B. inherits

C. extends

D. overrides

Question 19

 

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?

A. $name

B. $self->name

C. $this->name

D. $this->$name

Question 20

 

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?

A. $count++;

B. $this->count++;

C. $self->count++;

D. self::$count++;

Question 21

 

A is-a relationship is implemented via __________.

A. interface

B. inheritance

C. polymorphism

D. encapsulation

Question 22

 

Polymorphism is one of the three major OOP principles. It means ______________.

A. that a class can contain another class.

B. that data fields should be declared private.

C. that a class can extend another class.

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.

Question 23

 

Composition means ______________.

A. that a class can contain another class.

B. that data fields should be declared private.

C. that a class can extend another class.

D. that a class can implement another interface.

Question 24

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 .

Question 25

 

In OOP, _________ can be used to provide functionality to be inherited by related or unrelated classes.

A. superclass

B. inhiertiance

C. interface

D. polymorphism

Question 26

 

Which of the following statements is true?

A. A final class can have instances.

B. A final class can be extended.

C. A final class can be abstract.

D. A final class can not be a child class of another class.

Question 27

 

What keyword can be used to reference a method defined in the superclass from a subclass?

A. super

B. this

C. parent

D. self

Question 28

In an UML class diagram, inheritance relationship between a parent class and its child class is graphically shown with the arrow pointing to the class.

Question 29

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 relationship; the symbol in Circle 2 indicates relationship; and the symbol in Circle 3 indicates relationship.

Question 30

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

Given a JavaScript function named search:

function search() { //code omitted }

The following is the HTML code for a textbox:



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

 

Given an XML document segment:

2011

The type of the node that contains the string value "2011" is ______.

A. Document node

B. Element node

C. Text node

D. Attribute node

Question 33

 

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"?

A. xmlDoc.getElementsByTagName("author")[1].firstChild.nodeValue;

B. xmlDoc.getElementById("author")[2].firstChild.nodeValue;

C. xmlDoc.getElementsById("author").firstChild.data;

D. xmlDoc.getElementsByTagName("author")[1].nodeValue;

Question 34

 

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. .

A. value

B. responseText

C. responseXML

D. xmlDoc

Question 35

 

Given an XMLHttpRequest object named xmlHttp. Which of the following is the correct code for defining an asynchronous AJAX request?

A. xmlHttp.open("POST", "guess.php?guess=" + guess, true);

B. xmlHttp.open("POST", "guess.php?guess=" + guess, false);

C. xmlHttp.open("GET", "guess.php?guess=" + guess, true);

D. xmlHttp.open("GET", "guess.php?guess=" + guess, false);

Question 36

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

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Which of the following creates an object from the person
Reference No:- TGS01050548

Expected delivery within 24 Hours