Features of a good testbench include: Messages for all tests that pass At least 90% code...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Features of a good testbench include: Messages for all tests that pass At least 90% code coverage Border cases and extreme values Test cases for all possible values Which XXX is the proper default constructor? public class Employee { private double mySalary; XXX public Employee(double salary) { mySalary = salary;} public Employee() { mySalary = 10000;} public Employee() { double mySalary = 10000;} private Employee() { mySalary = 10000;} Given a programmer-defined class called Person, what is output? Person barb = new Person (18); Person jessie = new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; } The memory location of barb 18 21 Error: null pointer exception Person barb = new Person (18); Person jessie new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; } The memory location of barb 18 21 Error: null pointer exception Given a programmer-defined class called Person, what is output? Person barb = new Person (18); Person jessie: = new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; The memory location of barb 18 21 Error: null pointer exception means to have a user interact with an item at a high-level. Data encapsulation Information hiding User interaction design Abstraction How many objects of type Car are created? Car mustang = new Car(); Car prius; int miles; Truck tundra = new Truck(); 0 1 2 3 The following program generates an error. Why? final int NUM ELEMENTS 5; int[] userVals = new int [NUM_ELEMENTS]; int i; uservals [0] 1; uservals [1] = 7; = uservals [2] = 4; = } = for (i = 0; i <= userVals.length; ++i) { System.out.println (uservals [i]); Variable i is never initialized. The array userVals has 5 elements, but only 3 have values assigned. The integer NUM_ELEMENTS is declared as a constant The for loop tries to access an index that is out of the array's valid range. A static field___ is also called an instance variable is initialized in the constructor has global scope is accessed using an object name such as objectName.fieldName API is short for ______ Automated Program Instructions Applied Programming Implementation Authoring Program Instructions Application Programming Interface What is output? Item jar new Item(); Item ball = new Item(); System.out.println (Item.count); public class Item { public static int count public Item() { } 1 2 3 I count++; Error: syntax error = 1; Which is true? Garbage collection makes programs run faster Deallocated objects can be reclaimed by a programmer Garbage collection is managed automatically by the Java virtual machine An object is deallocated when its reference count decrements to one Which XXX method signature returns the student's GPA? public class Student { private double myGPA; private int myID; XXX } return myGPA; private double getGPA() public double getGPA() public int getGPA() double getGPA() The enhanced for loop__ reduces the number of iterations necessary to visit all elements of an array can be used to replace any regular for loop while yielding less code creates a copy of an existing array and iterates through the copy's elements prevents incorrectly accessing elements outside of an array's range } Which XXX method signature returns the student's GPA? public class Student { private double myGPA; private int myID; XXX } return myGPA; private double getGPA() Opublic double getGPA() public int getGPA() Features of a good testbench include: Messages for all tests that pass At least 90% code coverage Border cases and extreme values Test cases for all possible values Which XXX is the proper default constructor? public class Employee { private double mySalary; XXX public Employee(double salary) { mySalary = salary;} public Employee() { mySalary = 10000;} public Employee() { double mySalary = 10000;} private Employee() { mySalary = 10000;} Given a programmer-defined class called Person, what is output? Person barb = new Person (18); Person jessie = new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; } The memory location of barb 18 21 Error: null pointer exception Person barb = new Person (18); Person jessie new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; } The memory location of barb 18 21 Error: null pointer exception Given a programmer-defined class called Person, what is output? Person barb = new Person (18); Person jessie: = new Person (21); change (barb, jessie); System.out.println (barb.getAge()); public static void change (Person pl, Person p2) { pl = p2; The memory location of barb 18 21 Error: null pointer exception means to have a user interact with an item at a high-level. Data encapsulation Information hiding User interaction design Abstraction How many objects of type Car are created? Car mustang = new Car(); Car prius; int miles; Truck tundra = new Truck(); 0 1 2 3 The following program generates an error. Why? final int NUM ELEMENTS 5; int[] userVals = new int [NUM_ELEMENTS]; int i; uservals [0] 1; uservals [1] = 7; = uservals [2] = 4; = } = for (i = 0; i <= userVals.length; ++i) { System.out.println (uservals [i]); Variable i is never initialized. The array userVals has 5 elements, but only 3 have values assigned. The integer NUM_ELEMENTS is declared as a constant The for loop tries to access an index that is out of the array's valid range. A static field___ is also called an instance variable is initialized in the constructor has global scope is accessed using an object name such as objectName.fieldName API is short for ______ Automated Program Instructions Applied Programming Implementation Authoring Program Instructions Application Programming Interface What is output? Item jar new Item(); Item ball = new Item(); System.out.println (Item.count); public class Item { public static int count public Item() { } 1 2 3 I count++; Error: syntax error = 1; Which is true? Garbage collection makes programs run faster Deallocated objects can be reclaimed by a programmer Garbage collection is managed automatically by the Java virtual machine An object is deallocated when its reference count decrements to one Which XXX method signature returns the student's GPA? public class Student { private double myGPA; private int myID; XXX } return myGPA; private double getGPA() public double getGPA() public int getGPA() double getGPA() The enhanced for loop__ reduces the number of iterations necessary to visit all elements of an array can be used to replace any regular for loop while yielding less code creates a copy of an existing array and iterates through the copy's elements prevents incorrectly accessing elements outside of an array's range } Which XXX method signature returns the student's GPA? public class Student { private double myGPA; private int myID; XXX } return myGPA; private double getGPA() Opublic double getGPA() public int getGPA()
Expert Answer:
Answer rating: 100% (QA)
The detailed answer for the above question is provided below Solutions 1 Answer 1 Border cases and extreme values Explanation A good testbench should ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Draw a standard normal probability function and show the area under the curve for (a) Plus or minus one standard deviation from the mean (b) Plus or minus two standard deviations from the mean (c)...
-
What is the decision at a .05 level of significance for each of the following tests? Hint: Find the critical value for each test; then make a decision. (a) F(3, 26) = 3.00 (b) F(5, 20) = 2.54 (c)...
-
Find the equation of the least-squares line for the given data. Graph the line and data points on the same graph. X y 1 3 65 8 10 15 12 10 8 9 4 7 38 2 11 9 11 7
-
List three ways to get input from the console and convert that input to the desired data type.
-
Cost Behavior and Cost-Volume-Profit Analysis for Many Glacier Hotel The purpose of this integrated exercise is to demonstrate the interrelationship between cost estimation techniques and subsequent...
-
Xavier is working on an effort to gain support for legislation that would increase payroll taxes on the wealthier residents of his state. These taxes would fund an expansion of subsidized day care...
-
As the Deputy Minister for Education, discuss four (4) programs that you will put in place to ensure that the gender gap in Science, Technology, Engineering and Mathematics (STEM) is bridged. Write...
-
A rectangular gate separating two liquids is hinged as shown in the figure below. A) Find the ratio h/H for the gate to remain stationary. B) If H=4m, h= 1m, and a=30, Find the forces due to the two...
-
When trying to determine the maximum magnetic field created by a 18-turn circular coil, you measure the maximum current to be 0.50.05 A, and the radius of your coil to be 0.05 0.003 m. If these are...
-
Meghan reads of her book in 1 hours. Meghan continues to read at this pace. How long does it take Meghan to read of the book? Nest form by fil
-
A multipurpose transformer has a secondary coil with several points at which a voltage can be extracted, giving outputs of 6.00, 10.5, and 24 V. The input voltage is 115 V to a primary coil of 240...
-
Which of the following statements is NOT correct regarding global marketing? A . Global companies often form strategic alliances with other companies around the world. B . Global marketing is the...
-
Give the IUPAC of the ff H3C CH2-CH2-CH3 CH-CH-CH2-CH3 H3C-CH H3
-
a. Show that the expansion of q(x) in ascending powers of x can be approximated to 10 2x + Bx 2 + Cx 3 where B and C are constants to be found. b. Find the percentage error made in using the series...
-
Describe the main non-statistical sampling methods. What are the advantages of non-statistical sampling?
-
What is the purpose of an engagement letter? Are all engagement letters the same?
-
Search.com is an Internet-based dating agency. Its business model is that anyone can search its website and review for free the profiles of people looking for friends or partners, but if anyone wants...
-
An engine working on the constant volume (Otto) cycle has a compression ratio of 6.5 to 1 , and the compression follows the law \(p V^{1.3}=\mathrm{C}\), the initial pressure and temperature being 1...
-
The exhaust gases of a compression-ignition engine are to be used to drive an exhaust gas turbo-supercharger. Estimate the mean pressure ratio of expansion and the isentropic enthalpy drop per kmol...
-
(a) An amount of substance equal to 2 kmols of an ideal gas at temperature \(T\) and pressure \(p\) is contained in a compartment. In an adjacent compartment is an amount of substance equal to \(1...
Study smarter with the SolutionInn App