Question: Open Quick Links Quick Links Global Menu MCC Home Top Frame Tabs Blackboard Home Tab 1 of 2 (active tab) Help Tab 2 of 2
Open Quick Links Quick Links Global Menu MCC Home Top Frame Tabs Blackboard Home Tab 1 of 2 (active tab) Help Tab 2 of 2 Current Location 18SS_INFO_1521_SN - On-Campus - Java Programming I Course-to-Course Navigation Lessons Week 8 Take Test: Chapter 9 and 10 Quiz Hide Course Menu Menu Management Options Refresh Display Course Menu in a Window Course Menu: 18SS_INFO_1521_SN - On-Campus - Java Programming I Course Entry Page Lessons Announcements Email - Office 365 Calendar My Grades BbLearn Help Syllabus Take Test: Chapter 9 and 10 Quiz Content Assistive Technology Tips [opens in new window] Test Information Instructions Description Instructions Multiple Attempts Not allowed. This test can only be taken once. Force Completion This test can be saved and resumed later. Question 1 An enumeration inherits methods from which of the following classes? a. java.lang.Object b. java.lang.Enum c. both a and b d. neither a nor b 1 points Question 2 Which of the following can you not do with an enumeration? a. Use an integer in place of a constant defined by an enumeration b. Use an enumeration as a parameter type c. Declare a variable as an enumeration type d. Store an enumeration in its own file 1 points Question 3 What must you do to use a module in an application? a. Add the JAR file to the Libraries directory for the project b. Add the module-info file to the default package for the project c. Add all other classes to a package other than the default package d. All of the above e. A and B only 1 points Question 4 Which of the following statements is not true? a. An interface can contain abstract methods. b. An interface can contain static constants. c. A class can implement multiple interfaces. d. An interface can contain instance variables. e. A class can inherit another class and implement an interface. 1 points Question 5 Where must you code the javadoc comment for a method? a. Anywhere within the method b. After any statements in the method c. Immediately before the method d. Before any statements in the method 1 points Question 6 Which of the following is not a reason to create a package? a. To group related classes b. To make it easy to reuse classes c. To prevent other developers from using the class d. To make finding classes easier 1 points Question 7 Directory structure 10-1 invoice InvoiceApp.java murach business Invoice.java LineItem.java Product.java database ProductDB.java presentation Validator.java (Refer to directory structure 10-1.) If the directory structure is for an Invoice application that uses packages, what is the name of the package that contains the Invoice.java class? a. business b. business.murach c. invoice.murach.business d. murach.business 1 points Question 8 To include a class in a package, you a. code a package statement as the first statement in the class file b. code the name of the package in the class declaration c. code an import statement as the first statement of the class 1 points Question 9 Which of the following is not true about generated Java documentation? a. It indicates the package that a class belongs to. b. It lets you view classes by package. c. It lists all public methods of the class. d. It includes the code that implements each documented method. 1 points Question 10 The clone method of the Object class may not work properly with a class that contains ____________ objects. 1 points Question 11 A __________ is typically stored in a JAR file and contains one or more packages that you want to make available to other projects. 1 points Question 12 With Java 8 and later, what keyword can you use to code a regular (non-static) method in an interface? a. the regular keyword b. the default keyword c. the static keyword d. the nonstatic keyword 1 points Question 13 Enumerations are ____________, which means that you cant specify another type in place of an enumeration type. 1 points Question 14 Each constant within an enumeration is assigned a. an integer value beginning with zero b. the integer value you specify c. an integer value beginning with one 1 points Question 15 Enumeration 10-1 public enum Terms { NET_30_DAYS, NET_60_DAYS, NET_90_DAYS } (Refer to enumeration 10-1.) What statement would you use to assign the NET_60_DAYS constant of the Terms enumeration to a variable named terms? a. Either a or b b. Neither a nor b c. Terms terms = Terms.NET_60_DAYS; d. Terms terms = Terms[1]; 1 points Question 16 A class that ______________ an interface must contain methods for all abstract methods in the interface. Otherwise, the class must be declared as abstract. 1 points Question 17 Code example 9-1 public interface Printable { public void print(); } public class Printer { public static void printInvoice(Printable p) { System.out.println("Printing invoice"); p.print(); } } public class Order implements Printable { public void print() { System.out.println("Order object"); } } public class Rental extends Transaction implements Printable { public void print() { System.out.println("Rental object"); } } (Refer to code example 9-1.) What happens when the code that follows is executed? Rental rental = new Rental(); Printer.printInvoice(rental); a. Nothing happens. b. A runtime error occurs because printInvoice cant accept Rental objects. c. Printing invoice and Rental object are printed to the console. d. Printing invoice is printed to the console. 1 points Question 18 Which of the following is a valid javadoc comment? a. /* Calculates the balance due **/ b. /* Calculates the balance due */ c. /** Calculates the balance due */ d. // Calculates the balance due // 1 points Question 19 In what type of file is javadoc documentation stored? a. java file b. html file c. txt file d. class file 1 points Question 20 You can use ____________ within a javadoc comment to apply formatting to the text when its displayed. 1 points Question 21 Which of the following is a benefit of using javadoc comments? a. They make it easy for other programmers to learn about your class. b. They show other programmers how to code a class. c. They make your classes easier to debug. d. They allow other programmers to view the source code for your class. 1 points Question 22 To include special entries in javadoc documentation, you use ____________. 1 points Question 23 Which of the following is not true about static imports? a. They let you import the constants of an enumeration. b. They reduce the amount of typing thats required. c. They often make your code easier to read. d. They let you import the static fields and methods of a class. 1 points Question 24 A class that implements an interface can use any ____________ defined by that interface without declaring it. 1 points Question 25 The Cloneable interface a. can only be used with mutable objects b. clones an object c. indicates if an object can be cloned d. indicates if an object has been cloned 1 points Click Save and Submit to save and submit. Click Save All Answers to save all answers.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
