Tag Archives: 1z1808

Given the code fragment: (Exhibit) And given the requirements: 1. Process all the elements of the array

Given the code fragment:And given the requirements:1. Process all the elements of the array in the reverse order of entry.2. Process all the elements of the array in the order of entry.3. Process alternating elements of the array in the order of entry.Which two statements are true? (Choose two.) A. Requirement 2 can be implemented by using the… Read More »

Given the code fragment: String name = "Spot"; int age = 4; String str ="My dog " + name + " is " + age;

Given the code fragment:String name = “Spot”;int age = 4;String str =”My dog ” + name + ” is ” + age;System.out.println(str);AndStringBuilder sb = new StringBuilder();Using StringBuilder, which code fragment is the best potion to build and print the followingstring My dog Spot is 4 A. sb.append(“My dog “).append( name ).append(” is ” ).append(age); System.out.println(sb); B. sb.insert(“My dog… Read More »

Given the code fragment: System.out.println(2 + 4 * 9 – 3); //Line 21 System.out.println((2 + 4) * 9

Given the code fragment:System.out.println(2 + 4 * 9 – 3); //Line 21 System.out.println((2 + 4) * 9 – 3); // Line 22 System.out.println(2 + (4 * 9) – 3); // Line 23 System.out.println(2 + 4 * (9 – 3)); // Line 24 System.out.println((2 + 4 * 9) – 3); // Line 25Which line of codes prints the highest… Read More »