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 28

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 Sample
    {
        public static void main(String args[]) 
        {
            int g = 3;
             System.out.print(++g * 8);
        } 
    
    }
 

25

24

32

33

SHOW ANSWER

Can 8 byte long data type be automatically type cast to 4 byte int data type?

True

False

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

Which of these is not a bitwise operator?

&

&=

|=

<=

SHOW ANSWER

Which right shift operator preserves the sign of the value?

<<

>>

 <<=

>>=

SHOW ANSWER

Which of these statements are incorrect?

The left shift operator, <<, shifts all of the bits in a value to the left specified number of times

The right shift operator, >>, shifts all of the bits in a value to the right specified number of times

The left shift operator can be used as an alternative to multiplying by 2

The right shift operator automatically fills the higher order bits with 0

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
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in