5) If a method does not have a return statement, then A) it will produce a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
5) If a method does not have a return statement, then A) it will produce a syntax error when compiled B) it must be a void method C) it cannot be called from outside the class that defined the method D) it must be defined to be a public method E) it must be an int, double, float or String method 6) A variable whose scope is restricted to the method where it was declared is known as a(n) A) parameter B) global variable C) local variable D) public instance data E) private instance data 31 7) A class' constructor usually defines A) how an object is initialized B) how an object is interfaced C) the number of instance data in the class D) the number of methods in the class E) if the instance data are accessible outside of the object directly 8) Instance data for a Java class A) are limited to primitive types (e.g., int, float, char) B) are limited to Strings C) are limited to objects(e.g., Strings, classes defined by other programmers) D) may be primitive types or objects, but objects must be defined to be private E) may be primitive types or objects public class Student } private String name; private String major; private double gpa; private int credits; public Student (String n, String m, double g, int c) name = n; major = m; gpa = g; credits = c; } public String toString() return name + "\n" + major + "\n" + gpa + "\n" + credits 9) Which of the following could be used to instantiate a new Student sl? A) Student s1= new Student (); B) s1= new Student (); C) Student s1= new Student ("Jane", "cs", 3.333, 33); D) new Student s1 = ("Jane", "CS", 3.333, 33); E) new Student (s1); 10) Assume that another method has been defined that will compute and return the student's class rank (Freshman, Sophomore, etc). It is defined as: public String getClassRank () Given that s1 is a student, which of the following would properly be used to get sl's class rank? 5) If a method does not have a return statement, then A) it will produce a syntax error when compiled B) it must be a void method C) it cannot be called from outside the class that defined the method D) it must be defined to be a public method E) it must be an int, double, float or String method 6) A variable whose scope is restricted to the method where it was declared is known as a(n) A) parameter B) global variable C) local variable D) public instance data E) private instance data 31 7) A class' constructor usually defines A) how an object is initialized B) how an object is interfaced C) the number of instance data in the class D) the number of methods in the class E) if the instance data are accessible outside of the object directly 8) Instance data for a Java class A) are limited to primitive types (e.g., int, float, char) B) are limited to Strings C) are limited to objects(e.g., Strings, classes defined by other programmers) D) may be primitive types or objects, but objects must be defined to be private E) may be primitive types or objects public class Student } private String name; private String major; private double gpa; private int credits; public Student (String n, String m, double g, int c) name = n; major = m; gpa = g; credits = c; } public String toString() return name + "\n" + major + "\n" + gpa + "\n" + credits 9) Which of the following could be used to instantiate a new Student sl? A) Student s1= new Student (); B) s1= new Student (); C) Student s1= new Student ("Jane", "cs", 3.333, 33); D) new Student s1 = ("Jane", "CS", 3.333, 33); E) new Student (s1); 10) Assume that another method has been defined that will compute and return the student's class rank (Freshman, Sophomore, etc). It is defined as: public String getClassRank () Given that s1 is a student, which of the following would properly be used to get sl's class rank?
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below Answer 5 It must be a void method A void method is a method that does not have a return s... View the full answer
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date:
Students also viewed these programming questions
-
14. The basis for recording direct and indirect labor costs incurred is a summary of the period's: a. job order cost sheets b. time tickets employees' earnings records C. d. clock cards 15. At the...
-
Cabana Cruise Line offers cruise ship service to various tropical locations throughout the globe. The company is considering the addition of a new cruise ship to its fleet in order to expand service...
-
Please help with question a-d. Thank you. a.)How many orbitals are there in the 4s subshell? b.)How many orbitals are there in the 4p subshell? c.)What is the maximum number of electrons that can be...
-
Assume that a security is selling at INR 217 and American call and American put options are available on the stock with 3 months maturity and an exercise price of INR 210. The call is selling at INR...
-
1. Design a switchboard that includes the main information management functions that Mountain High might need. Create a storyboard with a design layout that allows customers to perform the following...
-
Use the following wordy instructions to compose a concise bulleted vertical list with an introductory statement: To write information for a Web site, there are three important tips to follow. For one...
-
In 1988, the Upper Deck Company was a company with an idea for a better baseball card: one that had a hologram on it. By the 1990s, the firm was a major corporation worth at least a quarter of a...
-
Tsang, Inc., is considering the sale of two bond issues. Choice A is a $1,600,000 bond issue that pays semiannual interest of $128,000 and is due in 20 years. Choice B is a $1,600,000 bond issue that...
-
Why do economists bother to calculate real GDP? Why can't economists just be satisfied with comparing nominal GDP from one year to the next?
-
The following table displays the weights for computing the principal components and the data for two observations. Weight PC1 PC2 x1 -0.84 0.43 x2 -0.41 -0.83 x1 x2 Observation 1 5.30 345.70...
-
Pedro Co purchased a bond investment in Juan Company. The following are the data pertaining to Pedro's Investments in Debt Security. Date of purchase: Purchase price: Principal amount: Cash interest:...
-
If we know a projects IRR is 11%, and provides annual cash-flows of $15,000 for six years, how much is the maximum that the project could have cost assuming the investors are rational decision makers...
-
Company DELTA uses perpetual inventory method and its weighted-average method. The company commenced operations on January 1, 2018, and purchased 400 units of inventory, with each unit costing $ 7.5....
-
The annual earnings of a rental apartment are expected to be $12,000 and the cost of the apartment is $175,000. What is the expected rate of return on this investment? Would you invest in this...
-
Negative resistance aims at ensuring the complete failure of change initiatives of the organization. Why?
-
Identify a specific type of intervention. Explain why you chose that type of intervention. Describe the tools and activities selected to facilitate the interaction. Explain how you will use the tools...
-
(a) The function u satisfies V2u = 0 in the volume V and u = 0 on S, the surface bounding V. Show that u = 0 everywhere in V. The function u satisfies V = 0 in V and v is specified on S. Show that...
-
A copper rod of length L =18.0 in is to be twisted by torques T (see figure) until the angle of rotation between the ends of the rod is 3.08. (a) If the allowable shear strain in the copper is 0.0006...
-
A university faced with a deficit reacts by cutting resource allocations to all faculties and departments by 8%. Do you think this is a good approach to budgeting? Why or why not?
-
Manufacturing support cost driver rates (Adapted from CMA, December 1990) Moss Manufacturing has just completed a major change in its quality control (QC) process. Previously, products had been...
-
Of the four quality costing categories, which quality cost is the most damaging to the organization? Explain
-
The following are the financial statements for Nailsea plc for the years ended 30 June 2020 and 2021 There were no disposals of non-current assets in either year. Dividends were paid in 2020 and 2021...
-
The statements of financial position of Axis plc as at 31 December 2020 and 2021 and the income statement for the year ended 31 December 2021 were as follows: 1 During the year, plant (a non-current...
-
Consider the following: 1 A motor car manufacturer offers a three-year warranty on all cars that it produces. The warranty undertakes to make good any defects arising from the manufacturing process....
Study smarter with the SolutionInn App