Tag: programming languages

Questions Related to programming languages

  1. abstract, default, if, private, this

  2. do, implements, protected, boolean, throw

  3. case, extends, int, short, try

  4. import, break, double, exception, throws

  5. byte, else, instanceof, return, transient

  6. None of the above


Correct Option: D
  1. Encapsulation is a form of data hiding.

  2. A tightly encapsulated class is always immutable.

  3. Encapsulation is always used to make programs run faster.

  4. Encapsulation helps to protect data from corruption.

  5. Encapsulation allows for changes to the internal design of a class while the public interface remains unchanged.


Correct Option: A,D,E
  1. A top-level class can not be called "tightly encapsulated" unless it is declared private.

  2. Encapsulation enhances the maintainability of the code.

  3. A tightly encapsulated class allows fast public access to member fields.

  4. A tightly encapsulated class allows access to data only through accessor and mutator methods.

  5. Encapsulation usually reduces the size of the code.

  6. A tightly encapsulated class might have mutator methods that validate data before it is loaded into the internal data model.


Correct Option: B,D,F
  1. The class is declared final.

  2. All local variables are declared private.

  3. All method parameters are declared final.

  4. No method returns a reference to any object that is referenced by an internal data member.

  5. None of the above


Correct Option: E
  1. -disableassertions

  2. -disableAssertions

  3. -assertionsDisable

  4. -assertionsOn

  5. -assertionsOff


Correct Option: A