0

Java Programming Language Quiz - 5

Description: Java Programming Language Quiz - 5
Number of Questions: 10
Created by:
Tags: java
Attempted 0/10 Correct 0 Score 0
  1. double D = 45456.444;

  2. long L = 45784;

  3. int I = L;

  4. int J = (int) D;


Correct Option: C
  1. After object B is notified, or after two seconds

  2. After the lock on B is released, or after two seconds

  3. Two seconds after object B is notified

  4. Two seconds after lock B is released.


Correct Option: A
  1. Float

  2. None of the above

  3. byte

  4. String

  5. integer


Correct Option: C

What will happen when you attempt to compile and run the following code


public class Hope{
    public static void main(String argv[]){
        Hope h = new Hope();
    }
    protected Hope(){
        for(int i =0;
        i <10;
        i ++){
            System.out.println(i);
        }
    }
}
  1. Compilation and running with output 0 to 9

  2. Run time error: Constructors cannot be declared protected

  3. Compilation error: Constructors cannot be declared protected

  4. Compilation and running with output 0 to 10

  5. None of the above


Correct Option: A

A class cannot be declared:

  1. Static

  2. Private

  3. Default

  4. None of the above


Correct Option: B
  1. Compilation error

  2. Runtime error

  3. No errors

  4. Execptions


Correct Option: C
- Hide questions