Java Makeup Quiz

Your Name: ______

Please answer each question by placing the letter corresponding to the most nearly correct answer in the blank to the left.

___ 1. In Java, which of the following types is not a primitive type?

a.  boolean b. Long c. byte d. short e. char

___ 2. A Java array is guaranteed to be initialized and cannot be accessed outside of its

a.  collector b. container c. constructor d. destructor e. range

___ 3. In Java, when an object is no longer being referenced, the memory it used can be

a.  leaked b. garbage-collected c. constructed d. destroyed e. trashed

___ 4. Which feature is not supported by object-oriented programming languages?

a.  inheritance b. abstraction c. encapsulation d. polymorphism e. relativism

___ 5. When a method can be invoked with the same name but with different

parameters, it is said to be:

a.  brokered b. parameterized c. developed d. overloaded e. downcast

___ 6. Functions in object-oriented programming languages are called:

a.  methods b. parameters c. fields d. variables e. capabilities

___ 7. Data or methods not related to any one particular object/instance of that class

are called:

a.  isometric b. parametric c. static d. barometric e. loose

___ 8. In the code fragment: public static void main(String[] args)…,

args is:

a.  a public array b. a void array c. a string of characters

d. an array of characters e. an array of strings

___ 9. What adjective or tag is a suggestion that you should no longer use this

particular feature, since sometime in the future it is likely to be removed?

a. prevaricated b. declined c. marked d. deprecated e. classified

___ 10. One of the most compelling reasons to use Java is its platform:

a.  deprecation b. independence c. instability d. performance e. recursion

___ 11. Which of the following is not a looping statement:

a.  while b. switch c. do-while d. for

___ 12. Which of the following is not a decision-making statement:

a.  if-then-else b. switch c. if-then d. for

___ 13. A construct made up of variables, operators, and method invocations, which are constructed according to the syntax of the language, that evaluates to a single value is an:

a.  equivocation b. expression c. operator d. equivalence e. abstraction

___ 14. Which of the following is not an operator used to compare two values:

a.  != b. == c. >= d. <= e. =

___ 15. What is the output of the following program:

class Demo {

public static void main(String[] args){

int i = 3;

i++;

System.out.println(i);

++i;

System.out.println(i);

System.out.println(++i);

System.out.println(i++);

System.out.println(i);

}

}

a.  4 5 5 6 7 b. 4 5 6 5 7 c. 4 6 6 6 7 d. 4 5 6 6 7 e. 4 5 6 7 7

___ 16. In order of increasing precedence, which of the following orderings is correct:

a.  &,=,!=,+,* b. !=,=,&,!=,+,* c. =,+,&,!=,+,*

d. =,&,!=,+,* e. =,&,*,!=,+

___ 17. After executing the following code segment, what are the values of i and n?

int i = 10;

int n = i++%5;

a.  i is 10, and n is 0 b. i is 11, and n is 0 c. i is 11, and n is 1

d. i is 11, and n is 2 e. i is 10, and n is 1

___ 18. The following expression, x + y / 100 , is equivalent to:

a.  y + x / 100 b. x / (100 + y) c. x + (y / 100) d. (x + y) / 100

___ 19. A group of zero or more statements between balanced braces that can be used

anywhere a single statement is allowed is called a:

a.  segment b. portion c. block d. equivalence e. abstraction

___ 20. What is the output resulting from the execution of the following code snippet?

aNumber = 3;

if (aNumber >= 0)

if (aNumber == 0) System.out.println("first");

else System.out.println("second");

System.out.println("third");

a.  first b. third c. second d. first e. second

third third second

third