E Consider the following code: public void test (int x) { int y; if (x %...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
E Consider the following code: public void test (int x) { int y; if (x % 2 == 0) y = 3; else if (x>9) y = 5; else y = 1; System.out.println("y"+y); } Which of the following test data sets would test each possible output for the method? a.) 7,8,9 d.) 8,9,11 b.) 7, 9, 10 e.) 8, 11, 13 c.) 7, 9, 11 E Consider the following code: public void test (int x) { int y; if (x % 2 == 0) y = 3; else if (x>9) y = 5; else y = 1; System.out.println("y"+y); } Which of the following test data sets would test each possible output for the method? a.) 7,8,9 d.) 8,9,11 b.) 7, 9, 10 e.) 8, 11, 13 c.) 7, 9, 11
Expert Answer:
Answer rating: 100% (QA)
Answer There is mainly 3 conditions for generating the output 1if x 2 0 y3 2else if x 9 y5 3 else y1 ... View the full answer
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these electrical engineering questions
-
Consider the following code fragment, taken from some package:
-
Consider the following code: For (i = 0; i < 20; i++) For (j = 0; j < 10; j++) A[i] = a [i] * j a. Give one example of the spatial locality in the code. b. Give one example of the temporal locality...
-
Consider the following code fragment: if K > 10 L: = K + 1 else L: = K - 1; A straightforward translation of this statement into SPARC assembler could take the following form: The code contains a nop...
-
In a task assignment situation, in how many different ways can five jobs be assigned to five machines if each job must be assigned to each machine and each machine must be assigned one job? Multiple...
-
What is an audit trail? Of what use is it in the audit process?
-
Replacement of a machine, income taxes, sensitivity. (CMA, adapted) The Smacker Company is a family-owned business that produces fruit jam. The company has a grinding machine that has been in use for...
-
Five projects form the mutually exclusive, collectively exhaustive set under consideration. The cash flow profiles for the five projects are given in the table below. Information on each project was...
-
Law Publishing Inc. began printing operations on January 1. Jobs 401 and 402 were completed during the month, and all costs applicable to them were recorded on the related cost sheets. Jobs 403 and...
-
(5) A small maintenance project consists of the following jobs whose precedence relationships are given below: Job 1-2 1-3 2-3 2-5 3-4 Immediate Predecessor 15 15 3 5 8 8 Activity 3-6 4-5 4-6 5-6 6-7...
-
Prepare a financial analysis. This takes a close look at two corporations, Bayer and Monsanto. Bayer is considering a bid for United States seed company Monsanto (Snider, 2016). For purposes of this...
-
2. (2D Momentum) Ball 1 with mass m = 1kg and speed w = 5 m/s elastically collides with a stationary, identical ball 2 (resting on a frictionless surface). Ball 2 emerges from the collision at an...
-
1.What determines stock market valuations? 2. Is a stock's price primarily determined by the discounted sum of future cash flows, monetary policy, or fear and greed? 3. Is market timing possible...
-
Describe the principles of type theory in programming language design, including concepts like parametric polymorphism, type inference, and dependent types, and discuss how they contribute to type...
-
1. Applying the Components of Natural Law: Define one or more ways that IVF has changed family structure. Family structure used to be mom, dad and children in the same holdhold. In you opinion is th...
-
What is a family? Who gets to be a family? Who gets to be married? Who can adopt children? Who gets custody of the children after a divorce? It seems that the answers to these questions are...
-
Discuss the evolution of real-time operating systems (RTOS) and their application in mission-critical systems such as embedded devices, aerospace systems, and industrial automation, emphasizing the...
-
An electric heater is connected to the 230 V mains supply. A current of 8 A flows through the heater. (a) How much charge flows around the circuit each second ? (b) How much energy is transferred to...
-
A bar of length = 1 has one fixed and one free end and stiffness function c(x) = 1 - x. Find the displacement when subjected to a unit force. Pay careful attention to the boundary condition at the...
-
Extend a solution to the previous problem so that users are allowed to update the prices for their buy or sell orders that have yet to be processed.
-
Suppose that we create an array A of GameEntry objects, which has an integer scores field, and we clone A and store the result in an array B. If we then immediately set A[4].score equal to 550, what...
-
Can edge list E be omitted from the adjacency list representation while still achieving the time bounds given in Table 14.3? Why or why not? Method numVertices(), numEdges() vertices() edges()...
-
Bethany, who weighs 560 N, lies in a hammock suspended by ropes tied to two trees. One rope makes an angle of 45 with the ground; the other makes an angle of 30. Find the tension in each of the ropes.
-
In the Skycoaster amusement park ride, riders are suspended from a tower by a long cable. A second cable then lifts them until they reach the starting position indicated in Figure P5.3. The lifting...
-
In the winter sport of curling, two teams alternate sliding 20 kg stones on an icy surface in an attempt to end up with the stone closest to the center of a target painted on the ice. During one...
Study smarter with the SolutionInn App