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
-
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...
-
Simple random sampling was used to obtain a sample of n = 100 elements from a population of N = 1000. The sample proportion was = .30. a. Estimate the population proportion. b. Estimate the standard...
-
As a manager and an entrepreneur, you will face a new challenge - business venture structured on the theory of the firm. You are opening a restaurant in your selected town in the State of NY (please...
-
Match the term with its definition by placing the corresponding letter in the space provided: 1. A written promise to pay a specified amount of money at a particular future date 2. The date when...
-
Sand from a stationary hopper falls onto a moving conveyor belt at the rate of 5.00 kg/s as in Figure P9.72 The conveyor belt is supported by frictionless rollers and moves at a constant speed of...
-
You are a Manager at Hotel. You have recently hired a new Front Desk Agent, Tina. Tina is enthusiastic and an extrovert. She shows high levels of motivation when learning new tasks. She is quickly...
-
The case study shown below provides an overview of Road Transit Systems (RTS) - a specialist preventative vehicle maintenance program operator in NSW, Australia. A number of attributes have been...
-
Find the exact length of the curve. x = y48 + 1 4y2 , 1 ? y ? 2 6. -/1 points Find the exact length of the curve. 1 + 1 y 2 4y, X = 8 Need Help? Read It Talk to a Tutor My Notes Ask Your Teacher
-
ILLUSTRATION MARKET SELECTION AND ENTRY 277 ILLUSTRATION 8.4 Vale - a Brazilian giant in different cultures Rapid overseas expansion brings this Brazilian multinational some contrasting experiences....
-
a) Find the complexity of the following blocks of code or algorithm's description. [Note: your answer must show the steps that lead to your final answer] (3 marks each) 1) The algorithm solves the...
-
The fast-food industry business model is to provide filling food at a low cost. A fast-food restaurant such as McDonald's lacks in quality, so, they make up for in quantity. Each value meal provides...
-
Land costing $15,000.00 was sold for $15,000.00 2- Mortgage note was issued for $40,000.00 3- A building costing $115,000.00 was constructed. 4- 2,500 shares of common stock were issued at $40.00 in...
-
A positron is a particle with the same mass as an electron but the opposite charge ( + e ) . If a positron is accelerated by a constant electric field of magnitude 3 0 1 N / C , find the following. ...
-
3. Linear Independence and Span a) Explain whether the set is linearly independent or dependent by in- spection (i.e. don't calculate anything. The answer should be clear im- mediately) 0006 { b)...
-
Funds are separate fiscal and accounting entities, each with its own self-balancing set of accounts. The newly established Society for Ethical Teachings maintains two funds-a general fund for...
-
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
-
Suggest a general outline marketing planning strategy for 12 months ahead for Graham Keddie.
-
What part should the sales function play when drawing up a detailed 12 months operational marketing plan for EMA?
-
Explain the differences between marketing strategies and sales strategies.
Study smarter with the SolutionInn App