1. The `get()` method in the IntegerList class returns the value in the list at
ID: 3605778 • Letter: 1
Question
1. The `get()` method in the IntegerList class returns the value in the list
at the index passed in as a parameter. Valid inputs to `get()` are integers
from 0 to size-1 if the list contains at least one element, where size is
the number of elements in the list. On an invalid input, the `get()` method
calls `System.out.println("Invalid input!") and returns -1.
Given the following code to test the `get()` method, what will be printed?
(1 point)
try {
myIntList.get(-1);
System.out.println("Try Block");
} catch(Exception e) {
System.out.println("Catch Block");
}
2. For Unit testing, what does "unit" usually refer to? (1 point)
[ YOUR ANSWER GOES HERE ]
3. Given the following line of code in the Makefile:
SOURCE=A.java B.java C.java
How would you use `SOURCE` as dependency in the target below? (1 point)
A.class: ___________
[ YOUR ANSWER GOES HERE ]
4. Assuming no targets start with the character '.', which target is the
default target in a Makefile? (1 point)
[ YOUR ANSWER GOES HERE ]
5. True or False: Every action line in a Makefile should begin with a tab.
(1 point)
[ YOUR ANSWER GOES HERE ]
Explanation / Answer
try {
myIntList.get(-1);
System.out.println("Try Block");
} catch(Exception e) {
System.out.println("Catch Block");
}
This will print
Invalid input!
Try Block
2. For Unit testing, what does "unit" usually refer to? (1 point)
[ YOUR ANSWER GOES HERE ]
Generally unit refers to one method in the class to be tested.
3. Given the following line of code in the Makefile:
SOURCE=A.java B.java C.java
How would you use `SOURCE` as dependency in the target below? (1 point)
A.class: ___________
[ YOUR ANSWER GOES HERE ]
A.class: javac $(Source).java
4. Assuming no targets start with the character '.', which target is the
default target in a Makefile? (1 point)
[ YOUR ANSWER GOES HERE ]
By default, it begins by processing the first target that does not begin with a '.'
5. True or False: Every action line in a Makefile should begin with a tab.
(1 point)
[ YOUR ANSWER GOES HERE ]
True
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.