Question
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
-
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
-
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
-
Data in a C program is global -- accessible and editable from any point in the program.
True
False
2 points
QUESTION 38
-
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
-
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
-
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started