Concept explainers
Which of the following expressions return true?
After writing your answers on paper, open the Code Pad in BlueJ and try it out. Check your answers,
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Additional Engineering Textbook Solutions
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Concepts Of Programming Languages
Starting Out with Java: Early Objects (6th Edition)
Programming in C
Modern Database Management
Problem Solving with C++ (10th Edition)
- Which statement is correct regarding the following JavaScript code?let word1 = "Alpha";let word2 = "Beta"; a. word1.localeCompare(word2)returnstrue b. word1.localeCompare(word2)returnsfalse c. word1.localeCompare(word2) returns -1 d. word1.localeCompare(word2)returns 1arrow_forwardCHALLENGE ACTIVITY 1.10.1: Sphere volume. Given sphereRadius and piVal, compute the volume of a sphere and assign sphereVolume with the result. Use (4.0 / 3.0) to perform floating-point division, instead of (4 / 3) which performs integer division.Volume of sphere = (4.0 / 3.0) π r3 (Hint: r3 can be computed using *)arrow_forwardJAVA Question Which of the following boolean expressions will evaluate to false? Group of answer choices ... ("Green".equals(new String("Green"))) ... ... ("White" == "White") ... String s2 = new String("Blue");... (s2 == "Blue") ... String s1 = "Black";... (s1 == "Black") ...arrow_forward
- Which of the following methods correctly withdraws an amount from a bank account? Method withdraw(Numeric amt) acctBal = acctBal - amt Display "The new balance is: $" + acctBalEnd Method Method withdraw(String amt) acctBal = acctBal - amt Display "The new balance is: $" + acctBalEnd Method Method withdraw(Numeric amount) acctBal = acctBal - amt Display "The new balance is: $" + acctBalEnd Method Method withdraw(String amount) acctBal = acctBal - amt Display "The new balance is: $" + acctBalEnd Methodarrow_forwardThe following solidity code segment aim to select a winner at random from the a set of players (assume num_player is the number of players). Explain what is the vulnerability of this method. contract Game { uint winner_ID; uint num_player; function guessing() external{ winner_ID = uint256(block.blockhash(block.number - 1)) % num_player; } }arrow_forward. What will be the value of EAX and the Sign flag after the following lines execute?mov eax,5sub eax,6arrow_forward
- Which of the following string methods is a mutator? Choice 1 of 5:.replaceChoice 2 of 5:.upperChoice 3 of 5:All of the aboveChoice 4 of 5:None of the aboveChoice 5 of 5:.striparrow_forwardAfter the following code is executed, which of I, II and/or III will evaluate to true? int [] a1 = {2,3,4,5,6,7,8};int [] a2 = a1;a2[0] = 10; I. a1[0] == 10 II. a2[0] == 10 III. a1[0] == 2 Group of answer choices III only I only I, II, III II and III I and IIarrow_forwardWhat is the result of the following expression: 96 Mod 30? 3 3.2 6 None of the above.arrow_forward
- What is the output of the following code segment?inte=5,f=10;if(eff0)Write(Purple) inte=5,f=10;if(eff0)Write(Purple) else Write(Gold); Purple Gold PurpleGold nothingarrow_forwardWhich values are marked for deallocation after the sequence? Integerobj1=newInteger(10);Integerobj2=newInteger(20);Integerobj3=obj2;Integerobj4=newInteger(40);obj2=null;obj4=obj1; only 20 only 40 20 and 40 no values are marked for deallocation Which expressions for XXX, YYY, and ZZZ output "Great job" for scores above 90, and "Nice try" otherwise? Choices are in the form XXX / YYY / ZZZ. intscore;score=scnr.nextInt();if(XXX){System.out.println(YYY);}else{System.out.println(ZZZ);} score < 91 / "Great job" / "Nice try" score < 91 / "Nice try" / "Great job" score > 90 / "Nice try" / "Great job" (Not possible for given code) The program should determine the largest integer seen. What should XXX be if the input values are any integers (negative and non-negative)? All variables are integers and have…arrow_forwardThis method plays 24 rounds of rps and returns the total points earned. For each of the 24 rounds, player1’s hand gesture will be based on calling the nextInt method of the given Random object. If the next integer is even, player1 will play rock. If it is odd, player1 will play paper. Player1 never plays scissors. Player2 will play rock in the first round, paper in the second round, scissors in the third round, and repeat the cycle starting with rock again in the fourth round. The method will sum the return values for the 24 calls to rps and return the total. Note, since an invalid input is never passed in to an rps call using playRps, your return value should always be a non-negative number.arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning