Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 23 Given the following code, convert the if-else statement to a single assignment statement using a conditional expression. if (x > 30) {
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started