Question
1. Suppose a Scanner object has been created for scanning n lines of text from a file. Each line consists of a name and a
1. Suppose a Scanner object has been created for scanning n lines of text from a file. Each line consists of a name and a birthdate. You need to solve the problem of determining the name of the oldest person. What kind of loop should you write?
Select one:
a. Searching loop
b. Counting loop
c. Optimization loop
d. Accumulation loop
2. Suppose a Scanner object has been created for scanning n lines of text from a file. Each line consists of a name and a birthdate. You need to solve the problem of determining whether anyone was born during the 1970s. What kind of loop should you write?
Select one:
a. Accumulation loop
b. Searching loop
c. Optimization loop
d. Counting loop
3. Suppose a Scanner object has been created for scanning n lines of text from a file. Each line consists of a name and a birthdate. You need to solve the problem of determining the average age of all of the people. What kind of loop should you write?
Select one:
a. Accumulation loop
b. Searching loop
c. Optimization loop
d. Counting loop
4. Suppose a Scanner object has been created for scanning n lines of text from a file. Each line consists of a name and a birthdate. You need to solve the problem of printing each name, one at a time. What kind of loop should you write?
Select one:
a. Optimization loop
b. Accumulation loop
c. Searching loop
d. Counting loop
5. A java.util.GregorianCalendar object can be used to represent calendar dates. If you have two such objects, date1 anddate2, which of its methods would you use to determine whether date1 comes earlier, later, or at the same time as date2?
Give nothing more than the exact, case-sensitive name of the method. _________________
6. A java.math.BigInteger object can be used to represent integers with an arbitrary number of digits. If you have such an object, num, which of its methods would you use to determine whether it is probably prime?
Give nothing more than the exact, case-sensitive name of the method. _________________
7. 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, c, which of its methods would you use to determine whether the connection is going through a proxy?
Give nothing more than the exact, case-sensitive name of the method. _________________
8. A java.lang.String object can be used to represent character strings. If you have such an object, str, which of its methods would you use to remove its leading and trailing whitespace?
Give nothing more than the exact, case-sensitive name of the method. _________________
9. The java.sql.DriverManager class provides 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 exact, case-sensitive name of the method. _________________
10. What is the value of count after evaluation of the Java expression count == 25 && ++count > 25? Note that before evaluation of the expression the value of count is 21.
Enter an integer as your answer. Nothing more, nothing less. _________________
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started