Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

JAVA QUESTIONS : PART 7

An expression involving byte, int, and literal numbers is promoted to which of these?

  int

long

 byte

 float

SHOW ANSWER

Which data type value is returned by all transcendental math functions?

int

float

 double

 long

SHOW ANSWER

What is the output of this program?

class average {

        public static void main(String args[])

        {

            double num[] = {5.5, 10.1, 11, 12.8, 56.9, 2.5};

            double result;

            result = 0;

            for (int i = 0; i < 6; ++i)

                result = result + num[i];

             System.out.print(result/6);

 

        }

    }

16.34

16.566666644

16.46666666666667

16.46666666666666

SHOW ANSWER

What will be the output of these statement?

class output {
        public static void main(String args[]) 
        {
            double a, b,c;
            a = 3.0/0;
            b = 0/4.0;
            c=0/0.0;
 
        System.out.println(a);
            System.out.println(b);
            System.out.println(c);
        } 
    }

Infinity

 0.0

NaN

 all of the mentioned

SHOW ANSWER

What is the output of this program?
    class increment {
        public static void main(String args[]) 
        {        
             int g = 3;
             System.out.print(++g * 8);
        } 
    }

25

24

32

33

SHOW ANSWER

What is the output of this program?

            class area {
        public static void main(String args[]) 
        {    
             double r, pi, a;
             r = 9.8;
             pi = 3.14;
             a = pi * r * r;
             System.out.println(a);
        } 
    }
 

301.5656

301

301.56

301.56560000

SHOW ANSWER

Which of these coding types is used for data type characters in Java?

ASCII

ISO-LATIN-1

UNICODE

None of the mentioned

SHOW ANSWER

Which of these values can a boolean variable contain?

True & False

0 & 1

Any integer value

true

SHOW ANSWER

Which one is a valid declaration of a boolean?

boolean b1 = 1;

boolean b2 = ‘false’;

boolean b3 = false;

boolean b4 = ‘true’

SHOW ANSWER

What is the output of this program?

class array_output {
        public static void main(String args[]) 
        {    
            char array_variable [] = new char[10];
        for (int i = 0; i < 10; ++i) {
                array_variable[i] = 'i';
                System.out.print(array_variable[i] + "" );
                i++;
            }
        } 
    }

i i i i i

0 1 2 3 4

i j k l m

None of the mentioned

SHOW ANSWER

What is the output of this program?
class mainclass {
            public static void main(String args[]) 
            {
                    char a = 'A';
                    a++;
            System.out.print((int)a);
            } 
    }

66

 67

65

64

SHOW ANSWER

What is the output of this program?
    class mainclass {
        public static void main(String args[]) 
        {
            boolean var1 = true;
        boolean var2 = false;
        if (var1)
            System.out.println(var1);
        else
            System.out.println(var2);
       } 
    }

0

1

true

false

SHOW ANSWER

What is the output of this program?
class booloperators {
        public static void main(String args[]) 
        {
            boolean var1 = true;
            boolean var2 = false;
            System.out.println((var1 & var2));
        } 
}

0

 1

 true

false

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in