Professional Documents
Culture Documents
I. When all unit tests succeed, you can have high confidence your code is solid.
II. If a unit test fails, you don?t proceed until the code is fixed and the test succeeds.
III. Unit testing can help developer find problems early in the development cycle
(1) Points
I only
I and II only
None of these
2. Which of the following statements about arrays and ArrayLists in Java are true?
IV. In an ArrayList you need to know the length and the current number of elements stored.
(1) Points
None of these
3. Which of the following statements about inheritance is false? Mark for Review
(1) Points
A subclass inherits all the members (fields, methods, and nested classes) from its superclass.
Inheritance allows you to reuse the fields and methods of the super class without having to write them yourself.
Inheritance allows you to minimize the amount of duplicate code in an application by sharing common code among
several subclasses.
Through inheritance, a parent class is a more specialized form of the child class. (*)
4. In the relationship between two objects, the class that is being inherited from is called the maxi-class. True or false?
Mark for Review
(1) Points
True
False (*)
5. Which of the following is not a good technique to follow when reading code written by others? Mark for Review
(1) Points
Find the author of the code and ask him how it works. (*)
Learn the high level structure and starting point, and then figure out how it branches.
Perform testing.
public Car() {
...
(1) Points
Encapsulation
Polymorphism
Comments
Inheritance (*)
7. Which two statements are access modifier keywords in Java?(Choose Two) Mark for Review
(1) Points
protected (*)
abstract
public (*)
final
You can declare more than one constructor in a class declaration. (*)
Since a constructor can not return any value, it should be declared as void.
You can use access modifiers to control which other classes can call the constructor. (*)
Which of following arguments can be passed into the method? (Choose Two) Mark for Review
(1) Points
Interface
Type of Student class (*)
li.add(1);
li.add(2);
print(li);
(1) Points
11. Examine the code below. Which statement about this code is true?
1.class Shape { }
4.class Node { }
8.Node ns = nc;
(1) Points
True or False?
class Test{
Comparable com=nc;
(1) Points
True (*)
False
13. Which of the following correctly initializes an object named cell of the class Telephones whose generic type is
Cellular? Mark for Review
(1) Points
Telephones cell = new Telephones(Cellular c);
(1) Points
True
False (*)
15. Nodes are components of LinkedLists, and they identify where the next and previous nodes are.
(1) Points
True (*)
False
16. Implementing the Comparable interface in your class allows you to define its sort order.
(1) Points
True (*)
False
(1) Points
True
False (*)
18. Stacks are identical to Queues.
(1) Points
True
False (*)
19. Which of the following correctly defines a queue? Mark for Review
(1) Points
Something that enables you to create a generic class without specifying a type between angle brackets <>.
It is a keyword in Java that restrict the use of the code to local users only.
(1) Points
(1) Points
It implements a stack.
Allows for insertion or deletion of elements from the first element added or the last one.
All of the above. (*)
22. Which sort algorithm was used to sort the char array {'M', 'S', 'A', 'T', 'H'}?
(1) Points
Sequential Search
Selection Sort
Binary Search
Merge Sort
23. Big-O Notation is used in Computer Science to describe the performance of Sorts and Searches on arrays. True or
false? Mark for Review
(1) Points
True (*)
False
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
25. Which of the following sorting algorithms utilizes a "divide and conquer" technique to sort arrays with optimal
speed? Mark for Review
(1) Points
Sequential Search
Selection Sort
Binary Search
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
27. A sequential search is an iteration through the array that stops at the index where the desired element is found.
True or false? Mark for Review
(1) Points
True (*)
False
28. Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
(1) Points
True
False (*)
29. Which of the following is the correct lexicographical order for the conents of the following int array?
{17, 1, 1, 83, 50, 28, 29, 3, 71, 22} Mark for Review
(1) Points
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
30. Which of the following statements can be compiled?(Choose Three) Mark for Review
(1) Points
31. Which code inserted into the code below guarantees that the program will output [1,2]?
import java.util.*;
set.add(2);
set.add(1);
System.out.println(set);
(1) Points
(1) Points
True
False (*)
33. ArrayList and Arrays both require you to define their size before use.
(1) Points
True
False (*)
34. A HashSet is a set that is similar to an ArrayList. A HashSet does not have any specific ordering.
(1) Points
True (*)
False
35. Which interface forms the root of the collections hierarchy? Mark for Review
(1) Points
java.util.Collections
java.util.Map
java.util.List
java.util.Collection (*)
6. Unit testing is the phase in software testing in which individual software modules are combined and tested as a
whole. True or false? Mark for Review
(1) Points
True
False (*)
(1) Points
I only
II only
None of these
8.Which of the following are important to your survival as a programmer? Mark for Review
(1) Points
9. Reading great code is just as important for a programmer as reading great books is for a writer. True or false? Mark
for Review
(1) Points
True (*)
False
10. The instanceof operator allows you to determine the type of an object.
(1) Points
True (*)
False
36. The following code is valid when working with the Collection Interface.
(1) Points
True
False (*)
37. Which one of the following statements is true? Mark for Review
(1) Points
(1) Points
True (*)
False
39. Immutable classes do allow instance variables to be changed by overriding methods.
(1) Points
True
False (*)
40. In general, classes can be made immutable by placing a final key word before the class keyword.
(1) Points
False
True (*)
(1) Points
True
False (*)
42. The state of an object differentiates it from other objects of the same class.
(1) Points
True (*)
False
(1) Points
True
False (*)
44. You can always upcast a subclass to an interface provided you don't need to access any members of the concrete
class.
(1) Points
True (*)
False
(1) Points
(1) Points
True
False (*)
47. Upward casting an object instance means you can't access subclass specific methods.
(1) Points
True (*)
False
48. Which two of the following statements are true? (Choose Two) Mark for Review
(1) Points
49. Java provides virtual method invocation as a feature and it doesn't require specialized coding.
(1) Points
True (*)
False
50. The instanceof operator is a boolean comparison operator.
(1) Points
True (*)
False
6. Unit testing is the phase in software testing in which individual software modules are combined and tested as a
whole. True or false? Mark for Review
(1) Points
True
False (*)
7. What do Arrays and ArrayLists have in common?
(1) Points
I only
II only
None of these
8. Which of the following are important to your survival as a programmer? Mark for Review
(1) Points
9. Reading great code is just as important for a programmer as reading great books is for a writer. True or false? Mark
for Review
(1) Points
True (*)
False
10. The instanceof operator allows you to determine the type of an object.
(1) Points
True (*)
False
11. The instanceof operator is a boolean comparison operator.
(1) Points
True (*)
False
12. Java provides virtual method invocation as a feature and it doesn't require specialized coding.
(1) Points
True (*)
False
13. The instanceof operator works with class instances and primitive data types.
True
False (*)
3. )
7. return balance;
8. }
(1) Points
Compilation is successful.
15. Virtual method invocation occurs when you try to call a superclass method.
(1) Points
True
False (*)
(1) Points
(1) Points
It implements a stack.
Allows for insertion or deletion of elements from the first element added or the last one.
18. Why can a LinkedList be considered a stack and a queue?(Choose Three) Mark for Review
(1) Points
Because you can remove elements from the end of it. (*)
Because you can remove elements from the beginning of it. (*)
(1) Points
True (*)
False
(1) Points
True
False (*)
21. Which of the following is a list of elements that have a first in last out ordering. Mark for Review
(1) Points
Arrays
Stacks (*)
HashMaps
Enums
22. Which of the following correctly defines a queue? Mark for Review
(1) Points
Something that enables you to create a generic class without specifying a type between angle brackets <>.
(1) Points
A pile of pancakes with which you add some to the top and remove them one by one from the top to the bottom.
A row of books that you can take out of only the middle of the books first and work your way outward toward either
edge.
A line at the grocery store where the first person in the line is the first person to leave. (*)
24. What are maps that link a Key to a Value? Mark for Review
(1) Points
HashMaps (*)
ArrayLists
Arrays
HashSets
25. The local petting zoo is writing a program to be able to collect group animals according to species to better keep
track of what animals they have.
Which of the following correctly defines a collection that may create these types of groupings for each species at the
zoo? Mark for Review
(1) Points
public class
public class
animalCollection(AnimalType T) {...}
public class
animalCollection {...}
public class
animalCollection(animalType) {...}
(1) Points
(1) Points
True
False (*)
28. < ? > is an example of a bounded generic wildcard.
(1) Points
True
False (*)
29. Selection sort is a sorting algorithm that involves finding the minimum value in the list, swapping it with the value
in the first position, and repeating these steps for the remainder of the list.
(1) Points
True (*)
False
30. Which of the following best describes lexicographical order? Mark for Review
(1) Points
A simple sorting algorithm that is inefficient on large arrays.
31. Which of the following sorting algorithms utilizes a "divide and conquer" technique to sort arrays with optimal
speed? Mark for Review
(1) Points
Sequential Search
Selection Sort
Binary Search
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
33. Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
(1) Points
True
False (*)
34. Why might a sequential search be inefficient? Mark for Review
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
35.Of the options below, what is the fastest run-time? Mark for Review
(1) Points
n*log(n)
log(n) (*)
n^2
36. Which sort algorithm was used to sort the char array {'M', 'S', 'A', 'T', 'H'}?
(1) Points
Binary Search
Selection Sort
Merge Sort
Sequential Search
37. In general, classes can be made immutable by placing a final key word before the class keyword.
True or false? Mark for Review
(1) Points
False
True (*)
(1) Points
True
False (*)
(1) Points
(1) Points
True
False (*)
41. Modeling classes for a business problem requires understanding of the business not Java. True or false? Mark for
Review
(1) Points
True
False (*)
(1) Points
True
False (*)
2. int accountID=100;
(1) Points
(1) Points
Something that enables you to create a generic class without specifying a type between angle brackets <>.
45. Which of the following statements can be compiled?(Choose Three) Mark for Review
(1) Points
(Choose all correct answers)
(1) Points
It is an interface in the java.util package that is used to define a group of objects. (*)
It enables you to create a generic class without specifying a type between angle brackets <>.
It is a special type of class that is associated with one or more non-specified Java type.
It is a subclass of List.
47. Sets may contain duplicates.
(1) Points
True
False (*)
48. Which is the correct way to initialize a HashSet? Mark for Review
(1) Points
HashSet();
HashSet classMates =
String();
49. Which interface forms the root of the collections hierarchy? Mark for Review
(1) Points
java.util.Map
java.util.Collection (*)
java.util.Collections
java.util.List
interface Shape {}
ls.add(new Circle());
(1) Points
3 (*)
(1) Points
2. A class can be extended by more than one class. True or False? Mark for Review
(1) Points
True (*)
False
3. Which two statements are access modifier keywords in Java?(Choose Two) Mark for Review
(1) Points
protected (*)
abstract
final
4. Unit testing can help you isolate problem quickly. True or False? Mark for Review
(1) Points
True (*)
False
5. Which statement is true for the class java.util.ArrayList? Mark for Review
(1) Points
6. The main purpose of unit testing is to verify that an individual unit (a class, in Java) is working correctly before it is
combined with other components in the system. True or false? Mark for Review
(1) Points
True (*)
False
7. Which of the following statements about arrays and ArrayLists in Java are true?
IV. In an ArrayList you need to know the length and the current number of elements stored.
(1) Points
I and III only (*)
II and IV only
None of these
8. When an object is able to pass on its state and behaviors to its children, this is called: Mark for Review
(1) Points
Encapsulation
Isolation
Polymorphism
Inheritance (*)
9. Which of the following are important to your survival as a programmer? Mark for Review
(1) Points
10. Which of the following best describes lexicographical order? Mark for Review
(1) Points
(1) Points
n^2
log(n) (*)
n*log(n)
12. Selection sort is a sorting algorithm that involves finding the minimum value in the list, swapping it with the value
in the first position, and repeating these steps for the remainder of the list.
(1) Points
True (*)
False
13. A sequential search is an iteration through the array that stops at the index where the desired element is found.
(1) Points
True (*)
False
14. Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
(1) Points
True
False (*)
15. Which of the following is the correct lexicographical order for the conents of the following int array?
{17, 1, 1, 83, 50, 28, 29, 3, 71, 22} Mark for Review
(1) Points
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
17. A sequential search is an iteration through the array that stops at the index where the desired element is found.
True or false? Mark for Review
(1) Points
True (*)
False
18. In general, classes can be made immutable by placing a final key word before the class keyword.
(1) Points
True (*)
False
19. Immutable classes can be subclassed.
(1) Points
True
False (*)
(1) Points
(1) Points
(1) Points
23. Modeling classes for a business problem requires understanding of the business not Java. True or false? Mark for
Review
(1) Points
True
False (*)
24. Modeling business problems requires understanding the interaction between interfaces, abstract and concrete
classes, subclasses, and enum classes. Mark for Review
(1) Points
True (*)
False
25. Which method will force a subclass to implement it? Mark for Review
(1) Points
26. Virtual method invocation occurs when you try to call a superclass method.
(1) Points
True
False (*)
27. Virtual method invocation must be defined with the instanceof operator.
(1) Points
True
False (*)
28. A upward cast means all instance variables of the subclass are permanently lost to the instance.
(1) Points
True
False (*)
29. Calling a subclass method by referring to a superclass works because you have access to all specialized methods
through virtual method invocation.
(1) Points
True
False (*)
interface Shape {}
(1) Points
Line 1
Line 3 (*)
Line 4
Line 2
31. Which two of the following statements are true? (Choose Two) Mark for Review
(1) Points
32. Which interface forms the root of the collections hierarchy? Mark for Review
(1) Points
java.util.Collection (*)
java.util.Map
java.util.List
java.util.Collections
33. Which of the following correctly adds "Cabbage" to the ArrayList vegetables? Mark for Review
(1) Points
vegetables[0] = "Cabbage";
vegetables += "Cabbage";
vegetables.add("Cabbage"); (*)
vegetables.get("Cabbage");
interface Shape {}
ls.add(new Circle());
System.out.println(ls.size());// line 4
(1) Points
Compilation error at line 4
3 (*)
set.add(4);
System.out.print(element);
(1) Points
1234 (*)
1213
11234
12134
36. Which of the following statements can be compiled?(Choose Three) Mark for Review
(1) Points
37. A HashSet is a set that is similar to an ArrayList. A HashSet does not have any specific ordering.
(1) Points
True (*)
False
38. Which class is an ordered collection that may contain duplicates? Mark for Review
(1) Points
enum
array
set
list (*)
39. A generic class is a type of class that associates one or more non-specific Java types with it.
(1) Points
True (*)
False
(1) Points
True
False (*)
li.add(1);
li.add(2);
print(li);
(1) Points
1 2 (*)
(1) Points
ArrayList<T>
ArrayList<?>
(1) Points
True (*)
False
(1) Points
True (*)
False
45. Why can a LinkedList be considered a stack and a queue?(Choose Three) Mark for Review
(1) Points
Because you can remove elements from the end of it. (*)
Because you can remove elements from the beginning of it. (*)
(1) Points
True (*)
False
47. Which of the following methods adds a Key-Value map to a HashMap? Mark for Review
(1) Points
remove(Key, Value)
get(Key, Value)
add(Key, Value)
(1) Points
A pile of pancakes with which you add some to the top and remove them one by one from the top to the bottom.
A row of books that you can take out of only the middle of the books first and work your way outward toward either
edge.
A line at the grocery store where the first person in the line is the first person to leave. (*)
(1) Points
True (*)
False
(1) Points
It implements a stack.
Allows for insertion or deletion of elements from the first element added or the last one.
BlogThis!
Berbagi ke Twitter
Berbagi ke Facebook
Bagikan ke Pinterest
1 komentar:
interface Shape {}
Balas
Unknown
Arsip Blog
▼ 2017 (6)
► Juli (2)
▼ Mei (4)
QUIZ 3 OJP
OJP 2
OJP 3
OJP 1
Tema Sederhan
java programming
Section 1
10. The function of Garbage Collection in Java is: Mark for Review
(1) Points
Memory occupied by objects with no reference is automatically reclaimed for reuse. (*)
As a Java programmer, we have to call the GC function specifically in order to manage the Java Memory.
1. Which of the following statements is NOT true of the Java programming language? Mark for Review
(1) Points
All source code is written in plain text files with the extension .java.
Java source code files are compiled into .class files by the javac command.
Correct Correct
2. Which of the following statements describe the Java programming language? Mark for Review
(1) Points
Correct Correct
int x;
int y=100;
(1) Points
Variable x resides in the stack area, and variable y resides in the heap of the JVM.
Variable x resides in the heap area, and variable y resides in the stack of the JVM (*)
Variable x stays in the heap area, and variable y resides in the method area of the JVM.
Correct Correct
4. Which of the following converts a human-readable file into a platform-independent code file in Java? Mark for
Review
(1) Points
JRE
JDK
java command
5. Java allows the same Java program to be executed on multiple operating systems. Mark for Review
(1) Points
True (*)
False
Correct Correct
6. Which of the following statements describe Java technology? Mark for Review
(1) Points
It is a programming language.
It is a development environment.
It is a deployment environment.
7. During runtime, the Java platform loads classes dynamically as required. Mark for Review
(1) Points
True (*)
False
Correct Correct
8. One of the primary goals of the Java platform is to provide an interpreted, just-in-time run time environment. Mark
for Review
(1) Points
True (*)
False
(1) Points
The "Hello" String literal will be located in which memory area in the JVM during runtime? Mark for Review
(1) Points
In the constant pool area of the run-time data area in the JVM. (*)
Incorrect Incorrect. Refer to Section 1 Lesson 2.
The str variable will be located in which memory area in the JVM during runtime? Mark for Review
(1) Points
str will stay in the heap area of the run-time data area in the JVM.
str will stay in the method area of the run-time data area in the JVM.
str will stay in the stack area of the run-time data area in the JVM. (*)
str will stay in the heap area of the constant pool run-time data area in the JVM.
12. In which area of heap memory are newly created objects stored? Mark for Review
(1) Points
Survivor Space 0
Survivor Space 1
Eden (*)
Tenured
13. Which of the following allows the programmer to destroy an object referenced by x? Mark for Review
(1) Points
x.remove();
x.finalize();
x.delete();
Correct Correct
14. Which of following statements describes Parallel and Serial Garbage collection? Mark for Review
(1) Points
A Parallel garbage collector uses multiple threads to manage heap space. (*)
15. Which of the following statements is NOT TRUE for the JVM heap? Mark for Review
(1) Points
Java Developer can explicitly allocate and deallocate the Heap Memory. (*)
Correct Correct
int x;
int y=100;
(1) Points
Variable x resides in the stack area, and variable y resides in the heap of the JVM.
Variable x resides in the heap area, and variable y resides in the stack of the JVM (*)
Variable x stays in the heap area, and variable y resides in the method area of the JVM.
Correct Correct
2. Which of the following statements describe the Java programming language? Mark for Review
(1) Points
Correct Correct
3. During runtime, the Java platform loads classes dynamically as required. Mark for Review
(1) Points
True (*)
False
Correct Correct
4. Which of the following statements is NOT TRUE about the JVM? Mark for Review
(1) Points
The JVM is a virtual Machine that acts as an intermediary layer between the Java Application and the Native Operating
System.
The JVM reads byte code from the class file, and generates machine code.
The JVM reads Java source code, and then translates it into byte code. (*)
(1) Points
Stack area
Method area
In the file
In the database
6. Java allows the same Java program to be executed on multiple operating systems. Mark for Review
(1) Points
True (*)
False
Correct Correct
7. Which of the following converts a human-readable file into a platform-independent code file in Java? Mark for
Review
(1) Points
JRE
JDK
java command
Correct Correct
8. One of the primary goals of the Java platform is to provide an interpreted, just-in-time run time environment. Mark
for Review
(1) Points
True (*)
False
Correct Correct
9. Which of following statements describes Parallel and Serial Garbage collection? Mark for Review
(1) Points
A Serial garbage collector uses multiple threads to manage heap space.
A Parallel garbage collector uses multiple threads to manage heap space. (*)
Correct Correct
(1) Points
Correct Correct
11. Which of the following statements is NOT TRUE for the JVM heap? Mark for Review
(1) Points
Java Developer can explicitly allocate and deallocate the Heap Memory. (*)
Correct Correct
The "Hello" String literal will be located in which memory area in the JVM during runtime? Mark for Review
(1) Points
In the Heap area of the run-time data area in the JVM.
In the constant pool area of the run-time data area in the JVM. (*)
What estimated percentage of the Java objects will be promoted from Young space to Tenured space? Mark for Review
(1) Points
0.2
0.4
0.6 (*)
0.8
0.9
14. Which of the following allows the programmer to destroy an object referenced by x? Mark for Review
(1) Points
x.remove();
x.finalize();
x.delete();
Correct Correct
The str variable will be located in which memory area in the JVM during runtime? Mark for Review
(1) Points
str will stay in the heap area of the run-time data area in the JVM.
str will stay in the method area of the run-time data area in the JVM.
str will stay in the stack area of the run-time data area in the JVM. (*)
str will stay in the heap area of the constant pool run-time data area in the JVM.
Correct Correct
Section 2
1. Which of the following commands allows a developer to see the effects of a running java application on memory and
CPU? Mark for Review
(1) Points
javac
jvisualvm (*)
java
javap
Correct Correct
2. HotSpot has an HSDIS plugin to allow disassembly of code. Mark for Review
(1) Points
True (*)
False
Correct Correct
3. Which of the following commands is used to launch a java program? Mark for Review
(1) Points
javac
jvisualvm
java (*)
javap
4. Before we can use the jsat tool we first have to use the jps tool to obtain JVM process id numbers. Mark for Review
(1) Points
True (*)
False
Correct Correct
5. Given the following information in the jdb tool, jdb paused at line 11:
10 x=100;
11 }
public static void method1();
Code:
0: bipush 100
5: return
(1) Points
The line=11 means the jdb executed line 11 bytecode in the method1 method.
The bci=5 means the jdb executed the last bytecode instruction in the method1 method. (*)
The bci=5 means the jdb executed 5 lines of the source code.
Correct Correct
6. The javac command can be used to display native code in Java Mark for Review
(1) Points
True
False (*)
7. The jsat tool can be used to monitor garbage collection information. Mark for Review
(1) Points
True (*)
False
3. Which of the following structures are contained in a Java class file? Mark for Review
(1) Points
minor_version
major_version
access_flags
All of the above (*)
The bytecode for a Java method is located in which structure in the Java class file? Mark for Review
(1) Points
magic
access_flags
method_info (*)
major_version
Which structure in the Java class file contains the line number information for the original source file? Mark for Review
(1) Points
method_info (*)
this_class
filed_info
cp_info
Which of the following commands can be used to translate Java source code into bytecode? Mark for Review
(1) Points
java
javac (*)
jdb
jstat
Correct Correct
8. Which of the following commands can be used to monitor the Java Virtual Machine statistics? Mark for Review
(1) Points
jstat (*)
javap
javac
jmap
Incorrect Incorrect. Refer to Section 2 Lesson 1.
9. Which of the following statements is NOT TRUE for the jdb command? Mark for Review
(1) Points
10. The class file contains the definition it inherits from the superclass. Mark for Review
(1) Points
True
False (*)
int i=888888;
(1) Points
The 888888 is an integer literal. After compile, the number will stay in the constant pool.
The variable i and the literal 888888 are stored in the method_info. (*)
Correct Correct
12. The attributes_count item indicates how many attributes are contained within a method. Mark for Review
(1) Points
True (*)
False
10. Like in the Java source code file, one Java class file can contain multiple class definitions. Mark for Review
(1) Points
True
False (*)
Correct Correct
Which of the following is the descriptor of the test method in the class file? Mark for Review
(1) Points
(java/lang/String;int)V
(Ljava/lang/String;I)V (*)
V(Ljava/lang/String;I)
(Ljava/lang/String;java.lang.Integer)V
void foo(){}
void draw(){}
(1) Points
The Circle class contains both the foo and draw method definitions.
The foo method definition is only contained in the Shape class. (*)
If a Circle object is instantiated, the constructor of Circle will call the constructor of Shape.
15. In a valid Java class file, the magic number is always: Mark for Review
(1) Points
42
CAFEBABE (*)
1.618
BABECAFE
Section 3
1. opcode invokespecial is used to invoke an instance initialization method. Mark for Review
(1) Points
True (*)
False
Correct Correct
2. Bytecode is an intermediate representation of a program, somewhere between source code and machine code.
Mark for Review
(1) Points
True (*)
False
Correct Correct
3. To inspect bytecode, which option is used with the javap command to disassemble the class file? Mark for Review
(1) Points
-a
-b
-c (*)
-d
4. Choose which opcode is used to load an int from the local variable to the operand stack. Mark for Review
(1) Points
aload
iload (*)
iaload
iconst
(1) Points
True (*)
False
Correct Correct
6. Choose which opcode is used to push an int constant 5 onto the operand stack. Mark for Review
(1) Points
iconst_5 (*)
idc5
iload_5
iaload_5
iinc5
Incorrect Incorrect. Refer to Section 3 Lesson 1.
7. .class files are loaded into memory all at once, when a Java application is launched. Mark for Review
(1) Points
True
False (*)
8. The Java developer can define a number of additional or custom classloaders. Mark for Review
(1) Points
True (*)
False
Correct Correct
9. Which of the following statements is NOT TRUE for the Class.forName("HelloClass") method? (Choose three)
Class.forName("HelloClass");
(1) Points
The forName() method returns the Class object associated with the HelloClass.
The forName() method does not load the HelloClas class into the Java Runtime. (*)
In this example, the Class.forName("HelloClass") will use the ClassLoader which loads the Foo class.
(1) Points
verification
preparation
resolution
11. In the ClassLoader hierarchy, which of the following is the only class loader that does NOT have a parent? Mark for
Review
(1) Points
12. Which of the following exceptions is thrown by the loadClass() method of ClassLoader class? Mark for Review
(1) Points
IOException
SystemException
ClassFormatError
ClassNotFoundException (*)
13. The same class cannot be loaded by the JVM more than one time. Mark for Review
(1) Points
True (*)
False
Correct Correct
14. Which of the following from ClassLoader will load the rt.jar, the Java core clsses which are present in the java.*
package? Mark for Review
(1) Points
(1) Points
True
False (*)
Section 4
String s= "a,b,c";
while (sc.hasNext())
(1) Points
a,b
ac
a,b,c (*)
abc
Correct Correct
Which of following arguments can be passed into the method? (Choose Two) Mark for Review
(1) Points
Interface
(1) Points
float f = 3.0L;
float f = 1.0;
4. Which two statements prevent a method from being overriden? (Choose Two) Mark for Review
(1) Points
6. Which of the following operators are relational operators?(Choose Two) Mark for Review
(1) Points
"+="
"!=" (*)
">=" (*)
"="
Incorrect Incorrect. Refer to Section 4 Lesson 1.
7. Which of the following operators are logic operators?(Choose Two) Mark for Review
(1) Points
&& (*)
<=
>
! (*)
i=i++;
j=i++;
System.out.println("i=" + i + " " + "j=" + j); Mark for Review
(1) Points
2. Which statement is a syntactically correct way to declare an Array? Mark for Review
(1) Points
int i[1];
int[5] id={1,2,3,4,5};
3. Using the code below, what will be the output if a Student object is instantiated?
public Student()
System.out.print("1");
super();
System.out.print("2");
(1) Points
12
1
Correct Correct
4. What is the final value of result from the following code snippet?
int i = 1;
(1) Points
An exception is thrown.
Correct Correct
5. What is the output from the following code?
System.out.print("i=");
if(i==3)
break;
System.out.print(i);
(1) Points
i=0123456789
i=012 (*)
i=0123
i=012456789
studentId++;
return studentId;
System.out.println(Student.getStudentId());
(1) Points
7. Which of following relationships does not use inheritance? Mark for Review
(1) Points
Correct Correct
(1) Points
Since a constructor can not return any value, it should be declared as void.
You can use access modifiers to control which other classes can call the constructor. (*)
You can declare more than one constructor in a class declaration. (*)
int i=0,j=0;
i=++i;
j=i++;
(1) Points
10. Which two statements best describe data encapsulation? (Choose Two) Mark for Review
(1) Points
int x=0;
int y=5;
do{
++x;
y--;
}while(x<3);
(1) Points
22
3 2 (*)
23
33
byte b = 1;
True
False (*)
int[] myarray={1,2,3,4,5};
int sum=0;
sum+=x;
(1) Points
10
20
15 (*)
14. Which of following statments are true when you create a object from class Object at runtime as seen below.
(Choose Three)
(1) Points
This Object instance will not be created because you never defined class Object.
(1) Points
1. Which of following relationships does not use inheritance? Mark for Review
(1) Points
Correct Correct
int x=0;
int y=5;
do{
++x;
y--;
}while(x<3);
(1) Points
3 2 (*)
33
23
22
(1) Points
When no constructor is defined in the class, the compiler will create a default constructor.
Correct Correct
if (i == 3) {
break;
}
System.out.print(i); Mark for Review
(1) Points
5. A class can be extended by more than one class. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
6. What is the output from the following code snippet?
System.out.println(str1.equals(c));
(1) Points
int i=0,j=0;
i=++i;
j=i++;
(1) Points
8. Which combination of the following overload the Student constructor?(Choose Two) Mark for Review
(1) Points
9. Which two statements are access modifier keywords in Java?(Choose Two) Mark for Review
(1) Points
abstract
final
protected (*)
public (*)
(1) Points
(1) Points
True (*)
False
Correct Correct
(1) Points
You can use access modifiers to control which other classes can call the constructor. (*)
Since a constructor can not return any value, it should be declared as void.
You can declare more than one constructor in a class declaration. (*)
Correct Correct
13. Which ofthe following declarations are wrong?(Choose Three) Mark for Review
(1) Points
(1) Points
Correct Correct
int x = 1;
int y;
while(++x < 5)
y++;
(1) Points
Section 5
(1) Points
True
False (*)
(1) Points
True
False (*)
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 5 Lesson 2.
4. Unit testing can help you isolate problem quickly. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
5. The main purpose of unit testing is to verify that an individual unit (a class, in Java) is working correctly before it is
combined with other components in the system. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
7. Which of the following is the correct way to throw cumstom ServerException? Mark for Review
(1) Points
throw ServerException
throws ServerException
Correct Correct
8. What symbol(s) is used to separate multiple exceptions in one catch statement? Mark for Review
(1) Points
&&
class Shape{
System.out.print("Circle ");
try{new Circle().paint();}
catch(Exception e){System.out.println("Exception");
(1) Points
Circle
Shape
ShapeCircle
Exception
(1) Points
True (*)
False
Correct Correct
11. Which three types of objects can be thrown using a throw statement? (Choose Three) Mark for Review
(1) Points
Error (*)
Event
Exception (*)
Throwable (*)
Object
12. The instanceof operator can find subclass objects when they are passed to method which declare a superclass type
parameter.
(1) Points
True (*)
False
Correct Correct
13. The instanceof operator allows you to determine the type of an object.
(1) Points
True (*)
False
Correct Correct
14. Which one of the following would allow you to define the abstract class Animal. Mark for Review
(1) Points
public Animal{}
(1) Points
True (*)
False
(1) Points
True
False (*)
Correct Correct
2. Which one of the following would allow you to define an interface for Animal? Mark for Review
(1) Points
(1) Points
True
False (*)
Correct Correct
4. The instanceof operator can find subclass objects when they are passed to method which declare a superclass type
parameter.
(1) Points
True (*)
False
Correct Correct
5. Which method will force a subclass to implement it? Mark for Review
(1) Points
Correct Correct
Section 5
(1) Points
I only
II only
None of these
2. Reading great code is just as important for a programmer as reading great books is for a writer. True or false? Mark
for Review
(1) Points
True (*)
False
Correct Correct
3. Unit testing can help you isolate problem quickly. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
1.try {
5. What is one step you must do to create your own exception? Mark for Review
(1) Points
Correct Correct
. Which statement added at line one allows the code to compile and run?
//line one
System.out.println("Java");
(1) Points
import java.io.OutputStreamWriter
include java.io.*;
import java.io.PrintWriter;
import java.io.*;
Incorrect Incorrect. Refer to Section 5 Lesson 3.
try(inputStream = "missingfile.txt");
catch(exception e);
(1) Points
True
False (*)
(1) Points
9. Virtual method invocation requires that the superclass method is defined as which of the following? Mark for
Review
(1) Points
(1) Points
True (*)
False
Correct Correct
interface Shape {}
(1) Points
Line 2
Line 3 (*)
Line 4
Line 1
Correct Correct
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 5 Lesson 1.
13. In general, classes can be made immutable by placing a final key word before the class keyword.
(1) Points
False
True (*)
Correct Correct
14. The state of an object differentiates it from other objects of the same class.
(1) Points
True (*)
False
Correct Correct
15. Which one of the following would allow you to define an interface for Animal? Mark for Review
(1) Points
Correct Correct
ection 5
(1) Points
Correct Correct
2. Which statements are true when you compile and run this code.(Choose Two)
5. }
7. sayHello("Java");
8. }
(1) Points
The class Test compiles if line 7 is enclosed in a try-catch block. try{ sayHello("Java"); }catch(Exception e){} (*)
Compilation succeeds
(1) Points
True (*)
False
Correct Correct
(1) Points
True (*)
False
try{
String[] s=null;
s[0]="Java";
System.out.println(s[0]);
}catch(Exception e) {
System.out.println("Exception");
}catch(NullPointerException e){
System.out.println("NullPointerException");
(1) Points
NullPointerException
Exception
6. A upward cast means all instance variables of the subclass are permanently lost to the instance.
(1) Points
True
False (*)
7. The instanceof operator can find subclass objects when they are passed to method which declare a superclass type
parameter.
(1) Points
True (*)
False
Correct Correct
8. A downward cast of a superclass to subclass allows you to access a subclass specialized method call.
(1) Points
True (*)
False
Correct Correct
9. You can't downcast an object explicitly because you must use virtual method invocation.
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 5 Lesson 1.
10. Unit testing can help you isolate problem quickly. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
11. Which of the following statements about arrays and ArrayLists in Java are true?
IV. In an ArrayList you need to know the length and the current number of elements stored.
(1) Points
II and IV only
I, II, and III only
None of these
12. Which statement is true for the class java.util.ArrayList? Mark for Review
(1) Points
(1) Points
True
False (*)
(Choose Two)
2. int accountID=100;
(1) Points
(1) Points
True
False (*)
(1) Points
True (*)
False
Correct Correct
3. You can't downcast an object explicitly because you must use virtual method invocation.
(1) Points
True
False (*)
Correct Correct
4. Which method will force a subclass to implement it? Mark for Review
(1) Points
Correct Correct
5. Methods can not throw exceptions.
(1) Points
True
False (*)
(1) Points
None of them execute since you cannot have multiple catch statements.
Incorrect Incorrect. Refer to Section 5 Lesson 3.
7. Which statements are true when you compile and run this code.(Choose Two)
5. }
7. sayHello("Java");
8. }
(1) Points
Compilation succeeds
The class Test compiles if line 6 contains a throws statement. public static void main(String[] args) throws Exception{ (*)
The class Test compiles if line 7 is enclosed in a try-catch block. try{ sayHello("Java"); }catch(Exception e){} (*)
Correct Correct
try(inputStream = "missingfile.txt");
catch(exception e);
(1) Points
True
False (*)
Correct Correct
(1) Points
True (*)
False
Correct Correct
(1) Points
True
False (*)
(1) Points
True
False (*)
Correct Correct
12. Which one of the following would allow you to define an interface for Animal? Mark for Review
(1) Points
Correct Correct
(1) Points
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
(1) Points
Memory occupied by objects with no reference is automatically reclaimed for reuse. (*)
As a Java programmer, we have to call the GC function specifically in order to manage the Java Memory.
Correct Correct
2. Which of the following allows the programmer to destroy an object referenced by x? Mark for Review
(1) Points
x.remove();
x.finalize();
x.delete();
Correct Correct
(1) Points
Correct Correct
4. Java allows the same Java program to be executed on multiple operating systems. Mark for Review
(1) Points
True (*)
False
Correct Correct
5. Which of the following statements describe the Java programming language? Mark for Review
(1) Points
Java is a high-level programming language.
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1
int x;
int y=100;
}
(1) Points
Variable x resides in the stack area, and variable y resides in the heap of the JVM.
Variable x resides in the heap area, and variable y resides in the stack of the JVM (*)
Variable x stays in the heap area, and variable y resides in the method area of the JVM.
Correct Correct
Section 2
7. The javac command can be used to display native code in Java Mark for Review
(1) Points
True
False (*)
Correct Correct
8. Which of the following commands can be used to translate Java source code into bytecode? Mark for Review
(1) Points
java
javac (*)
jdb
jstat
Correct Correct
9. Which of the following statements is NOT TRUE for the jdb command? Mark for Review
(1) Points
jdb can display the source code.
Correct Correct
10. Like in the Java source code file, one Java class file can contain multiple class definitions. Mark for Review
(1) Points
True
False (*)
Correct Correct
Previous Page 2 of 10 Next Summary
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 2
11. Which structure in the Java class file contains the line number information for the original source file? Mark for
Review
(1) Points
method_info (*)
this_class
filed_info
cp_info
Correct Correct
12. The attributes_count item indicates how many attributes are contained within a method. Mark for Review
(1) Points
True (*)
False
Correct Correct
Section 3
13. Which of the following opcode instructions would add 2 integer variables? Mark for Review
(1) Points
add
addi
iadd (*)
Incorrect Incorrect. Refer to Section 3 Lesson 1.
14. Choose which opcode is used to push an int constant 5 onto the operand stack. Mark for Review
(1) Points
iconst_5 (*)
idc5
iload_5
iaload_5
iinc5
Correct Correct
15. opcode invokespecial is used to invoke an instance initialization method. Mark for Review
(1) Points
True (*)
False
16. Which of the following is NOT a java class loader? Mark for Review
(1) Points
Correct Correct
17. The Java developer can define a number of additional or custom classloaders. Mark for Review
(1) Points
True (*)
False
Correct Correct
18. Which of the following exceptions is thrown by the loadClass() method of ClassLoader class? Mark for Review
(1) Points
IOException
SystemException
ClassFormatError
ClassNotFoundException (*)
Correct Correct
Section 4
19. Which three are valid declarations for a float value? (Choose Three) Mark for Review
(1) Points
float f = 3.0L;
float f = 1.0;
Correct Correct
20. What is the final value of result from the following code snippet?
int i = 1;
(1) Points
The code will compile, result has the value of 0
An exception is thrown.
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 4
System.out.println( str1==str2.intern() );
(1) Points
Correct Correct
int[] myarray={1,2,3,4,5};
int sum=0;
sum+=x;
10
15 (*)
20
Correct Correct
public Student(){
studentId++;
return studentId;
}
}
System.out.println(Student.getStudentId());
(1) Points
Correct Correct
24. Which ofthe following declarations are wrong?(Choose Three) Mark for Review
(1) Points
(Choose all correct answers)
Correct Correct
25. Which of the following types are primitive data types? (Choose Two) Mark for Review
(1) Points
String
boolean (*)
double (*)
Integer
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
(1) Points
True
False (*)
Correct Correct
27. You can only implement one interface in a class.
(1) Points
True
False (*)
Correct Correct
(1) Points
Correct Correct
29. Modeling classes for a business problem requires understanding of the business not Java. True or false? Mark for
Review
(1) Points
True
False (*)
Correct Correct
(1) Points
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
(1) Points
True
False (*)
Correct Correct
1 class Account {
4}
10 account.deposit(10);
11 }
(1) Points
line 7 (*)
line 2
line 3
line 6
Correct Correct
33. You can always upcast a subclass to an interface provided you don't need to access any members of the concrete
class.
(1) Points
True (*)
False
Correct Correct
34. Which two of the following statements are true? (Choose Two) Mark for Review
(1) Points
Correct Correct
(1) Points
True (*)
False
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
36. Virtual method invocation must be defined with the instanceof operator.
(1) Points
True
False (*)
Correct Correct
37. You can't downcast an object explicitly because you must use virtual method invocation.
(1) Points
True
False (*)
Correct Correct
38. Which of the following is the correct way to throw cumstom ServerException? Mark for Review
(1) Points
throw ServerException
throws ServerException
raise ServerException
Correct Correct
(1) Points
try{
String[] s=null;
s[0]="Java";
System.out.println(s[0]);
}catch(Exception e) {
System.out.println("Exception");
}catch(NullPointerException e){
System.out.println("NullPointerException");
(1) Points
Exception
NullPointerException
Java
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
41. Which statements are true when you compile and run this code.(Choose Two)
5. }
8. }
(1) Points
The class Test compiles if line 7 is enclosed in a try-catch block. try{ sayHello("Java"); }catch(Exception e){} (*)
Compilation succeeds
The class Test compiles if line 6 contains a throws statement. public static void main(String[] args) throws Exception{ (*)
Correct Correct
42. The finally clause only executes when an exception is not caught and thrown.
(1) Points
True
False (*)
Correct Correct
43. In what order do multiple catch statements execute? Mark for Review
(1) Points
None of them execute since you cannot have multiple catch statements.
Correct Correct
(1) Points
True
False (*)
Correct Correct
(1) Points
I only
II only
None of these
Correct Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 5
46. The main purpose of unit testing is to verify that an individual unit (a class, in Java) is working correctly before it is
combined with other components in the system. True or false? Mark for Review
(1) Points
True (*)
False
Correct Correct
47. Why is it helpful for new programmers to read pre-written code?(Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
Correct Correct
(1) Points
In an Array you need to know the length and the current number of elements stored.
An ArrayList can grow and shrink dynamically as required.
Correct Correct
49. Which of the following statements about unit testing is/are true
I. When all unit tests succeed, you can have high confidence your code is solid.
II. If a unit test fails, you don メ t proceed until the code is fixed and the test succeeds.
III. Unit testing can help developer find problems early in the development cycle
(1) Points
I only
I and II only
None of these
Correct Correct
50. Which of the following statements about arrays and ArrayLists in Java are true?
IV. In an ArrayList you need to know the length and the current number of elements stored.
(1) Points
II and IV only
None of these
14. Why is it helpful for new programmers to read pre-written code?(Choose Two) Mark for Review
(1) Points
15. Which of the following statements about inheritance is false? Mark for Review
(1) Points
A subclass inherits all the members (fields, methods, and nested classes) from its superclass.
Inheritance allows you to reuse the fields and methods of the super class without having to write them yourself.
Inheritance allows you to minimize the amount of duplicate code in an application by sharing common code among
several subclasses.
Through inheritance, a parent class is a more specialized form of the child class. (*)
Incorrect Incorrect. Refer to Section 5 Lesson 4.
Section 6
(1) Points
True (*)
False
Correct Correct
2. Which of the following is a list of elements that have a first in last out ordering. Mark for Review
(1) Points
Arrays
HashMaps
Enums
Stacks (*)
(1) Points
True
False (*)
(1) Points
Something that enables you to create a generic class without specifying a type between angle brackets <>.
interface Shape {}
ls.add(c); // Line 3
lc.add(c); // Line 4
(1) Points
Line 2
Line 4
Line 1
Line 3 (*)
6. Which class is an ordered collection that may contain duplicates? Mark for Review
(1) Points
list (*)
enum
set
array
7. The following code is valid when working with the Collection Interface.
Collection collection = new Collection()d;
(1) Points
True
False (*)
Correct Correct
li.add(1);
li.add(2);
print(li);
(1) Points
1
The code will not compile.
1 2 (*)
(1) Points
True (*)
False
Correct Correct
10. What is the correct definition of Enumeration (or enum)? Mark for Review
(1) Points
Code that initializes an ArrayList
A keyword that specifies a class whose objects are defined inside the class. (*)
11. Which of the following would initialize a generic class "Cell" using a String type?
(1) Points
I and II (*)
II only
II and III
I only
III only
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
(1) Points
Sequential Search
Selection Sort
Binary Search
14. Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
(1) Points
True
False (*)
15. A sequential search is an iteration through the array that stops at the index where the desired element is found.
(1) Points
True (*)
False
Correct Correct
Section 6
interface Shape {}
ls.add(c); // Line 3
lc.add(c); // Line 4
(1) Points
Line 3 (*)
Line 4
Line 1
Line 2
Correct Correct
(1) Points
{1, 1, 2, 22, 305, 26} because a set may contain duplicates and all its elements are of the same type.
{"Apple", 1, "Carrot", 2} because it records the index of the elements with following integers.
{1, 2, 5, 178, 259} because it contains no duplicates and all its elements are of the same type. (*)
All of the above are sets because they are collections that can be made to fit any of the choices.
3. Which code inserted into the code below guarantees that the program will output [1,2]?
import java.util.*;
set.add(2);
set.add(1);
System.out.println(set);
(1) Points
4. Big-O Notation is used in Computer Science to describe the performance of Sorts and Searches on arrays. True or
false? Mark for Review
(1) Points
True (*)
False
Correct Correct
(1) Points
True
False (*)
6. Which of the following sorting algorithms utilizes a "divide and conquer" technique to sort arrays with optimal speed?
Mark for Review
(1) Points
Sequential Search
Selection Sort
Binary Search
(1) Points
True (*)
False
Correct Correct
8. Enumerations (enums) are useful for storing data : Mark for Review
(1) Points
(1) Points
True
False (*)
Correct Correct
(1) Points
True
False (*)
Correct Correct
True or False?
class Test{
Comparable com=nc;
(1) Points
True (*)
False
Correct Correct
(1) Points
A pile of pancakes with which you add some to the top and remove them one by one from the top to the bottom. (*)
A row of books that you can take out of only the middle of the books first and work your way outward toward either
edge.
A line at the grocery store where the first person in the line is the first person to leave.
13. Where you enqueue an element in the list? Mark for Review
(1) Points
(1) Points
True (*)
False
Correct Correct
(1) Points
True (*)
False
Correct Correct
(1) Points
True
False (*)
5. What is special about including a resource in a try statement?(Choose Two) Mark for Review
(1) Points
6. Why should you not use assertions to check parameters? Mark for Review
(1) Points
Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
Not all methods have parameters, therefore assertions should never be used on parameters.
15. When an object is able to pass on its state and behaviors to its children, this is called: Mark for Review
(1) Points
Inheritance (*)
Encapsulation
Polymorphism
Isolation
Email This
BlogThis!
Share to Twitter
Share to Facebook
Share to Pinterest
84 comments:
ArrayList (*)
ArrayList
ArrayList
ArrayList
When you already know all the possibilities for objects of that class. (*)
When you want to be able to create any number of objects of that class.
True
False (*)
5.Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
True
False (*)
True (*)
False
8. Which of the following sorting algorithms utilizes a "divide and conquer" technique to sort arrays with optimal speed?
Sequential Search
Selection Sort
Binary Search
vegetables[0] = "Cabbage";
vegetables += "Cabbage";
vegetables.get("Cabbage");
vegetables.add("Cabbage"); (*)
java.util.Map
java.util.List
java.util.Collection (*)
java.util.Collections
Something that enables you to create a generic class without specifying a type between angle brackets <>.
12. To allow our classes to have a natural order we could implement the Comparable interface.
True or false?
True (*)
False
13.Which of the following is a list of elements that have a first in last out ordering.
Stacks (*)
HashMaps
Enums
Arrays
Because you can remove elements from the beginning of it. (*)
A pile of pancakes with which you add some to the top and remove them one by one from the top to the bottom. (*)
A row of books that you can take out of only the middle of the books first and work your way outward toward either
edge.
A line at the grocery store where the first person in the line is the first person to leave.
Reply
Replies
16. A generic class is a type of class that associates one or more non-specific Java types with it.
True or False?
True (*)
False
17.The local petting zoo is writing a program to be able to collect group animals according to species to better keep track
of what animals they have.
Which of the following correctly defines a collection that may create these types of groupings for each species at the
zoo?
public class
public class
animalCollection(AnimalType T) {ナ}
public class
animalCollection {ナ}
public class
animalCollection(animalType) {ナ}
list1.add(new Gum());
list2.add(new Integer(9));
System.out.println(list2.size());
2 (*)
True or false?
True (*)
False
20.Which statements, inserted it at line 2, will ensure that the code snippet will compile successfully.(Choose Two):
1.public static void main (String[]args) {
4.}
HashSet classMates =
HashSet();
String classMates = new
String();
It enables you to create a generic class without specifying a type between angle brackets <>.
It is an interface in the java.util package that is used to define a group of objects. (*)
It is a special type of class that is associated with one or more non-specified Java type.
It is a subclass of List.
23.Which of the following is a sorting algorithm that involves repeatedly incrementing through the array and swapping 2
adjacent values if they are in the wrong order until all elements are in the correct order?
Merge Sort
Bubble Sort (*)
Binary Search
Sequential Search
Selection Sort
Reply
Section 7
1. What is the correct explanation of when this code will return true?
(1) Points
Any time that str has between zero and nine characters followed by a 6.
Any time str contains a 6.
Always.
2. Which of the following methods for the String class take a regular expression as a parameter and returns true if the
string matches the expression? Mark for Review
(1) Points
compareTo(String regex)
equals(String regex)
equalsIgnoreCase(String regex)
3. What is the function of the asterisk (*) in regular expressions? Mark for Review
(1) Points
Indicates that the preceding character may occur 0 or 1 times in a proper match.
Indicates that the preceding character may occur 0 or more times in a proper match. (*)
Indicates that the preceding character may occur 1 or more times in a proper match.
(1) Points
A class in the java.util.regex package that stores the format of a regular expression.
A class in the java.util.regex package that stores the matches between a pattern and a string. (*)
Correct
5. Matcher has a find method that checks if the specified pattern exists as a sub-string of the string being matched.
(1) Points
True (*)
False
Correct
(1) Points
A class in the java.util.regex package that stores the format of a regular expression. (*)
7. Which of the following correctly initializes a Matcher m for Pattern p and String str? Mark for Review
(1) Points
Matcher m = str.matcher(p);
8. A linear recursion requires the method to call which direction? Mark for Review
(1) Points
Forward
Backward (*)
Both forward and backward
9. Which case does a recursive method call last? Mark for Review
(1) Points
Recursive Case
Convergence Case
Basic Case
Correct
10. A non-linear recursive method is less expensive than a linear recursive method. True or false? Mark for Review
(1) Points
True
False (*)
Correct
Reply
Replies
11. A non-linear recursive method calls how many copies of itself in the recursive case? Mark for Review
(1) Points
2 or more (*)
Correct
12. Using the FOR loop method of incrementing through a String is beneficial if you desire to: (Choose all that apply)
Mark for Review
(1) Points
Read the String backwards (from last element to first element). (*)
13. Split is a method for Strings that parses a string by a specified character, or, if unspecified, by spaces, and returns the
parsed elements in an array of Strings.
(1) Points
True
False (*)
Correct
14. Which of the following correctly initializes a StringBuilder? Mark for Review
(1) Points
StringBuilder sb = StringBuilder(500);
15. Which of the following are true about the method split? Mark for Review
(1) Points
1. Matcher has a find method that checks if the specified pattern exists as a sub-string of the string being matched.
(1) Points
True (*)
False
2. Which of the following methods for the String class take a regular expression as a parameter and returns true if the
string matches the expression? Mark for Review
(1) Points
compareTo(String regex)
equals(String regex)
equalsIgnoreCase(String regex)
Reply
3. Which of the following does not correctly match the regular expression symbol to its proper function? Mark for
Review
(1) Points
"{x}" means there must be x occurrences of the preceding character in the string to be a match.
"?" means there may be zero or one occurrences of the preceding character in the string to be a match.
"+" means there may be zero or more occurrences of the preceding character in the string to be a match. (*)
"{x,}" means there may be x or more occurrences of the preceeding character in the string to be a match.
"{x,y}" means there may be between x and y occurrences of the preceding character in the string to be a match.
4. Consider designing a program that organizes your contacts alphabetically by last name, then by first name. Oddly, all
of your contacts' first and last names are exactly five letters long.
Which of the following segments of code establishes a Pattern namePattern with a group for the first name and a group
for the last name considering that the string contactsName is always in the format lastName_firstName? Mark for
Review
(1) Points
5. The following code correctly initializes a pattern with the regular expression "[0-9]{2}/[0-9]{2}/[0-9]{2}".
(1) Points
True (*)
False
6. In a regular expression, {x} and {x,} represent the same thing, that the preceding character may occur x or more times
to create a match.
(1) Points
True
False (*)
Correct
7. What is the correct explanation of when this code will return true?
(1) Points
Any time that str has between zero and nine characters followed by a 6.
Always.
8. Using the FOR loop method of incrementing through a String is beneficial if you desire to: (Choose all that apply) Mark
for Review
(1) Points
Read the String backwards (from last element to first element). (*)
9. Which of the following are true about the method split? Mark for Review
(1) Points
10. Identify the method, of those listed below, that is not available to both StringBuilders and Strings? Mark for Review
(1) Points
length()
indexOf(String str)
charAt(int index)
Reply
11. Which of the following methods are specific to StringBuilders? Mark for Review
(1) Points
append
delete
insert
replace
12. A non-linear recursive method can call how many copies of itself? Mark for Review
(1) Points
2 or more (*)
None
Correct
13. The base case condition can work with a constant or variable. True or false? Mark for Review
(1) Points
True (*)
False
14. Forward thinking helps when creating linear recursive methods. True or false? Mark for Review
(1) Points
True
False (*)
Correct
15. A linear recursive method directly calls how many copies of itself in the recursive case? Mark for Review
(1) Points
0
1 (*)
2 or more
1. Which of the following correctly initializes a Matcher m for Pattern p and String str? Mark for Review
(1) Points
Matcher m = str.matcher(p);
2. What is the correct explanation of when this code will return true?
Any time that str has between zero and nine characters followed by a 6.
Always.
3. Your teacher asks you to write a segment of code that returns true if String str contains zero or one character(s) and
false otherwise. Which of the following code segments completes this task? Mark for Review
(1) Points
return str.contains(".");
return str.matches("[a-z]*");
4. In a regular expression, {x} and {x,} represent the same thing, that the preceding character may occur x or more times
to create a match.
(1) Points
True
False (*)
Correct
5. Consider designing a program that organizes your contacts alphabetically by last name, then by first name. Oddly, all
of your contacts' first and last names are exactly five letters long.
Which of the following segments of code establishes a Pattern namePattern with a group for the first name and a group
for the last name considering that the string contactsName is always in the format lastName_firstName? Mark for
Review
(1) Points
Reply
6. The following code correctly initializes a pattern with the regular expression "[0-9]{2}/[0-9]{2}/[0-9]{2}".
(1) Points
True (*)
False
7. Matcher has a find method that checks if the specified pattern exists as a sub-string of the string being matched.
(1) Points
True (*)
False
8. A non-linear recursive method is less expensive than a linear recursive method. True or false? Mark for Review
(1) Points
True
False (*)
Correct
9. Which case handles the last recursive call? Mark for Review
(1) Points
10. A non-linear recursive method is less expensive than a linear recursive method. True or false? Mark for Review
(1) Points
True
False (*)
11. A linear recursive method directly calls how many copies of itself in the recursive case? Mark for Review
(1) Points
1 (*)
2 or more
12. Which of the following are true about the method split? Mark for Review
(1) Points
Reply
13. Using the FOR loop method of incrementing through a String is beneficial if you desire to: (Choose all that apply)
Mark for Review
(1) Points
Read the String backwards (from last element to first element). (*)
14. Which of the following correctly initializes a StringBuilder? Mark for Review
(1) Points
StringBuilder sb = StringBuilder(500);
15. Which of the following are true about parsing a String? Mark for Review
(1) Points
(1) Points
(1) Points
Read the String backwards (from last element to first element). (*)
3. What class is the split() method a member of? Mark for Review
(1) Points
Parse
String (*)
Array
StringBuilder
Correct
4. Split is a method for Strings that parses a string by a specified character, or, if unspecified, by spaces, and returns the
parsed elements in an array of Strings.
(1) Points
True
False (*)
Correct
5. Your teacher asks you to write a segment of code that returns true if String str contains zero or one character(s) and
false otherwise. Which of the following code segments completes this task? Mark for Review
(1) Points
return str.matches("[a-z]*");
if( str.length() == 0 || str.length() == 1)
{ return true;}
return str.contains(".");
Reply
Replies
6. Consider designing a program that organizes your contacts alphabetically by last name, then by first name. Oddly, all
of your contacts' first and last names are exactly five letters long.
Which of the following segments of code establishes a Pattern namePattern with a group for the first name and a group
for the last name considering that the string contactsName is always in the format lastName_firstName? Mark for
Review
(1) Points
7. What does the dot (.) represent in regular expressions? Mark for Review
(1) Points
(1) Points
True (*)
False
9. A regular expression is a character or a sequence of characters that represent a string or multiple strings.
(1) Points
True (*)
False
10. Consider that you are writing a program for analyzing feedback on the video game you have developed. You have
completed everything except the segment of code that checks that the user's input, String userI, is a valid rating. Note
that a valid rating is a single digit between 1 and 5 inclusive. Which of the following segments of code returns true if the
user's input is a valid rating? Mark for Review
(1) Points
return userI.matches("{1-5}");
return userI.matches("[1-5].*");
11. Which of the following correctly defines a repetition operator? Mark for Review
(1) Points
Any symbol in regular expressions that indicates the number of occurrences a specified character appears in a matching
string. (*)
None of the above.
12. A non-linear recursive method is less expensive than a linear recursive method. True or false? Mark for Review
(1) Points
True
False (*)
13. Forward thinking helps when creating linear recursive methods. True or false? Mark for Review
(1) Points
True
False (*)
Correct
14. A linear recursive method can call how many copies of itself? Mark for Review
(1) Points
1 (*)
2 or more
None
15. Which case does a recursive method call last? Mark for Review
(1) Points
Recursive Case
Convergence Case
Basic Case
Reply
Section 8
1. Which of the following is an attribute of a three tier architecture application? Mark for Review
(1) Points
(1) Points
True (*)
False
3. The method for connecting a Java application to a database is by using: Mark for Review
(1) Points
jar files
JNLP
JDBC (*)
4. Which of the following is not a reason to use a Java package? Mark for Review
(1) Points
It is a way to help resolve naming conflicts when different packages have classes with the same names.
(1) Points
True (*)
False
Correct
6. How would you make an instance of Car in a class that didn't import the vehicle package below?
(1) Points
Correct
7. How would you make an instance of Car in a class that did import the vehicle package below?
(1) Points
8. Which of the following is an attribute of a two tier architecture application? Mark for Review
(1) Points
9. Which of the following are files that must be uploaded to a web server to deploy a java application/applet? Mark for
Review
(1) Points
.java files
10. If a class is in a package, the system's CLASSPATH must be altered to access the class.
(1) Points
True
False (*)
Correct
11. An example of two tier architecture would be a client application working with a server application.
(1) Points
True (*)
False
True
False (*)
Correct
13. If a programmer uses the line import com.test.*, there is no need to import com.test.code.*
(1) Points
True
False (*)
Reply
Replies
14. Which of the following files are not required to be uploaded to a web server to deploy a java application/applet?
Mark for Review
(1) Points
jar files
JNLP files
html files
15. What option do you choose from the File menu in Eclipse to start the process of creating a runnable JAR file? Mark
for Review
(1) Points
Import
Export (*)
Switch Workspace
Properties
Incorrect. Refer to Section 4 Lesson 1.
(1) Points
True (*)
False
2. If a programmer uses the line import com.test.*, there is no need to import com.test.code.*
(1) Points
True
False (*)
Correct
3. A jar file is built on the ZIP file format and is used to deploy java applets.
True or false? Mark for Review
(1) Points
True (*)
False
Correct
(1) Points
True (*)
False
5. An example of two tier architecture would be a client application working with a server application.
(1) Points
True (*)
False
6. Which of the following is not a reason to use a Java package? Mark for Review
(1) Points
It is a way to help resolve naming conflicts when different packages have classes with the same names.
Correct
7. What option do you choose from the File menu in Eclipse to start the process of creating a runnable JAR file? Mark for
Review
(1) Points
Properties
Import
Switch Workspace
Export (*)
8. How would you make an instance of Car in a class that did import the vehicle package below?
(1) Points
9. Which of the following is an attribute of a three tier architecture application? Mark for Review
(1) Points
Correct
(1) Points
True
False (*)
11. Which of the following are files that must be uploaded to a web server to deploy a java application/applet? Mark for
Review
(1) Points
.java files
(1) Points
13. If a class is in a package, the system's CLASSPATH must be altered to access the class.
(1) Points
True
False (*)
Correct
14. Which of the following is an attribute of a two tier architecture application? Mark for Review
(1) Points
15. The method for connecting a Java application to a database is by using: Mark for Review
(1) Points
jar files
JNLP
JDBC (*)
Correct
1. A jar file is built on the ZIP file format and is used to deploy java applets.
(1) Points
True (*)
False
2. An example of two tier architecture would be a client application working with a server application.
(1) Points
True (*)
False
3. Which of the following is an attribute of a two tier architecture application? Mark for Review
(1) Points
Correct
4. Which of the following are files that must be uploaded to a web server to deploy a java application/applet? Mark for
Review
(1) Points
(Choose all correct answers)
.java files
5. How would you make an instance of Car in a class that didn't import the vehicle package below?
(1) Points
Correct
6. Which of the following is an attribute of a three tier architecture application? Mark for Review
(1) Points
7. The method for connecting a Java application to a database is by using: Mark for Review
(1) Points
jar files
JNLP
JDBC (*)
Correct
8. If a class is in a package, the system's CLASSPATH must be altered to access the class.
(1) Points
True
False (*)
Correct
9. Which of the following files are not required to be uploaded to a web server to deploy a java application/applet? Mark
for Review
(1) Points
jar files
JNLP files
html files
Correct
10. If a programmer uses the line import com.test.*, there is no need to import com.test.code.*
(1) Points
True
False (*)
Correct
11. What option do you choose from the File menu in Eclipse to start the process of creating a runnable JAR file? Mark
for Review
(1) Points
Switch Workspace
Import
Properties
Export (*)
(1) Points
True (*)
False
Correct
13. Which of the following is not a reason to use a Java package? Mark for Review
(1) Points
It is a way to help resolve naming conflicts when different packages have classes with the same names.
(1) Points
True (*)
False
Correct
15. How would you make an instance of Car in a class that did import the vehicle package below?
(1) Points
(1) Points
InputStream
FilterInputStream (*)
PipedInputStream
InputStream
FileInputStream
[Correct] Correct
12.The Files class provides a instance method that creates a new BufferedReader.
(1) Points
True (*)
False
[Correct] Correct
13.The BufferedOutputStream is a direct subclass of what other class? Mark for Review
(1) Points
PrintStream
DigestOutputStream
FilterOutputStream (*)
OutputStream
ObjectOutputStream
[Correct] Correct
14.Which of the following static methods is not provided by the Files class to check file properties or duplication? Mark
for Review
(1) Points
Files.isWritable(Path p);
Files.isReadable(Path p);
Files.isHidden(Path p);
[Correct] Correct
15.The Paths class provides a static get() method to find a valid Path.
(1) Points
True (*)
False
[Correct] Correct
Reply
Section 9
1. Which of the following can fill in the //INSERT HERE correctly? (Choose Two)
if(rs.next()){
//INSERT HERE
(1) Points
String s = rs.getString(1);
String s = rs.getObject(0);
String s = rs.getString(0);
2. JDBC has a type system that can control the conversion between Oracle database types and Java types. Mark for
Review
(1) Points
True (*)
False
3. From JDBC, how would you execute DML statements (i.e. insert, delete, update) in the database? Mark for Review
(1) Points
By invoking the execute(...) or executeUpdate(...) method of a JDBC Statement object or sub-interface object (*)
By invoking the DeleteStatement or UpdateStatement JDBC object
4. Which type of Statement can execute parameterized queries? Mark for Review
(1) Points
ParameterizedStatement
PreparedStatement (*)
5. Which of the following is the correct statement be inserted at //INSERT CODE location that calls the database-stored
procedure sayHello?
class Test{
try {
Connection conn = getConnection();
//INSERT CODE
cstat.setString(1, "Hello");
cstat.registerOutParameter(2, Types.NUMERIC);
cstat.setInt(2, 10);
catch(SQLException e){}
(1) Points
rset.absolute(1);
rset.next();
System.out.println(rset.getString(1));
(1) Points
B (*)
A SQLException is thrown.
7. Which symbol is used as a placeholder to pass parameters to a PreparedStatement or CallableStatement? Mark for
Review
(1) Points
!
? (*)
8. Which of the following methods will move the cursor, returning a Boolean value from the ResultSet Object? Mark for
Review
(1) Points
beforeFirst() (*)
absolute()
afterFirst()
afterLast()
beforeLast()
9. Which of the following is the correct order to close the database object? Mark for Review
(1) Points
10. Which of the following classes or interfaces are included in the database vendor driver library? (Choose two) Mark
for Review
(1) Points
Java.sql.Connection
Javax.sql.DataSource
Java.sql.DriverManager implementation
Reply
Replies
11. Which of the following is NOT a JDBC interface used to execute SLQ statements? Mark for Review
(1) Points
Statement Interface
PreparedStatement Interface
CallableStatement Interface
12. You must explicitly close ResultSet and Statement objects once they are no longer in use. Mark for Review
(1) Points
True (*)
False
13.How many categories of JDBC drivers are there? Mark for Review
(1) Points
1
2
4 (*)
14.What type of JDBC driver will convert the database invocation directly into network protocol? Mark for Review
(1) Points
Type 1 driver
Type 2 driver
Type 3 driver
15.To execute a stored SQL procedure, which JDBC interface should be used? Mark for Review
(1) Points
Statement Interface
PreparedStatement Interface
PrePreparedStatement Interface
1. Which of the following can fill in the //INSERT HERE correctly? (Choose Two)
if(rs.next()){
//INSERT HERE
(1) Points
String s = rs.getString(1);
String s = rs.getObject(0);
String s = rs.getString(0);
2. Suppose that you have a table EMPLOYEES with three rows. The first_name in those rows are A, B, and C. What does
the following output?
rset.absolute(1);
rset.next();
System.out.println(rset.getString(1));
(1) Points
B (*)
C
The code does not compile.
A SQLException is thrown.
3. Which type of Statement can execute parameterized queries? Mark for Review
(1) Points
ParameterizedStatement
PreparedStatement (*)
4. Which the following statements is NOT TRUE about DataSource? Mark for Review
(1) Points
DataSource can manage a set of JDBC Drivers registered in the system. (*)
5. JDBC has a type system that can control the conversion between Oracle database types and Java types. Mark for
Review
(1) Points
True (*)
False
6. Which of the following methods will move the cursor, returning a Boolean value from the ResultSet Object? Mark for
Review
(1) Points
beforeFirst() (*)
absolute()
afterFirst()
afterLast()
beforeLast()
7. Which symbol is used as a placeholder to pass parameters to a PreparedStatement or CallableStatement? Mark for
Review
(1) Points
? (*)
#
8. From JDBC, how would you execute DML statements (i.e. insert, delete, update) in the database? Mark for Review
(1) Points
By invoking the execute(...) or executeUpdate(...) method of a JDBC Statement object or sub-interface object (*)
(1) Points
oracle:thin:localhost@dfot/dfot:1521:xe
jdbc::oracle-thin:dfot/dfot@oracle:1521:xe
jdbc:oracle:thin:dfot/dfot@localhost:1521:xe (*)
oracle:thin:jdbc:dfot/dfot@localhost:1521:xe
10. To execute a stored SQL procedure, which JDBC interface should be used? Mark for Review
(1) Points
Statement Interface
PreparedStatement Interface
PrePreparedStatement Interface
11. Which of the following is the correct order to close the database object? Mark for Review
(1) Points
ResultSet, Statement, Connection (*)
12. The java.sql.DriverManager class will typically be registered with a naming service based on the Java Naming
Directory (JNDI) API. Mark for Review
(1) Points
True
False (*)
13. How many categories of JDBC drivers are there? Mark for Review
(1) Points
4 (*)
14. Given the following code, assume there are rows of data in the table EMP. What is the result?
4 if(rs.next()){
5 System.out.println(rs.getInt(1));
(1) Points
15.You must explicitly close ResultSet and Statement objects once they are no longer in use. Mark for Review
(1) Points
True (*)
False
Reply
1.A sequential search is an iteration through the array that stops at the index where the desired element is found.
(1) Points
True (*)
False
2.Bubble Sort is a sorting algorithm that involves swapping the smallest value into the first index, finding the next
smallest value and swapping it into the next index and so on until the array is sorted.
(1) Points
True
False (*)
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
4.Which of the following is a sorting algorithm that involves repeatedly incrementing through the array and swapping 2
adjacent values if they are in the wrong order until all elements are in the correct order? Mark for Review
(1) Points
Sequential Search
Merge Sort
Binary Search
Selection Sort
5.Binary searches can be performed on sorted and unsorted data.
(1) Points
True
False (*)
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
7.Big-O Notation is used in Computer Science to describe the performance of Sorts and Searches on arrays. True or
false? Mark for Review
(1) Points
True (*)
False
(1) Points
True
False (*)
(1) Points
Fast In Fast Out
(1) Points
True (*)
False
Reply
Replies
(1) Points
True (*)
False
(1) Points
True (*)
False
13.Which of the following is a list of elements that have a first in last out ordering. Mark for Review
(1) Points
Stacks (*)
Arrays
Enums
HashMaps
14.Which class is an ordered collection that may contain duplicates? Mark for Review
(1) Points
enum
set
array
list (*)
15.Which of the following correctly adds "Cabbage" to the ArrayList vegetables? Mark for Review
(1) Points
vegetables.get("Cabbage");
vegetables += "Cabbage";
vegetables[0] = "Cabbage";
vegetables.add("Cabbage"); (*)
16. ArrayList and Arrays both require you to define their size before use.
(1) Points
True
False (*)
(1) Points
{1, 1, 2, 22, 305, 26} because a set may contain duplicates and all its elements are of the same type.
{"Apple", 1, "Carrot", 2} because it records the index of the elements with following integers.
{1, 2, 5, 178, 259} because it contains no duplicates and all its elements are of the same type. (*)
All of the above are sets because they are collections that can be made to fit any of the choices.
(1) Points
HashSet();
String();
HashSet classMates =
new HashSet(); (*)
(1) Points
ArrayList
ArrayList
ArrayList
ArrayList (*)
(1) Points
True
False (*)
True or False?
class Test{
Comparable com=nc;
(1) Points
True (*)
False
22.< ? extends Animal > would only allow classes or subclasses of Animal to be used.
(1) Points
True (*)
False
(1) Points
A concreate method.
A generic class
A generic instance
list2.add(new Integer(9));
System.out.println(list2.size());
(1) Points
2 (*)
25.Matcher has a find method that checks if the specified pattern exists as a sub-string of the string being matched.
(1) Points
True (*)
False
26.Square brackets are a representation for any character in regular expressions "[ ]".
(1) Points
True
False (*)
(1) Points
A class in the java.util.regex package that stores the format of a regular expression. (*)
(1) Points
(1) Points
StringBuilder sb = StringBuilder(500);
str += 23;
System.out.print(str);
(1) Points
9120423 (*)
91227
Compile fails.
23
91204
(1) Points
(1) Points
True (*)
False
33.A non-linear recursive method can call how many copies of itself? Mark for Review
(1) Points
2 or more (*)
None
34.Consider the following recursive method recur(x, y). What is the value of recur(4, 3)?
if (x == 0) {
return y;
(1) Points
12
10
13 (*)
35.A linear recursion requires the method to call which direction? Mark for Review
(1) Points
Forward
Backward (*)
import com.test.code.*
(1) Points
True
False (*)
37.An example of two tier architecture would be a client application working with a server application.
(1) Points
True (*)
False
(1) Points
True
False (*)
39.Prior to Java 7, you write to a file with a call to the BufferedWriter class's write() method.
(1) Points
True (*)
False
(1) Points
True (*)
False
UnknownDecember 21, 2018 at 8:15 AM
(1) Points
A BufferedReader stream
A Reader stream
A BufferedWriter stream
A PrintStream
An InputStream (*)
(1) Points
True (*)
False
43.To execute a stored SQL procedure, which JDBC interface should be used? Mark for Review
(1) Points
Statement Interface
PreparedStatement Interface
PrePreparedStatement Interface
44.Which of the following classes or interfaces are included in the database vendor driver library? (Choose two) Mark for
Review
(1) Points
Javax.sql.DataSource
Java.sql.DriverManager implementation
45.How many categories of JDBC drivers are there? Mark for Review
(1) Points
4 (*)
46.Given the following code, assume there are rows of data in the table EMP. What is the result?
4 if(rs.next()){
5 System.out.println(rs.getInt(1));
(1) Points
47.Suppose that you have a table EMPLOYEES with three rows. The first_name in those rows are A, B, and C. What does
the following output?
String sql = "select first_name from Employees order by first_name desc";
rset.absolute(1);
rset.next();
System.out.println(rset.getString(1));
(1) Points
B (*)
A SQLException is thrown.
48.From JDBC, how would you execute DML statements (i.e. insert, delete, update) in the database? Mark for Review
(1) Points
By invoking the execute(...) or executeUpdate(...) method of a JDBC Statement object or sub-interface object (*)
49.Which symbol is used as a placeholder to pass parameters to a PreparedStatement or CallableStatement? Mark for
Review
(1) Points
? (*)
#
50.JDBC has a type system that can control the conversion between Oracle database types and Java types. Mark for
Review
(1) Points
True (*)
False
Reply
11.Bytecode contains different opcodes for every type of loop written in source code.
True
False (*)
Reply
Replies
3.Class Object is the root of the Java class hierarchy. True or False?
True (*)
False
UnknownDecember 21, 2018 at 10:45 AM
Every time you would like to assign a new value to a variable that is being asserted.
7.The instanceof operator enables to discover the type of object it was invoked upon.
True or false?
True (*)
False
8.Java provides virtual method invocation as a feature and it doesn't require specialized coding.
True or false?
True (*)
False
istore
idc
pop
bipush
getfield (*)
26.Arrays have built-in operations including add, clear, contains, get and remove. True or false?
True
False (*)
27.In the relationship between two objects, the class that is being inherited from is called the maxi-class. True or false?
True
False (*)
30. Which of the following is not a good technique to follow when reading code written by others?
Perform testing.
Find the author of the code and ask him how it works. (*)
Learn the high level structure and starting point, and then figure out how it branches.
31. Which of the following are important to your survival as a programmer?
44.The instanceof operator works with class instances and primitive data types.
True or false?
True
False (*)
True or False?
True (*)
False
True or False?
True
False (*)
8.Which sort algorithm was used to sort the char array {'M', 'S', 'A', 'T', 'H'}?
Sequential Search
Binary Search
Merge Sort
Selection Sort
It implements a stack.
Allows for insertion or deletion of elements from the first element added or the last one.
True or false?
True (*)
False
True or false?
True
False (*)
delete
insert
replace
Read the String backwards (from last element to first element). (*)
4. Which of the following methods can be used to replace a segment in a string with a new string?
replaceAll(String newString)
substring(int start, int end, String newString)
None of the above. There is no replaceAll(String newString) method with one argument.
9. Consider that you are making a calendar and decide to write a segment of code that returns true if the string month is
April, May, June, or July. Which code segment correctly implements use of regular expressions to complete this task?
return month.substring(0,3);
return month.matches("April"|"May"|"June"|"July");
Reply
C:\Users\UserName\data (*)
data
\Users\UserName\data
/home/user/username
2. The way that you read from a file has changed since the introduction of Java 7.
(1) Points
True (*)
False
True
False (*)
4. The new Paths class lets you resolve .. (double dot) path notation.
True or false?
True (*)
False
5. An absolute path always starts from the drive letter or mount point.
True (*)
False
Reply
Replies
6. Which of the following are files that must be uploaded to a web server to deploy a Java application/applet?(Choose
Three)
.java files
7. A jar file is built on the ZIP file format and is used to deploy java applets.
True or false?
True (*)
False
True or false?
True (*)
False
import com.test.*,
import com.test.code.*
True or false?
True
False (*)
10. Which of the following files are not required to be uploaded to a web server to deploy a JWS java
application/applet?
jar files
JNLP files
html files
A BufferedReader stream
A Reader stream
A BufferedWriter stream
An OutputStream
A PrintStream (*)
True or false?
True (*)
False
13. Which of the following static methods is not provided by the Files class to check file properties or duplication?
Files.isReadable(Path p);
Files.isArchived(Path p); (*)
Files.isHidden(Path p);
Files.isWritable(Path p);
14. The read() method of java.io.Reader class lets you read a character at a time.
True or false?
True (*)
False
15. File permissions are the same across all of the different operating systems.
True
False (*)
Reply
5. The import keyword allows you to access classes of the package without package Fully Qualified Name.
True or false?
True (*)
False
10. The Files class lets you check for file properties.
True or false?
True (*)
False
11. The new Paths class lets you resolve .. (double dot) path notation.
True or false?
True (*)
False
12. Which of the following is an absolute Windows path
/home/user/username
data
C:\Users\UserName\data (*)
\Users\UserName\data
13. The Files class can perform which of the following functions?
14. The normalize() method removes redundant name elements from a qualified path.
True or false?
True (*)
False
15. Prior to Java 7, you write to a file with a call to the BufferedWriter class's write() method.
True or false?
True (*)
False
Reply
5. Given the following code, assume there are rows of data in the table EMP. What is the result?
4 if(rs.next()){
5 System.out.println(rs.getInt(1));
6}
13. Which JDBC interface can be used to access information such as database URL, username and table names?
Statement Interface
PreparedStatement Interface
CallableStatement Interface
Reply
1. Which of the following statements can be compiled?(Choose Three) Mark for Review
(1) Points
[Correct] Correct
2. Which line contains an compilation error?
interface Shape {}
ls.add(c); // Line 3
lc.add(c); // Line 4
(1) Points
Line 4
Line 1
Line 2
Line 3 (*)
[Correct] Correct
(1) Points
{1, 1, 2, 22, 305, 26} because a set may contain duplicates and all its elements are of the same type.
{"Apple", 1, "Carrot", 2} because it records the index of the elements with following integers.
{1, 2, 5, 178, 259} because it contains no duplicates and all its elements are of the same type. (*)
All of the above are sets because they are collections that can be made to fit any of the choices.
[Correct] Correct
(1) Points
True
False (*)
[Correct] Correct
5. Which interface forms the root of the collections hierarchy? Mark for Review
(1) Points
java.util.List
java.util.Collection (*)
java.util.Collections
java.util.Map
Reply
Replies
(1) Points
True
False (*)
[Correct] Correct
(1) Points
A pile of pancakes with which you add some to the top and remove them one by one from the top to the bottom.
A row of books that you can take out of only the middle of the books first and work your way outward toward either
edge.
A line at the grocery store where the first person in the line is the first person to leave. (*)
[Correct] Correct
(1) Points
True (*)
False
[Correct] Correct
(1) Points
[Correct] Correct
10. What are maps that link a Key to a Value? Mark for Review
(1) Points
HashSets
ArrayLists
HashMaps (*)
Arrays
11. Nodes are components of LinkedLists, and they identify where the next and previous nodes are.
(1) Points
True (*)
False
[Correct] Correct
12. Which sort algorithm was used to sort the char array {'M', 'S', 'A', 'T', 'H'}?
(1) Points
Binary Search
Merge Sort
Sequential Search
Selection Sort
[Correct] Correct
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
[Correct] Correct
14. Which of the following is a sorting algorithm that involves repeatedly incrementing through the array and swapping
2 adjacent values if they are in the wrong order until all elements are in the correct order? Mark for Review
(1) Points
Merge Sort
Binary Search
Selection Sort
Sequential Search
[Correct] Correct
15. Which of the following is the correct lexicographical order for the conents of the following int array?
{17, 1, 1, 83, 50, 28, 29, 3, 71, 22} Mark for Review
(1) Points
{1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
16. Which of the following best describes lexicographical order? Mark for Review
(1) Points
[Correct] Correct
17. Which of the following best describes lexicographical order? Mark for Review
(1) Points
[Correct] Correct
(1) Points
It utilizes the "divide and conquer" method, which makes the algorithm more error prone.
It requires incrementing through the entire array in the worst case, which is inefficient on large data sets. (*)
It involves looping through the array multiple times before finding the value, which is inefficient on large data sets.
It is never inefficient.
[Correct] Correct
(1) Points
A generic instance
A concreate method.
A generic class
[Correct] Correct
20. A generic class is a type of class that associates one or more non-specific Java types with it.
(1) Points
True (*)
False
21. Which of the following would initialize a generic class "Cell" using a String type?
(1) Points
III only
I only
I and II (*)
II only
II and III
[Correct] Correct
22. The local petting zoo is writing a program to be able to collect group animals according to species to better keep
track of what animals they have.
Which of the following correctly defines a collection that may create these types of groupings for each species at the
zoo? Mark for Review
(1) Points
public class
animalCollection {ナ} (*)
public class
animalCollection(AnimalType T) {ナ}
public class
animalCollection {ナ}
public class
animalCollection(animalType) {ナ}
li.add(1);
li.add(2);
print(li);
(1) Points
1 2 (*)
[Correct] Correct
list1.add(new Gum());
list2.add(new Integer(9));
System.out.println(list2.size());
(1) Points
2 (*)
[Correct] Correct
Section 7
25. The following code correctly initializes a pattern with the regular expression "[0-9]{2}/[0-9]{2}/[0-9]{2}".
(1) Points
True (*)
False
26. One benefit to using groups with regular expressions is that you can segment a matching string and recall the
segments (or groups) later in your program.
(1) Points
True (*)
False
[Correct] Correct
27. What is the function of the asterisk (*) in regular expressions? Mark for Review
(1) Points
Indicates that the preceding character may occur 1 or more times in a proper match.
Indicates that the preceding character may occur 0 or more times in a proper match. (*)
[Correct] Correct
28. What does the dot (.) represent in regular expressions? Mark for Review
(1) Points
[Correct] Correct
29. Which of the following are true about parsing a String?(Choose Three) Mark for Review
(1) Points
(Choose all correct answers)
[Correct] Correct
30. Which of the following methods can be used to replace a segment in a string with a new string? Mark for Review
(1) Points
replaceAll(String newString)
substring(int start, int end, String newString)
None of the above. There is no replaceAll(String newString) method with one argument.
31. Which of the following correctly initializes a StringBuilder? Mark for Review
(1) Points
StringBuilder sb = StringBuilder(500);
[Correct] Correct
32. Which case handles the last recursive call? Mark for Review
(1) Points
[Correct] Correct
33. Which two statements can create an instance of an array? (Choose Two) Mark for Review
(1) Points
char[] ca = "java";
int ia[][] = (1,2,3) (4,5,6);
[Correct] Correct
34. The base case condition can work with a constant or variable.
(1) Points
True (*)
False
[Correct] Correct
(1) Points
True
False (*)
36. Which of the following are files that must be uploaded to a web server to deploy a Java application/applet?(Choose
Three) Mark for Review
(1) Points
.java files
[Correct] Correct
37. To deploy java applications you may use Java Web Start.
(1) Points
True (*)
False
[Correct] Correct
38. Which of the following files are not required to be uploaded to a web server to deploy a JWS java
application/applet? Mark for Review
(1) Points
jar files
JNLP files
html files
[Correct] Correct
39. Which statement determine that "java" is a directory? Mark for Review
(1) Points
[Correct] Correct
(1) Points
True (*)
False
(1) Points
True (*)
False
[Correct] Correct
(1) Points
New dataInputStream("java.txt");
[Correct] Correct
Section 9
43. Suppose that you have a table EMPLOYEES with three rows. The first_name in those rows are A, B, and C. What does
the following output?
rset.absolute(1);
rset.next();
System.out.println(rset.getString(1));
(1) Points
A
B (*)
A SQLException is thrown.
[Correct] Correct
44. Which type of Statement can execute parameterized queries? Mark for Review
(1) Points
ParameterizedStatement
PreparedStatement (*)
45. Which of the following is the correct statement be inserted at //INSERT CODE location that calls the database-stored
procedure sayHello?
class Test{
try {
//INSERT CODE
cstat.setString(1, "Hello");
cstat.registerOutParameter(2, Types.NUMERIC);
cstat.setInt(2, 10);
catch(SQLException e){}
(1) Points
46. Which symbol is used as a placeholder to pass parameters to a PreparedStatement or CallableStatement? Mark for
Review
(1) Points
? (*)
[Correct] Correct
47. How many categories of JDBC drivers are there? Mark for Review
(1) Points
1
4 (*)
[Correct] Correct
48. What type of JDBC driver will convert the database invocation directly into network protocol? Mark for Review
(1) Points
Type 1 driver
Type 2 driver
Type 3 driver
49. Which of the following is NOT a JDBC interface used to execute SLQ statements? Mark for Review
(1) Points
Statement Interface
PreparedStatement Interface
CallableStatement Interface
[Correct] Correct
50. You must explicitly close ResultSet and Statement objects once they are no longer in use. Mark for Review
(1) Points
True (*)
False
Reply
boolean status=false;
int i=1;
i++;
i++;
(1) Points
5 (*)
Reply
Replies
(1) Points
Reply
This is very great thinks. It was very comprehensive post and powerful concept. Thanks for your sharing with us. Keep it
up..
Reply
Reply
Reply
Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning
Reply
Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning
Reply
Which of the following methods will move the cursor, returning a Boolean value from the ResultSet Object?
beforeFirst() (*)
absolute()
afterFirst()
afterLast()
beforeLast()
previous() (*)
Reply
set.add(4);
System.out.print(element);
11234
1213
12134
1234 (*)
Reply
TreeSett=new TreeSet();
if (t.add("one"))
if (t.add("two"))
if (t.add ("three"))
t.add("four");
for (String s : t)
System.out.print (s);
twofouronethree
onetwothreefour
fouronethreetwo (*)
Reply
Unit testing is the phase in software testing in which individual software modules are combined and tested as a whole.
True or false?
True
False (*)
Reply
UnknownDecember 7, 2019 at 9:25 PM
interface Shape {}
ls.add(new Circle());
System.out.println(ls.size());// line 4
3 (*)
Reply
Examine the code below. Which statement about this code is true?
1.class Shape { }
4.class Node { }
5.public class Test{
8.Node ns = nc;
Reply
oracle:thin:localhost@dfot/dfot:1521/xepdb1
jdbc::oracle-thin:dfot/dfot@oracle:1521/xepdb1
jdbc:oracle:thin:dfot/dfot@localhost:1521/xepdb1 (*)
oracle:thin:jdbc:dfot/dfot@localhost:1521/xepdb1
Reply
Reply
Reply
Apply Now for Distance/Regular Learning through tablet specially designed for learn ethical hacking, Android app
development,
software development, security engineer, forensic investigator,For more information visitClick Here
Reply
Hey Nice Blog!! Thanks For Sharing!!!Wonderful blog & good post.Its really helpful for me, waiting for a more new post.
Keep Blogging!
Oracle Training | Online Course | Certification in chennai | Oracle Training | Online Course | Certification in bangalore |
Oracle Training | Online Course | Certification in hyderabad | Oracle Training | Online Course | Certification in pune |
Oracle Training | Online Course | Certification in coimbatore
Reply
Thank you for valuable information.I am privilaged to read this post. oracle training in chennai
Reply
Nice Post! Thanks for sharing such an amazing article, really informative, it helps me a lot.
Reply
6. Modeling business problems requires understanding the interaction between interfaces, abstract and concrete
classes, subclasses, and enum classes.
(1) Points
True (*)
False
Reply
byte b = 1 + 1;
(1) Points
True (*)
False
Reply
UnknownNovember 16, 2020 at 1:20 PM
True or false?
True (*)
False
Reply
Wildcards in generics allows us greater control on the types that can be used.
True or False?
True (*)
False
Reply
Reply
When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can occur
(Choose all that apply).
(1) Points
NoSuchFileException
(*)
DirectoryNotEmptyException
(*)
No exception is thrown
IOException
(*)
Reply
The java.io package has problems with no support for symbolic links.
True or false?
(1) Points
True (*)
False
Reply
47. Which of the following statements is NOT TRUE for the Class.forName("HelloClass") method? (Choose three)
Class.forName("HelloClass");
(1) Points
The forName() method does not initialize the HelloClass.
(*)
The forName() method returns the Class object associated with the HelloClass.
The forName() method does not load the HelloClas class into the Java Runtime.
(*)
In this example, the Class.forName("HelloClass") will use the ClassLoader which loads the Foo class.
(*)
Reply
(1) Points
HashSet();
String();
HashSet classMates =
Reply
Using the FOR loop method of incrementing through a String is beneficial if you desire to: (Choose Three)
(*)
(*)
(*)
Reply
Thanks.. Bro.
PROxyz
Reply
(1) Points
Bytecode is not portable, and needs to be compiled again in order to run on a different platform. (*)
Reply
ramJune 8, 2021 at 11:52 PM
Sharing the same interest, Infycle feels so happy to share our detailed information about all these courses with you all!
Do check them out
oracle plsql training in chennai & get to know everything you want to about software trainings.
Reply
Selection sort is a sorting algorithm that involves finding the minimum value in the list, swapping it with the value in the
first position, and repeating these steps for the remainder of the list.
True (*)
False
Reply
Serializable (*)
SerializedObject
Serializer
Serializing
Serialized
Reply
Serializable (*)
SerializedObject
Serializer
Serializing
Serialized
Reply
add(Key, Value)
remove(Key, Value)
get(Key, Value)
Reply
Did you want to set your career towards Oracle? Then Infycle is with you to make this into reality. Infycle Technologies
gives the combined and best Oracle course in Chennai, which offers various stages of Oracle such as Oracle PL/SQL,
Oracle DBA, etc., along with 100% hands-on training guided by professional tutors in the field. Along with that, the mock
interviews will be given to the candidates to face the interviews with complete confidence. Apart from all, the
candidates will be placed in the top MNC's with an excellent salary package. To get it all, call 7502633633 and make this
happen for your happy life.
Reply
adana escort - adıyaman escort - afyon escort - aksaray escort - antalya escort - aydın escort - balıkesir escort - batman
escort - bitlis escort - burdur escort - bursa escort - diyarbakır escort - edirne escort - erzurum escort - eskişehir escort -
eskişehir escort - eskişehir escort - eskişehir escort - gaziantep escort - gebze escort - giresun escort - hatay escort -
ısparta escort - karabük escort - kastamonu escort - kayseri escort - kilis escort - kocaeli escort - konya escort - kütahya
escort - malatya escort - manisa escort - maraş escort - mardin escort - mersin escort - muğla escort - niğde escort - ordu
escort - osmaniye escort - sakarya escort - samsun escort - siirt escort - sincan escort - tekirdağ escort - tokat escort -
uşak escort - van escort - yalova escort - yozgat escort - urfa escort - zonguldak escort
Reply
AdministradorJune 29, 2021 at 3:55 PM
True or false?
True (*)
False
Reply
(1) Points
None of them execute since you cannot have multiple catch statements.
Correct
2. When do errors occur in code? Mark for Review
(1) Points
(1) Points
When you want to efficiently and reliably debug your program. (*)
Correct
(1) Points
True (*)
False
(1) Points
True (*)
False
Correct
(1) Points
True
False (*)
Correct
(1) Points
True
False (*)
Correct
8. The BufferedOutputStream is a direct subclass of what other class? Mark for Review
(1) Points
OutputStream
ObjectOutputStream
FilterOutputStream (*)
PrintStream
DigestOutputStream
9. The read() method lets you read a character at a time. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 5.
(1) Points
Serializer
Serializing
Serializable (*)
SerializedObject
Serialized
11. The Files class lets you check for file properties. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 5.
12. Which of the following is an absolute Windows path? Mark for Review
(1) Points
/home/user/username
data
\Users\UserName\data
C:\Users\UserName\data (*)
(1) Points
True (*)
False
14. Java 7 requires you create an instance of java.io.File class. True or false? Mark for Review
(1) Points
True
False (*)
Correct
15. The java.io package has problems with missing operations, like copy, move, and such.
(1) Points
True (*)
False
Correct
1. The normalize() method removes extraneous elements from a qualified path. True or false? Mark for Review
(1) Points
True (*)
False
2. Prior to Java 7, you write to a file with a call to the BufferedWriter class's write() method. True or false? Mark for
Review
(1) Points
True (*)
False
3. The Files class performs which of the following? Mark for Review
(1) Points
Works with absolute paths
4. The new Paths class lets you resolve .. (double dot) path notation. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
Correct
(1) Points
True (*)
False
(1) Points
True
False (*)
Correct
(1) Points
True (*)
False
Correct
9. What is special about including a resource in a try statement? Mark for Review
(1) Points
(Choose all correct answers)
(1) Points
Every time you would like to assign a new value to a variable that is being asserted.
11. When should you not use assertions? Mark for Review
(1) Points
When you call methods that may cause side effects in your assertion check. (*)
12. File permissions are the same across all of the different operating systems. Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 5.
13. When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can
occur (Choose all that apply). Mark for Review
(1) Points
NoSuchFileException (*)
DirectoryNotEmptyException (*)
No exception is thrown
IOException (*)
(1) Points
A PrintStream (*)
A BufferedWriter stream
An OutputStream
A Reader stream
A BufferedReader stream
15. The read() method lets you read a character at a time. True or false? Mark for Review
(1) Points
True (*)
False
Correct
1. The finally clause only executes when an exception is not caught and thrown.
(1) Points
True
False (*)
Correct
2. What is one step you must do to create your own exception? Mark for Review
(1) Points
(1) Points
(Choose all correct answers)
(1) Points
True (*)
False
(1) Points
Every time you would like to assign a new value to a variable that is being asserted.
6. Why should you not use assertions to check parameters? Mark for Review
(1) Points
Not all methods have parameters, therefore assertions should never be used on parameters.
Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
(1) Points
True (*)
False
8. An ObjectInputStream lets you read a serialized object. True or false? Mark for Review
(1) Points
True
False (*)
Correct
9. File permissions are the same across all of the different operating systems. Mark for Review
(1) Points
True
False (*)
10. The Files class lets you check for file properties. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
A Reader stream
An InputStream (*)
A PrintStream
A BufferedWriter stream
A BufferedReader stream
12. The normalize() method removes extraneous elements from a qualified path. True or false? Mark for Review
(1) Points
True (*)
False
13. The new Paths class lets you resolve .. (double dot) path notation. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
True (*)
False
15. An absolute path always starts from the drive letter or mount point. Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 4.
What two packages are available in Java to allow you to transfer data? Mark for Review
(1) Points
java.output.package
java.input.package
(1) Points
Bugs in code that make your program run different than expected (*)
Something that causes your computer to crash.
12. The BufferedInputStream is a direct subclass of what other class? Mark for Review
(1) Points
FileInputStream
FilterInputStream (*)
InputStream
InputStream
PipedInputStream
(1) Points
True
False (*)
Correct
(1) Points
/home/user/username
\Users\UserName\data
data
C:\Users\UserName\data (*)
Correct
(1) Points
True (*)
False
Correct
4. The way that you read from a file has changed since the introduction of Java 7. Mark for Review
(1) Points
True (*)
False
Correct
(1) Points
Computer malfunction that makes your code run incorrectly.
Bugs in code that make your program run different than expected (*)
Correct
(1) Points
True
False (*)
Correct
7. Why should you not use assertions to check parameters? Mark for Review
(1) Points
Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
Not all methods have parameters, therefore assertions should never be used on parameters.
Correct
(1) Points
True (*)
False
Correct
9. When do errors occur in code? Mark for Review
(1) Points
Correct
(1) Points
Every time you would like to assign a new value to a variable that is being asserted.
If you want to switch different values for a certain variable.
Correct
11. Multiple catch statements can be used for a single try statement.
(1) Points
True (*)
False
Correct
12. When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can
occur (Choose all that apply). Mark for Review
(1) Points
NoSuchFileException (*)
No exception is thrown
DirectoryNotEmptyException (*)
IOException (*)
13. Which of the following static methods is not provided by the Files class to check file properties or duplication?
Mark for Review
(1) Points
Files.isWritable(Path p);
Files.isReadable(Path p);
Files.isHidden(Path p);
Correct
Serializer
Serialized
Serializing
Serializable (*)
SerializedObject
Correct
(1) Points
An OutputStream
A BufferedReader stream
A BufferedWriter stream
A PrintStream (*)
A Reader stream
Correct
(1) Points
None of them execute since you cannot have multiple catch statements.
Correct
(1) Points
When you want to efficiently and reliably debug your program. (*)
Correct
(1) Points
True (*)
False
(1) Points
True (*)
False
Correct
(1) Points
True
False (*)
Correct
(1) Points
True
False (*)
Correct
8. The BufferedOutputStream is a direct subclass of what other class? Mark for Review
(1) Points
OutputStream
ObjectOutputStream
FilterOutputStream (*)
PrintStream
DigestOutputStream
9. The read() method lets you read a character at a time. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
Serializer
Serializing
Serializable (*)
SerializedObject
Serialized
11. The Files class lets you check for file properties. True or false? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 5.
12. Which of the following is an absolute Windows path? Mark for Review
(1) Points
/home/user/username
data
\Users\UserName\data
C:\Users\UserName\data (*)
(1) Points
True (*)
False
14. Java 7 requires you create an instance of java.io.File class. True or false? Mark for Review
(1) Points
True
False (*)
Correct
15. The java.io package has problems with missing operations, like copy, move, and such.
(1) Points
True (*)
False
Correct
1. The normalize() method removes extraneous elements from a qualified path. True or false? Mark for Review
(1) Points
True (*)
False
2. Prior to Java 7, you write to a file with a call to the BufferedWriter class's write() method. True or false? Mark for
Review
(1) Points
True (*)
False
3. The Files class performs which of the following? Mark for Review
(1) Points
Works with absolute paths
4. The new Paths class lets you resolve .. (double dot) path notation. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
Correct
(1) Points
True (*)
False
(1) Points
True
False (*)
Correct
(1) Points
True (*)
False
Correct
9. What is special about including a resource in a try statement? Mark for Review
(1) Points
(Choose all correct answers)
(1) Points
Every time you would like to assign a new value to a variable that is being asserted.
(1) Points
When you call methods that may cause side effects in your assertion check. (*)
12. File permissions are the same across all of the different operating systems. Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 3 Lesson 5.
13. When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can
occur (Choose all that apply). Mark for Review
(1) Points
NoSuchFileException (*)
DirectoryNotEmptyException (*)
No exception is thrown
IOException (*)
(1) Points
A PrintStream (*)
A BufferedWriter stream
An OutputStream
A Reader stream
A BufferedReader stream
15. The read() method lets you read a character at a time. True or false? Mark for Review
(1) Points
True (*)
False
Correct
1. The finally clause only executes when an exception is not caught and thrown.
(1) Points
True
False (*)
Correct
2. What is one step you must do to create your own exception? Mark for Review
(1) Points
(1) Points
(1) Points
True (*)
False
Every time you would like to assign a new value to a variable that is being asserted.
6. Why should you not use assertions to check parameters? Mark for Review
(1) Points
Not all methods have parameters, therefore assertions should never be used on parameters.
Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
(1) Points
True (*)
False
8. An ObjectInputStream lets you read a serialized object. True or false? Mark for Review
(1) Points
True
False (*)
Correct
9. File permissions are the same across all of the different operating systems. Mark for Review
(1) Points
True
False (*)
10. The Files class lets you check for file properties. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
A Reader stream
An InputStream (*)
A PrintStream
A BufferedWriter stream
A BufferedReader stream
12. The normalize() method removes extraneous elements from a qualified path. True or false? Mark for Review
(1) Points
True (*)
False
13. The new Paths class lets you resolve .. (double dot) path notation. True or false? Mark for Review
(1) Points
True (*)
False
(1) Points
True (*)
False
15. An absolute path always starts from the drive letter or mount point. Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 3 Lesson 4.
What two packages are available in Java to allow you to transfer data? Mark for Review
(1) Points
java.output.package
java.input.package
(1) Points
Bugs in code that make your program run different than expected (*)
12. The BufferedInputStream is a direct subclass of what other class? Mark for Review
(1) Points
FileInputStream
FilterInputStream (*)
InputStream
InputStream
PipedInputStream
1. Java 7 requires you create an instance of java.io.File class. True or false? Mark for Review
(1) Points
True
False (*)
Correct
(1) Points
/home/user/username
\Users\UserName\data
data
C:\Users\UserName\data (*)
Correct
3. The java.nio.file package has improved exception handling.
(1) Points
True (*)
False
Correct
4. The way that you read from a file has changed since the introduction of Java 7. Mark for Review
(1) Points
True (*)
False
Correct
(1) Points
Computer malfunction that makes your code run incorrectly.
Bugs in code that make your program run different than expected (*)
Correct
(1) Points
True
False (*)
Correct
7. Why should you not use assertions to check parameters? Mark for Review
(1) Points
Assertions can be disabled at run time which may cause unexpected results in your assertions. (*)
Not all methods have parameters, therefore assertions should never be used on parameters.
Correct
(1) Points
True (*)
False
Correct
Correct
(1) Points
Every time you would like to assign a new value to a variable that is being asserted.
If you want to switch different values for a certain variable.
Correct
11. Multiple catch statements can be used for a single try statement.
(1) Points
True (*)
False
Correct
12. When you delete files, directories, or links with the delete(Path p) method which of the following exceptions can
occur (Choose all that apply). Mark for Review
(1) Points
NoSuchFileException (*)
No exception is thrown
DirectoryNotEmptyException (*)
IOException (*)
13. Which of the following static methods is not provided by the Files class to check file properties or duplication?
Mark for Review
(1) Points
Files.isWritable(Path p);
Files.isReadable(Path p);
Files.isHidden(Path p);
Correct
(1) Points
Serializer
Serialized
Serializing
Serializable (*)
SerializedObject
Correct
(1) Points
An OutputStream
A BufferedReader stream
A BufferedWriter stream
A PrintStream (*)
A Reader stream
Correct
Examine the code below. Which statement about this code is true?
1. class Shape { }
2. class Circle extends Shape { }
3. class Rectangle extends Shape { }
4. class Node <T> { }
5. public class Test{
6. public static void main(String[] args){
7. Node <Circle>nc = new Node<>();
8. Node <Shape> ns = nc;
}
}
Marcar para Revisión
(1) Puntos
An error at line 4 causes compilation to fail.
The code compiles.
An error at line 8 causes compilation to fail.
An error at line 7 causes compilation to fail.
int i=0,j=0;
i=++i;
j=i++;
System.out.println("i=" + i + " " + "j=" + j);
(1/1) Puntos
The code will compile and print "i=1 j=1"
The code does not compile.
The code will compile and print "i=2 j=1" (*)
The code will compile and print "i=2 j=2"
The code will compile and print "i=1 j=2"