Home » Java Aptitude Que. & Ans.

Java Operators Aptitude Questions and Answers

Java Operators Aptitude Questions and Answers: This section provides you Java Operators related Aptitude Questions and Answers with multiple choices. Here, You will get solution and explanation of each question.

List of Java Operators Aptitude Questions and Answers

1) What will be the output of following program ?
class Opr
{
    public static void main(String args[])
    {
        boolean ans=false;
        if(ans=true)
            System.out.print("Done");
        else
            System.out.print("Fail");
    }
}
  1. Done
  2. Fail
  3. Error
  4. DoneFail

2) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int x=5,y;
        y= ++x + x++ + --x;
        System.out.println(x + "," + y);
    }
}

  1. 6,15
  2. 6,18
  3. 6,12
  4. None of these

3) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        byte a,b;
        a=10; b=20;
        b=assign(a);
        System.out.println(a +","+ b);
 
         
    }
    public static byte assign(byte a)
    {
        a+=100;
        return a;
    }
     
}
  1. 110, 110
  2. 10, 110
  3. 10, 10
  4. None of these

4) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int a,b,result;
        a=10; b=20;
        result=(b>=a);
        System.out.print(result);
    }
}

  1. Error
  2. 1
  3. True
  4. 20

5) What will be the output of following program?
class Opr
{
    public static void main(String args[])
    {
        int a,b,result;
        a=10; b=20;
        result=(int)(b>=a);
        System.out.print(result);
    }
}

  1. Error
  2. 1
  3. True
  4. 20

Page 2



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.