Test: Java Programming Midterm Exam

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 1 (Answer all questions in this section)

1. An example of two tier architecture would be a client application working with a server application.
True or false?

True (*)
False

Correct

2. How would you make an instance of Car in a class that didn't import the vehicle package below?
S01_L01_O01-3_JP_Section_1_EXAM.jpg
Car c = new Car();
vehicle.Car c=new Car();
vehicle.Car c=new vehicle.Car(); (*)
vehicle.Car c=new vehicle();
None of the above

Correct

3. The method for connecting a java application to a database is JNLP.
True or false?
True
False (*)

Correct

4. If a programmer uses the line import com.test.*, there is no need to import com.test.code.*
True or fals

True
False (*)

Correct

5. Which of the following is an attribute of a three tier architecture application?

An application of that has a client and server only.
A complex application that includes a client, a server and database. (*)
An application of that runs on a single computer.
None of the above.

Correct

Section 2 (Answer all questions in this section)

6. Which of the following is not a good technique to follow when reading code written by others?

Learn the high level structure and starting point, and then figure out how it branches.
Find the author of the code and ask him how it works. (*)
Build and run the code.
Perform testing.
Understand the constructs.

Correct


7. 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 (*)

Correct

8. Arrays have built-in operations including add, clear, contains, get and remove. True or false?

True
False (*)

Correct


9. Examine the following code snippet. What is this an example of?
S02_L01_O02-1_JP_Section_2_EXAM.jpg
Polymorphism
Encapsulation
Inheritance (*)
None of the above

Correct


10. Which of the following statements about arrays and ArrayLists in Java are true?

I. An Array has a fixed length.

II. An Array can grow and shrink dynamically as required.

III. An ArrayList can store multiple object types.

IV. In an ArrayList you need to know the length and the current number of elements stored.

I and III only (*)
II and IV only
I, II, and III only
I, II, III and IV
None of the above

Correct