Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.What should be your last resort when you want to find out what methods are pro

ID: 3649370 • Letter: 1

Question

1.What should be your last resort when you want to find out what methods are provided by an object?

Select one:
a. Find and ask a TA
b. Consult the Java API documentation
c. Use Eclipse intellisense

2.Suppose a Scanner contains n lines, and each line consists of a name and a birthdate. You want to find the name of the oldest person. What type of loop should you write?

Select one:
a. Optimization loop
b. Accumulation loop
c. Counting loop
d. Searching loop

3.Suppose a Scanner contains n lines, and each line consists of a name and a birthdate. You want determine whether anyone was born during the 1970s. What type of loop should you write?

Select one:
a. Optimization loop
b. Counting loop
c. Searching loop
d. Accumulation loop

4.Suppose a Scanner contains n lines, and each line consists of a name and a birthdate. You want to compute the average age of all the people. What type of loop should you write?

Select one:
a. Optimization loop
b. Counting loop
c. Searching loop
d. Accumulation loop
5.Suppose a Scanner contains n lines, and each line consists of a name and a birthdate. You want to print out all the names. What type of loop should you write?

Select one:
a. Optimization loop
b. Searching loop
c. Counting loop
d. Accumulation loop

6.A java.util.GregorianCalendar object can be used to represent calendar dates. If you have two such objects, d1 and d2, which of its methods would you use to determine whether d1 comes earlier, later, or at the same time as d2.

Give nothing more than the name of the method. This is being graded by a program!

Answer:

7.A java.math.BigInteger object can be used to represent integers with an arbitrary number of digits. If you have such an object b, which of its methods could you use to determine whether it is probably prime?

Give nothing more than the name of the method. This is being graded by a program!

Answer:

8.A java.net.HttpURLConnection object can be used to represent a network connection in a web browser or server. If you have such an object, which of its methods could you use to determine whether the connection is going through a proxy?

Give nothing more than the name of the method. This is being graded by a program!

Answer:

9.A java.lang.String object can be used to represent character strings. If you have such an object, which of its methods could you use to remove its leading and trailing white space?

Give nothing more than the name of the method. This is being graded by a program!

Answer:

10.The java.sql.DriverManager class provide a variety of static methods for controlling database drivers. Which of these methods would you use to find the maximum amount of time a driver can wait when attempting to log into a database.

Give nothing more than the name of the method. This is being graded by a program!

Answer:

Explanation / Answer

These are subjective terms so answers may be different. 1)I would say B as you are searching the pairs to find the highest value 2)a 3)a. You are still doing an accumlation, you will just do a division at the end 4)a i guess. 1.b. Consult the Java API documentation 2.b. Accumulation loop 3.d. Accumulation loop , ( followed by division at end ) 4.b. Counting loop 5.a. Optimization loop 6.Date Format factory method 7.BigInteger methods 10) The Screens Multitier Architectures Remote Method i am not sure abt the 2 answers 8.9