Shared Flashcard Set

Details

oopexam2
hurrdurrr
53
Aviation
Undergraduate 1
03/26/2013

Additional Aviation Flashcards

 


 

Cards

Term
How is an interface created?
Definition
Through the methods they expose.
Term
Inheritance is what?
Definition
Classes derived from other classes (inheriting fields and methods)
Term
Abstract classes are what?
Definition
A method that is declared w/out implementation (no braces, following a semicolon)
Term
Interface Comparable imposes what?
Definition
Natural ordering of the objects of each class that implements it.
Term
TF, The finally block will not execute if the application terminates immediately by calling method System.exit
Definition
True
Term
What stream is most appropriate to display errors?
Definition
System.err
Term
TF if a program has a runtime error, it will not compile and run
Definition
False
Term
Which package is the Exception class in?
Definition
Java.lang
Term
A logical error is caused by what?
Definition
The programmer making a mistake thus the program doesn't run as intended (but still runs)
Term
What happens if the catch-or-declare requirement for a checked exception is not satisfied?
Definition
The compiler will issue an error message indicating that the exception must be caught or declared.
Term
Attempting to access an object through a reference variable before an object is assigned to it will result in which exception?
Definition
NullPointerException
Term
TF, the finally block of a try-catch is mandatory, otherwise the program won't compile
Definition
False
Term
TF, int is an example of java class and integer is an example of a java primative
Definition
False
Term
The operand of throw can be object of RuntimeException clas
Definition
true
Term

Will the print line statement execute here?

 while(true?true:false)
{
          System.out.println("hello");
          break;
         }
Definition
Yes
Term

The following code legal.

try {

} finally {

}
Definition
true
Term
Compiler enforces a catch-or-declare requiremnt for what kind of exception (unchecked, runtime checked)
Definition
Checked excpetions
Term
What is the name of the class that describes internal system errors?
Definition
Error
Term
TF, "Object" class is superclass of "Throwable" class
Definition
True
Term
The types of errors described by Exception class can NOT be caught and handled by your program. TF?
Definition
False
Term
TF, throws clause does not specify the excpetions a method throws
Definition
False
Term
Is IOException a checked exception?
Definition
Yes
Term
TF, an exception is an event, which occurs during the execution of a progra, that dirupts the normla flow of the program's instructions
Definition
True
Term

In the catch block below, what is arithmeticException?

   catch ( ArithmeticException arithmeticException ) {

      System.err.printf( arithmeticException );

   } // end catch

Definition
The name of the catch block's exception paramter.
Term
TF, IndexOutOfBoundsException is thrown if you access an element in an aray outside the bounds of the array.
Definition
True
Term
All exception classes inherit, either directy or indirectly from:
Definition
class Throwable.
Term
The comiler does not check the code to determine whether an checked exception is caught or declared...TF?
Definition
False
Term
The process in which a primative is converted to an object is called what?
Definition
Autoboxing
Term
Collections cannot use primitives directly
Definition
True
Term
TF, Autoboxing happens automatically in all version of Java 5 and up
Definition
True
Term
TF, when implement an interface, having the metohods of methods fo that interface is completely optional
Definition
False
Term
When creating the methods in an interface, only what method must be made, and can it contain any actual functionality (code inside)?
Definition
the declaration method must be made and no it cannot
Term
What keyword is appropriate for creating an interface?
Definition
interface
Term
An interface defines a(n) __________ relationship
Definition
is-a
Term
TF, an interface can be treated as a type
Definition
True
Term
What is the proper way to get the size of an array?
Definition
array.length;
Term
TF, Interfaces are used to encode similarities which the classes of various types share, but do not necessarily constitute a class relationship.
Definition
True
Term
implicitly, all interfaces are what? (public, protected, private)
Definition
Public
Term
When does dynamic binding occur in java?
Definition
Run time
Term

Which of the following would be the wrapper class of this Iterator for loop?

for ( E bar : set ) {

}

Definition
E
Term
TF, the Comparable interface requires that the compareTo method be implemented.
Definition
True
Term
To get the size of an ArrayList, the length() method will be used...TF?
Definition
False
Term
Each object of a class shares static variable, TF?
Definition
True
Term
Interfaces cannot specify implementaions for methods, but they can for their...
Definition
prototypes
Term
A class can extend only one class, but it can impliment many what?
Definition
Interfaces
Term
Can an interface contains constructors?
Definition
No
Term

What is the output of the following program (If you don't understand, try to run it)? 

public class Test {

    public static void main(String[] args) {

       Boolean b1 = new Boolean(true);
       Boolean b2 = new Boolean(true);
      System.out.print(b1 == b2);
   }

}

Definition
False
Term

What is the output of the following program (If you don't understand, try to run it)? 

public class Test {

   static voaid pass(int i){
      System.out.println("I am an int");
   }
   static void pass(Integer i){
     System.out.println("I am an Integer");
   }
   public static void main(String[] args) {

    pass(1);
  }
}

Definition
I am an int
Term

What is the output of the following program (If you don't understand, try it)? 

import java.util.ArrayList;
import java.util.TreeSet;
public class Test{
  public static void main(String... args) {
    ArrayList<Integer> MyList = new ArrayList<Integer>();
    MyList.add(21);
    MyList.add(3);
    MyList.add(2);
    MyList.add(3);
    MyList.add(21);
    MyList.add(2);
    MyList.add(20);
   TreeSet<Integer> tree = new TreeSet<Integer>(MyList);
   System.out.println(tree.size());
  }
}

Definition
4
Term
STATIC polymorphics in Java is acheved through what
Definition
Method Overriding
Term
Polymorphism is WHAT!? kind of relationship?
Definition
is-a
Supporting users have an ad free experience!