Arrays


  1. Which of these keywords is used to prevent content of a variable from being modified?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    A variable can be declared final, doing so prevents its content from being modified. Final variables must be initialized when it is declared.


  1. Arrays in Java are implemented as?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    object



  1. What is the output of this program?

    public class Result
    {
    public static void main(String args[])
    {
    boolean p = false;
    boolean q = true;
    boolean r = q ^ p;
    System.out.println(!r);
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    output: false


  1. What is the output of this program?

    public class Result
    {
    public static void main(String args[])
    {
    int p , q = 2;
    p = 20;
    if (p != 20 && p / 0 == 0)
    {
    System.out.println(q);
    }
    else
    {
    System.out.println(++q);
    }
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Operator short circuit and, &&, skips evaluating right hand operand if left hand operand is false thus division by zero in if condition does not give an error.
    output: 3