Question 23 Given the following code, convert the if-else statement to a single assignment statement using...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 23 Given the following code, convert the if-else statement to a single assignment statement using a conditional expression. if (x > 30) { y = 20; } else { } y = x; Oy=x? 20: (x > 30); O y = (x > 30) ? 20; 2.5 pts O y = (x > 30) ? 20 : x; O y = 20 ? (x > 30) : x; Question 24 A package frame object module is a group of related classes. 2.5 pts Question 25 If the value of the int variable named totalDogs is 18, what is the value of total after this statement is executed? int total = --totalDogs; O O 19 20 17 2.5 pts 18 Question 26 This programming phase is where the programmer defines the problem and identifies what the solution must do. This is also the phase where a general solution is designed and the programmer verifies that the solution really does solve the problem. Implementation Phase Maintenance Phase Verification Phase 2.5 pts Problem-Solving Phase Question 27 What is the output of the statement. Assume that balance is 585.00 and account is 99988. System.out.println("The account " + account + " has the following balance: $" + balance); The account 585.00 has the following balance: $999.88. The account 99988 has the following balance: $balance. The account account has the following balance: $balance. The account 99988 has the following balance: $585.00. 2.5 pts Question 28 Suppose you write a program for computing the perimeter of a rectangle and you mistakenly write your program so that it compiles the area of a rectangle. What kind of error is this? Runtime Error Compiler Error Logic Error 2.5 pts Syntax Error Question 29 The following code segment correctly tests for equality: String month = "November"; if (month.equals("November")) { System.out.println("The month is November."); } True False 2.5 pts Question 30 A a keyboard. Scanner System.out Print Method 2.5 pts is a text parser that can get numbers, words, or phrases from an input source such as Question 31 Suppose the following strings are declared as follows: String tvShow1 = "American Idol"; String tvShow2 = "Family Feud"; What is the results of the following expressions? tvShow2.lastIndexOf('F' ); O C O O 5 8 07 2.5 pts Question 32 A compiler generates the following error messages: Line 4: maxValue not defined Line 9: Missing semicolon Line 12: Expected '(' Which line of code should the programmer fix FIRST? C 9 4 12 It doesn't matter. 2.5 pts Question 23 Given the following code, convert the if-else statement to a single assignment statement using a conditional expression. if (x > 30) { y = 20; } else { } y = x; Oy=x? 20: (x > 30); O y = (x > 30) ? 20; 2.5 pts O y = (x > 30) ? 20 : x; O y = 20 ? (x > 30) : x; Question 24 A package frame object module is a group of related classes. 2.5 pts Question 25 If the value of the int variable named totalDogs is 18, what is the value of total after this statement is executed? int total = --totalDogs; O O 19 20 17 2.5 pts 18 Question 26 This programming phase is where the programmer defines the problem and identifies what the solution must do. This is also the phase where a general solution is designed and the programmer verifies that the solution really does solve the problem. Implementation Phase Maintenance Phase Verification Phase 2.5 pts Problem-Solving Phase Question 27 What is the output of the statement. Assume that balance is 585.00 and account is 99988. System.out.println("The account " + account + " has the following balance: $" + balance); The account 585.00 has the following balance: $999.88. The account 99988 has the following balance: $balance. The account account has the following balance: $balance. The account 99988 has the following balance: $585.00. 2.5 pts Question 28 Suppose you write a program for computing the perimeter of a rectangle and you mistakenly write your program so that it compiles the area of a rectangle. What kind of error is this? Runtime Error Compiler Error Logic Error 2.5 pts Syntax Error Question 29 The following code segment correctly tests for equality: String month = "November"; if (month.equals("November")) { System.out.println("The month is November."); } True False 2.5 pts Question 30 A a keyboard. Scanner System.out Print Method 2.5 pts is a text parser that can get numbers, words, or phrases from an input source such as Question 31 Suppose the following strings are declared as follows: String tvShow1 = "American Idol"; String tvShow2 = "Family Feud"; What is the results of the following expressions? tvShow2.lastIndexOf('F' ); O C O O 5 8 07 2.5 pts Question 32 A compiler generates the following error messages: Line 4: maxValue not defined Line 9: Missing semicolon Line 12: Expected '(' Which line of code should the programmer fix FIRST? C 9 4 12 It doesn't matter. 2.5 pts
Expert Answer:
Related Book For
Java How To Program Early Objects
ISBN: 9780134743356
11th Edition
Authors: Paul Deitel, Harvey Deitel
Posted Date:
Students also viewed these programming questions
-
answer all questions as instructed below. make sure you have attended all questions .Comparative Architectures (a) Describe the organisation of a two-level branch predictor that makes use of a global...
-
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...
-
1. What velocity will a 300 kg snowmobile acquire if pushed from rest by a force of 6240 N [E] for 1.25 s? What average force will stop this snowmobile from moving at this speed in 1.25 s? (v = 26.0...
-
Circle-Square, Ltd., is in the process of liquidating and going out of business. The firm's balance sheet shows $45,600 in cash, accounts receivable of $228,400, inventory totaling $122,800, plant...
-
HEALTHY FISH LTD Healthy Fish Ltd. insures against accidents of its motor fleet. The fleet consists of highly specialised, imported refrigerator trucks. Contributing factors to the high number of...
-
Requirements: 1. Compute Vision Equipments (a) quick ratio and (b) accounts receivable turnover for 2010. 2. Evaluate each ratio value as strong or weak. Assume Vision Equipment sells on terms of net...
-
Johnson Company has budgeted purchases of merchandise inventory of $456,250 in January and $531,250 in February. Assume Johnson pays for inventory purchases 70% in the month of purchase and 30% in...
-
[The following information applies to the questions displayed below.] Project Y requires a $343,500 investment for new machinery with a four-year life and no salvage value. The project yields the...
-
Beth R. Jordan lives at 2322 Skyview Road, Mesa, AZ 85201. She is a tax accountant with Mesa Manufacturing Company, 1203 Western Avenue, Mesa, AZ 85201 (employer identification number 11-1111111)....
-
How much must Rashad invest today to have $15,000 in 8 years assuming 12% interest compounded annually? $11.520.00 $10,000.00 $6,060.00 $19,531.25
-
Show the inference of Z using the knowledge based and the initial database using forward chaining. Show intermediate steps. Knowledge Base Y & D -> Z X & B & E ->Y A -> X C -> L L & M -> N 2 Database...
-
3. What entry will Adcock Brick Company make to pay off the note and interest at maturity assuming that interest has been accrued to September 30? a. Notes Payable....... 212,000 Cash....... b. Notes...
-
Discuss the challenges and opportunities associated with the implementation of advanced performance-based design (PBD) methodologies, considering factors such as serviceability, resilience, and...
-
Amy purchases equipment for $ 3 2 5 , 0 0 0 on January 1 , 2 0 2 4 . The equipment is expected to have a five - year life, with a residual value of $ 1 0 , 0 0 0 at the end of five years. Amy uses...
-
Acquiring versus Not Acquiring Alliance Partners As noted earlier, alliance partners with a high degree of network centrality benefit from being centrally located in a network of players. One debate...
-
3. Where are your BIOS settings stored? QRAM CMOS chip Flash drive Hard drive
-
"Standard-cost procedures are particularly applicable to process-costing situations." Do you agree? Why?
-
Describe in general how youd remove any continue statement from a loop in a program and replace it with some structured equivalent. Use the technique you develop here to remove the continue statement...
-
Write a lambda or method reference for each of the following tasks: a) Write a lambda that can that can be passed to a method with an IntConsumer parameter. The lambda should display its argument...
-
Explain the notion of package access in Java. Explain the negative aspects of package access.
-
Ten students are chosen from a statistics class of 25 students. Let X be the number who got an A in the class. In Exercises 1116, determine whether the random variable X has a binomial distribution....
-
In a college with 5000 students, 100 are randomly chosen to complete a survey in which they rate the quality of the cafeteria food. Let X be the number of freshmen who are chosen. Does X have a...
-
= 0.1, t = 10, P(2) In Exercises 918, determine the indicated probability for a Poisson random variable with the given values of and t.
Study smarter with the SolutionInn App