45. The purpose of defining the equals() method in a class is a. to check if...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
45. The purpose of defining the equals() method in a class is a. to check if an object is null b. to check equality of objects field-by-field c. to check if two objects of the class are identical d. to check if the data fields have default values e. none of the above 46. Which statement holds true for the chess method headers taken from a class named Games public void chess (Person player1, Person player2) public Person chess (int winner) public double chess (double award) public int chess (Person master) a. Correct overloading of the chess method b. The class does not compile, because the return types are all different c. Incorrect attempt of overloading, because the methods must be static CS 16000-04 Introduction to Computer Science I d. Incorrect attempt of overloading, because type Person is used in two methods e. None of the above Spring Semester 2022 47. The expression below refers to the combining of data and code into a single object a. Data hiding b. A public class c. Encapsulation d. The new operator e. Variable declaration 11 48. For the following code, which statement is true? public class Circle{ private double radius = 15; public double area (double radius) { return Math.PI*radius*radius; } } a. The code has a compiler error b. The method parameter and field are the same variables. c. The method returns the area of this circle of radius 15. d. In the area formula, radius takes the parameter value. e. None of the above 49. Data hiding in Java means that a. the fields are static b. the fields cannot be accessed by its method c. the fields cannot be accessed directly from an external code d. a local variable in a method hides an instance field of the same name e. all the above 50. It is common practice in object-oriented programming to a. declare the fields private b. aggregate classes to other classes CS 16000-04 Introduction to Computer Science I 12 Spring Semester 2022 c. design multiclass solutions to programming problems d. create programs that are made of objects which can store data and perform operations e. perform all the above 51. (5 points) Consider public class Rectangle { private static int nosOfInstances Created } public Rectangle() { nosOfInstancesCreated++} public static int getNos Instances Created() { in main method, we have //Number of instance(s) of Rectangle is/are created Rectangle box1; = 0; System.out.print(Rectangle.getNos Instances Created() + "); box1 = new Rectangle(); The output to the console is: return nos Instances Created; } IT System.out.print(Rectangle. getNos InstancesCreated() + Rectangle box2 = new Rectangle(); System.out.print(box2. getNos Instances Created () + "); Rectangle box3; a. 1 2 1 1 2 b. 1 2 3 4 5 C. 0 1 1 0 1 d. 0 1 2 2 3 e. None of the above System.out.print( Rectangle.getNos Instances Created() + "H box3= new Rectangle(); System.out.print( Rectangle.getNos InstancesCreated()); 11 "Li " 45. The purpose of defining the equals() method in a class is a. to check if an object is null b. to check equality of objects field-by-field c. to check if two objects of the class are identical d. to check if the data fields have default values e. none of the above 46. Which statement holds true for the chess method headers taken from a class named Games public void chess (Person player1, Person player2) public Person chess (int winner) public double chess (double award) public int chess (Person master) a. Correct overloading of the chess method b. The class does not compile, because the return types are all different c. Incorrect attempt of overloading, because the methods must be static CS 16000-04 Introduction to Computer Science I d. Incorrect attempt of overloading, because type Person is used in two methods e. None of the above Spring Semester 2022 47. The expression below refers to the combining of data and code into a single object a. Data hiding b. A public class c. Encapsulation d. The new operator e. Variable declaration 11 48. For the following code, which statement is true? public class Circle{ private double radius = 15; public double area (double radius) { return Math.PI*radius*radius; } } a. The code has a compiler error b. The method parameter and field are the same variables. c. The method returns the area of this circle of radius 15. d. In the area formula, radius takes the parameter value. e. None of the above 49. Data hiding in Java means that a. the fields are static b. the fields cannot be accessed by its method c. the fields cannot be accessed directly from an external code d. a local variable in a method hides an instance field of the same name e. all the above 50. It is common practice in object-oriented programming to a. declare the fields private b. aggregate classes to other classes CS 16000-04 Introduction to Computer Science I 12 Spring Semester 2022 c. design multiclass solutions to programming problems d. create programs that are made of objects which can store data and perform operations e. perform all the above 51. (5 points) Consider public class Rectangle { private static int nosOfInstances Created } public Rectangle() { nosOfInstancesCreated++} public static int getNos Instances Created() { in main method, we have //Number of instance(s) of Rectangle is/are created Rectangle box1; = 0; System.out.print(Rectangle.getNos Instances Created() + "); box1 = new Rectangle(); The output to the console is: return nos Instances Created; } IT System.out.print(Rectangle. getNos InstancesCreated() + Rectangle box2 = new Rectangle(); System.out.print(box2. getNos Instances Created () + "); Rectangle box3; a. 1 2 1 1 2 b. 1 2 3 4 5 C. 0 1 1 0 1 d. 0 1 2 2 3 e. None of the above System.out.print( Rectangle.getNos Instances Created() + "H box3= new Rectangle(); System.out.print( Rectangle.getNos InstancesCreated()); 11 "Li "
Expert Answer:
Related Book For
Holt McDougal Larson Geometry
ISBN: 9780547315171
1st Edition
Authors: Ron Larson, Laurie Boswell, Timothy D. Kanold, Lee Stiff
Posted Date:
Students also viewed these programming questions
-
The strategy-making, strategy-executing process 1 includes establishing a company\'s mission, developing a business model aimed at making the company an industry leader, and crafting a strategy to...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
Raider Company manufactures and sells multiple products. The traditional costing system allocates overhead costs based on direct labor hours, while the company is considering transitioning to an...
-
How would you quantify the following statement: The norm of a vector is small if and only if all its entries are small.
-
The table below lists the number of cellular telephone subscribers (in millions) and subscriber's average local monthly bills for service (in dollars) for the years 1998 through 2008. What type of...
-
A distillation column operating at total reflux is separating acetone and ethanol at \(1.0 \mathrm{~atm}\). The height of packing is \(2.0 \mathrm{~m}\). The column has a partial reboiler and a total...
-
Suppose Lattin Corp.s breakeven point is revenues of $1,500,000. Fixed costs are $720,000. Required 1. Compute the contribution margin percentage. 2. Compute the selling price if variable costs are $...
-
How to develop an entirely new Services Concept using the New Services Development model while ensuring that the service offering retains its uniqueness and is protected from competition.
-
Consider an individual whose preferences are defined over bundles of non-negative amounts of each of two commodities. Suppose that this individual's preferences can be represented by a utility...
-
Banquo adheres to ASPE. Banquo Corp's transactions for the year ended December 31, 20x7 include the following: Purchased land for $237,000 cash. Borrowed $237,000 from the bank on a long-term note....
-
What strategies can leaders employ to cultivate a culture of ethical leadership, emphasizing transparency, accountability, and integrity, amidst ever-evolving regulatory landscapes and ethical...
-
What manner do change interventionists cultivate a culture of continuous learning and adaptive resilience, fostering a growth mindset that embraces failure as an integral component of the change...
-
Find f'(x) using the QUOTIENT RULE if f'(x)=0 Find f'(5). f'(5) = f(x) = 6+22
-
Explain how a manager creates a culture of creativity and innovation that facilitates business success. Be sure to provide specific examples as part of your explanation.
-
How can organizations cultivate a culture of continuous learning and knowledge sharing, and what are the challenges associated with implementing effective knowledge management systems?
-
How many solutions does the system of equations below have? y = 2x + 4 y + 6 = 2x *
-
Huntingdon Capital Corp. is a competitor of Plazacorp and First Capital Realty. Huntingdon reported the following selected information (in millions):...
-
Find the sum of the measures of the interior angles of the indicated convex polygon. 16-gon
-
Name two pairs of congruent angles. K M
-
Use the diagram to determine if the statement is true or false. W Q R J NL M P X
-
Describe or define the following terms: 1. Asset 2. Liability 3. Shareholders equity 4. Revenue 5. Expense Discuss how the five terms relate to one another.
-
Discuss the difference between historical and forecasted (or pro forma) financial statements. How are these different sets of financial statements used by managers and shareholders for...
-
Most balance sheets are defined as classified balance sheets in that both the assets and liabilities are dichotomized into the categories of current and noncurrent. [In those industries in which the...
Study smarter with the SolutionInn App