Which of the following code segments produces the output “987654321” ?
Blog
What does String substring(int from, int to) return?
What does String substring(int from, int to) return?
Which statement generates random numbers in the range from 0…
Which statement generates random numbers in the range from 0 through 100?
Consider the following code segment. int start = 3;int end =…
Consider the following code segment. int start = 3;int end = 6;boolean keepGoing = true;if (start < end && keepGoing){if (end > 0){start += 3;end++;}else{end += 4;}}if (start < end){if (end == 0){end += 2;start++;}else{end += 3;}} What is the value of end after the code segment is executed?
The following code segment appears in a method. In the code…
The following code segment appears in a method. In the code segment, num1 and num2 are int variables. The method is intended to print the sum of num1 and num2. int result = num1 + num2;System.out.println(result); Which of the following preconditions for the method is most appropriate to avoid an overflow error?
The Person class has exactly two constructors. Partial decla…
The Person class has exactly two constructors. Partial declarations of the constructors are shown. public Person(int idNumber, boolean isActive){ /* implementation not shown */ } public Person(int idNumber, int age, boolean isActive){ /* implementation not shown */ } Which of the following statements does not correctly create an object of type Person?
A code segment will use variables to represent a student’s a…
A code segment will use variables to represent a student’s age, in years, and whether the student has a driver’s license. Which of the following variable declarations are most appropriate for the code segment?
Consider the following code segment. Throughout the fourth…
Consider the following code segment. Throughout the fourth block of code are nested blocks of code. Line 1: [begin block] a ← true [end block] Line 2: [begin block] b ← false [end block] Line 3: [begin block] c ← true [end block] [Begin Block] Line 4: REPEAT UNTIL [begin block] a and b [end block] [Begin Block] Line 5: [begin block] c ← NOT c [end block] Line 6: [begin block] b ← c [end block] [End Block] [End Block] Line 7: [begin block] DISPLAY [begin block] a [end block] [end block] Line 8: [begin block] DISPLAY [begin block] b [end block] [end block] Line 9: [begin block] DISPLAY [begin block] c [end block] [end block] What is displayed as a result of executing the code segment?
For which of the following lists can a binary search be used…
For which of the following lists can a binary search be used to search for an item in the list? I. [“blue”, “green”, “jade”, “mauve”, “pink”] II. [5,5,5,5,6,7,8,8,8] III. [10,5,3,2,-4,-8,-9,-12]
An Internet user has a need to send private data to another…
An Internet user has a need to send private data to another user. Which of the following provides the most security when transmitting private data?