Creates an object from the person class

Assignment Help Programming Languages
Reference no: EM13776587

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:

<input id="keyword" >

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:

<year>2011</year>

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

Reference no: EM13776587

Questions Cloud

Made after income from operations on the income statement : When should a company disclose extraordinary items on their income statement? Why do you think that this disclosure is made after income from operations on the income statement?
Plot the velocity of the car as a function : Plot the velocity of the car as a function of the ratio r = mwheel/ Mmax Use practical values of r 2) Advise the team on their choice.
Prepare the journal entries that should be recorded : Polska Corporation owns a subsidiary in a foreign country that has a book value of $5,906,000 and an estimated fair value of $9,612,000. The foreign government has communicated to Polska its intention to expropriate the assets and business of all for..
Defines the significance of business research : Defines the significance of business research conducted and its purpose. Explains the specific research problem or opportunity under investigation
Creates an object from the person class : Which of the following creates an object from the Person class?
Factors predict depression in men : Why is it important/implications (E.g. xx% of men are depressed; less likely to seek treatment; if we can identify who is at risk, may be able to direct them to treatment sooner)
What is the direct materials price variance : Giovanni Company produces a product that requires four standard gallons per unit. The standard price is $34.00 per gallon. If 3,500 units required 14,400 gallons, which were purchased at $33.25 per gallon, what is the direct materials price variance?
Anatomy and physiology 1 issues : Which type of epithelial membrane surrounds and protects the vital organs in the chest cavity? What are the layers and where they located?
What should hilary or her mother do : Hilary bought jewelry at the request of her elderly mother, using her own credit card. Her mother issued a cheque to Hilary for the cost of the jewelry, $225. What should Hilary or her mother do

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd