Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 35 Which of the following is a correct definition for a Rectangle class in Java? public Rectangle class { double length; double width; public

QUESTION 35

  1. Which of the following is a correct definition for a Rectangle class in Java?

    public Rectangle class { double length; double width; public double getArea() { return length * width; } public double getPerimeter() { return 2 * (length+width); } }

    public Rectangle class { double length; double width; public getArea():double { return length * width; } public getPerimeter():double { return 2 * (length+width); } }

    public class Rectangle { double length; double width; public double getArea() { return length * width; } public double getPerimeter() { return 2 * (length+width); } }

    public class Rectangle { double length; double width; public getArea():double { return length * width; } public getPerimeter(): double { return 2 * (length+width); } }

2 points

QUESTION 36

  1. The following Javascript code is most likely in which tier of the Model-View-Controller design pattern? function Circle(r){ this.radius = r; this.getArea = getA; this.getPerimeter = getP; this.getData = getD; } function getA(){ return this.radius * this.radius * Math.PI; } function getP(){ return 2 * this.radius * Math.PI; } function getD(){ return 'Area: ' + this.getArea() + ' Perimeter: ' + this.getPerimeter(); }

    Model

    View

    Controller

    Unable to determine

2 points

QUESTION 37

  1. Data in a C program is global -- accessible and editable from any point in the program.

    True

    False

2 points

QUESTION 38

  1. In the following code, how many Rectangle objects are instantiated? Rectangle rect1 = new Rectangle(); rect1.length = 4.0; rect1.width = 2.0; rect1 = new Rectangle(2.0, 1.0);

    0

    1

    2

    3

2 points

QUESTION 39

  1. Which is the most efficient way to concatenate the two strings, quick brown fox and jumped over the lazy dog in Java?

    String string1 = quick brown fox; string1 = string1 + jumped over the lazy dog;

    String string1 = quick brown fox; String string2 = string1 + jumped over the lazy dog;

    String string1 = quick brown fox; String string2 = jumped over the lazy dog; String string3 = string1 + string2;

    StringBuffer buffer = new StringBuffer(quick brown fox); buffer.append( jumped over the lazy dog); String string1 = buffer.toString();

2 points

QUESTION 40

  1. What are the more commonly used names for accessor methods?

    Getters and setters

    Makers and takers

    Pushers and pullers

    Givers and takers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions