Multifuncional Para Java
Multifuncional Para Java
Lesson 2
Q2.2 Multiple choice. Identify the items that relate to the benefits of object-oriented programming.
Choose all that apply.
• The source code of one object can be modified independently of the source code for another
object. (correct)
• By using methods, objects hide the details of their internal implementation. (correct)
• A problematic object can be replaced by another object without affecting the rest of the
application. (correct)
Q2.3 Drag and Drop. Identify the items that are included in the Java Development Kit (JDK) and drag
them into the box labeled JDK.
• Compiler (correct)
• Microprocessor (incorrect)
Lesson 3
Q3.1 Based on what you see in the directory display, what is the name of the package name in which
Student .java resides?
Answer – test
Answer – False
Q3.3 Multiple choice. Which of the following describes the main method? Choose all that apply.
Lesson 4
Q4.1 Drag and drop the term on the right to match the description on the left.
Q4.2 Order of precedence. Rank the mathematical operations by precedence using the dropdown on
the right of each answer to select the order.
Q5.1 Multiple choice. Which of the following statements describes a boolean expression? Choose all
that apply.
Answers: A, B, and C
Q5.2 Drag and drop the code snippets into the white spaces in the code sample to complete the code
block.
Answers:
Lesson 6
Q6.1 What will print when you run the following code?
a. R
b. Shirt color: R}
c. Shirt color: G
d. Shirt color: is colorCode
e. G
<answer: c >
Q6.2 Drag and drop the term on the right to match the description on the left.
Q6.3 Which lines of code correctly instantiates a RainbowColor object and assigns it an object
reference? Choose all that apply.
b. RainbowColor yellow;
<answers: b, c >
Q6.4 True/False
Stack and heap are two types of memory that Java uses.
Lesson 7
Q7.1 Multiple choice. Why is it a best practice to not use the new keyword when creating a String
object? Choose one answer.
A. The new keyword is often overused in Java and using it could cause confusion.
B. Using the new keyword creates a duplicate object in memory and is not a memory efficient
coding practice.
Answer: B
Q7.2 True or False. Java allows only a single return from a method.
Answer: True
Q7.3 The Java API documentation, a library specification for the Java language, provides what type of
information? Choose all that apply.
Q7.4 Fill in the blank. You use the ______ keyword to make a variable a constant?
A. final
Q7.5 Drag and Drop. Use the drop-down on the right to select the term that matches the definition on the
left.
Lesson 8
Q8.1 Fill in the blank. Use the ____ keyword with dot notation to access a field or method of the current
object.
Answer. this
Q8.3 Multiple choice. Which line of code in the FlannelShirt class is an example of the syntax for
accessing the colorCode static variable of the RedShirt class?
A. RedShirt.colorCode;
B. RedShirt.colorCode();
C. colorCode;
D. Static colorCode;
Answer A
Lesson 9
Q 9.2 fields of a class should be private, and those that need to be accessed should have public methods
for setting and getting their values. (fill in the blank)
Answer: public
Q9.3 What are the three arguments that you would set for this constructor?
setColorCode(colorCode);
setDescription(desc);
setPrice(price);
Lesson 10
Q10.1 Which of the following statements about conditional operators is true? Choose all that apply.
Q10.2 Which of the following statements about switch statements is true? Choose all that apply.
b. The value of a switch statement expression can be only of type char, byte, short, int, or String.
c. The case keyword indicates a value that you are testing. In combination with a literal value, it is
referred to as a case label.
Q10.3 Debuggers can be used to solve logic problems and runtime errors. True or false
Answer true.
Lesson 11
Q11.1 Hot Spot selection. Duke is planning his month, and he needs to add an item to his schedule. Drag
the item into the cell of his calendar based on the code example.
Q 11.3 Which of the following statements describes an ArrayList? Choose all that apply.
Answer: A, C, D
Lesson 12
Q12.1 In the following code sample, which keyword is missing from Line 01 that can be used to
implement an inheritance from the Clothing class.
Answer: extends
Q12.2. In terms of inheritance, ____ is a keyword that you use to invoke a method of a superclass.
Answer: super
Q12.3 Which of the following statements about an Abstract class are true? Choose all that apply.
Lesson 13
Q13.1 Drag and drop the description on the right to match the term on the left.
Object class All classes have this at the very top of their
hierarchy
Q13.2 In the following code examples, type the method that has to be implemented in Line 07 in order
to prevent a compiler error.
Answer: doReturn()
a. toString()
b. toDo()
c. doReturn()
d. getString()
answer a. toString()
Lesson 14
Q14.1 Using the dropdown next to each item, match the exception with the cause of the exception.
Q14.2 Match the type of exception that corresponds to the explanation of what caused the exception.
A Exception c:\notWriteableDir is a directory, but it is not
writeable.
14.3 Match the definition on the right to the term on the left.
Unchecked
Unchecked