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 9

What is the output of this program?
        class array_output 
           {
        public static void main(String args[]) 
        {
            int array_variable[][] = {{ 1, 2, 3}, { 4 , 5, 6}, { 7, 8, 9}};
            int sum = 0;
            for (int i = 0; i < 3; ++i)
                for (int j = 0; j <  3 ; ++j)
                    sum = sum + array_variable[i][j];
            System.out.print(sum / 5);
        } 
    }
 

8

9

10

11

SHOW ANSWER

Which of the following can be operands of arithmetic operators?

Numeric

Both Numeric & Characters

Characters

Boolean

SHOW ANSWER

Modulus operator, %, can be applied to which of these?

Integers

Floating – point numbers

Both Integers and floating – point numbers

 None of the mentioned

SHOW ANSWER

With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
        1. x++;
          2. x = x + 1;
           3. x += 1;
           4. x =+ 1;
 

1, 2 & 3

1 & 4

1, 2, 3 & 4

3 & 2

SHOW ANSWER

Decrement operator, −−, decreases the value of variable by what number?

 1

2

3

4

SHOW ANSWER

Which of these statements are incorrect?

Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms

 Assignment operators run faster than their equivalent long forms

Assignment operators can be used only with numeric and character data type

None of the mentioned

SHOW ANSWER

What is the output of this program?
 class increment 
    {
        public static void main(String args[])
        {
            double var1 = 1 + 5; 
            double var2 = var1 / 4;
            int var3 = 1 + 5;
            int var4 = var3 / 4;
            System.out.print(var2 + " " + var4);
 
        } 
    }

1 1

0 1

1.5 1

1.5 1.0

SHOW ANSWER

What is the output of this program?
class Output{
        public static void main(String args[]) {    
             int a = 1;
             int b = 2;
             int c;
             int d;
             c = ++b;
             d = a++;
             c++;
             b++;
             ++a;
             System.out.println(a + " " + b + " " + c);
        } 
    }

3 2 4

3 2 3

2 3 4

3 4 4

SHOW ANSWER

What is the output of relational operators?

Integer

Boolean

Characters

Double

SHOW ANSWER

Which of these is returned by “greater than”, “less than” and “equal to”      operators?

Integers

Floating – point numbers

Boolean

None of the mentioned

SHOW ANSWER

Which of the following operators can operate on a boolean variable?
        1. &&
           2. ==
          3. ++
           4. +=

3 & 2

1 & 4

1, 2 & 4

1& 2

SHOW ANSWER

Which of these statements is correct?

true and false are numeric values 1 and 0

true and false are non numeric values

true is any non zero value and false is 0

true and false are numeric values 0 and 1

SHOW ANSWER

What is the output of this program?
class Relational_operator 
    {
        public static void main(String args[])
        {
            int var1 = 5; 
            int var2 = 6;
            System.out.print(var1 > var2);
        } 
    }

false

 true

0

1

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