subject

U3L6 CSA Extra PracticeQuestion: What is the output of the following code segment?1String[ ] paintColors = {"blue", "green", "purple"};2for (String color : paintColors) {3color = "light " + color;4}5for (String color : paintColors) {6System. out. print(color + " ");7}A. blue green purpleB. light light lightC. light blue light green light purpleD. The code will not compile. Response:AP Exam Prep +3Question: Consider the following method.1for (int j = 0; j < numbers. length; j++) {2numbers[j]++;3}True or False: The following code segment can be used to replace the for loop so that numbers will contain the same values?.1for (int num: numbers) {2num++;3}Response: true becuase the output will be the numbers in the indexExtra Practice +15Do This: For each of the following prompts, explain which type of loop -- while, for, or enhanced for loop -- should be used to solve the problem. After, write a solution in Java using the selected loop. Prompt #1: Given an array of integers called nums, print every other element of the array. Prompt #2: Given an array of Strings called paintColors, paint a line in the direction that a Painter picasso is facing until it reaches a barrier. Paint the line in the color stored as the second element of paintColors. Prompt #3: Given an array of Strings called playlist, print every element of the array.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:10
1. package newton’s method for approximating square roots (case study 3.6) in a function named newton. this function expects the input number as an argument and returns the estimate of its square root. the script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key. 2. convert newton’s method for approximating square roots in project 1 to a recursive function named newton. (hint: the estimate of the square root should be passed as a second argument to the function.) 3. elena complains that the recursive newton function in project 2 includes an extra argument for the estimate. the function’s users should not have to provide this value, which is always the same, when they call this function. modify the definition of the function so that it uses a keyword parameter with the appropriate default value for this argument, and call the function without a second argument to demonstrate that it solves this problem. 4. restructure newton’s method (case study 3.6) by decomposing it into three cooperating functions. the newton function can use either the recursive strategy of project 1 or the iterative strategy of case study 3.6. the task of testing for the limit is assigned to a function named limitreached, whereas the task of computing a new approximation is assigned to a function named improveestimate. each function expects the relevant arguments and returns an appropriate value. 5. a list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor. define a predicate issorted that expects a list as an argument and returns true if the list is sorted, or returns false otherwise. (hint: for a list of length 2 or greater, loop through the list and compare pairs of items, from left to right, and return false if the first item in a pair is greater.)
Answers: 1
question
Computers and Technology, 22.06.2019 16:30
Primary tech skills are skills that are necessary for success in online education
Answers: 3
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 23.06.2019 18:50
What is transmission control protocol/internet protocol (tcp/ip)? software that prevents direct communication between a sending and receiving computer and is used to monitor packets for security reasons a standard that specifies the format of data as well as the rules to be followed during transmission a simple network protocol that allows the transfer of files between two computers on the internet a standard internet protocol that provides the technical foundation for the public internet as well as for large numbers of private networks
Answers: 2
You know the right answer?
U3L6 CSA Extra PracticeQuestion: What is the output of the following code segment?1String[ ] paintCo...
Questions
question
Arts, 24.06.2019 11:40
Questions on the website: 13722363