### questions

Title
###### Which of the following can be operands of arithmetic operators

Which of the following can be operands of arithmetic operators?

1. Numeric
2. Boolean
3. Characters
4. Both Numeric & Characters
###### Modulus operator, %, can be applied to which of these

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

1. Integers
2. Floating – point numbers
3. Both Integers and floating – point numbers
4. None of the mentioned
###### With x = 0, which of the following are legal lines of Java code for changing the value of x to 1

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. 1, 2 & 3
2. 1 & 4
3. 1, 2, 3 & 4
4. 3 & 2
###### Decrement operator, −−, decreases the value of variable by what number

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

1. 1
2. 2
3. 3
4. 4
###### Which of these statements are incorrect

Which of these statements are incorrect?

1. Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms
2. Assignment operators run faster than their equivalent long forms
3. Assignment operators can be used only with numeric and character data type
4. None of the mentioned
###### What is the output of this program

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 1
2. 0 1
3. 1.5 1
4. 1.5 1.0
###### What is the output of this program

What is the output of this program?

``````    class Modulus
{
public static void main(String args[])
{
double a = 25.64;
int  b = 25;
a = a % 10;
b = b % 10;
System.out.println(a + " "  + b);
}
}``````

1. 5.640000000000001 5
2. 5.640000000000001 5.0
3. 5 5
4. 5 5.640000000000001
###### Which of these is not a bitwise operator

Which of these is not a bitwise operator?

1. &
2. &=
3. |=
4. <=
###### Which operator is used to invert all the digits in a binary representation of a number

Which operator is used to invert all the digits in a binary representation of a number?

1. ~
2. <<<
3. >>>
4. ^
###### On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit

On applying Left shift operator, <<, on integer bits are lost one they are shifted past which position bit?

1. 1
2. 32
3. 33
4. 31
###### Which right shift operator preserves the sign of the value

Which right shift operator preserves the sign of the value?

1. <<
2. >>
3. <<=
4. >>=
###### Which of these statements are incorrect

Which of these statements are incorrect?

1. The left shift operator, <<, shifts all of the bits in a value to the left specified number of times
2. The right shift operator, >>, shifts all of the bits in a value to the right specified number of times
3. The left shift operator can be used as an alternative to multiplying by 2
4. The right shift operator automatically fills the higher order bits with 0
###### What is the output of this program

What is the output of this program?

``````    class bitwise_operator
{
public static void main(String args[])
{
int var1 = 42;
int var2 = ~var1;
System.out.print(var1 + " " + var2);
}
}``````

1. 42 42
2. 43 43
3. 42 -43
4. 42 43
###### What is the output of this program

What is the output of this program?

``````    class bitwise_operator
{
public static void main(String args[])
{
int a = 3;
int b = 6;
int c = a | b;
int d = a & b;
System.out.println(c + " "  + d);
}
}``````

1. 7 2
2. 7 7
3. 7 5
4. 5 2
###### What is the output of relational operators

What is the output of relational operators?

1. Integer
2. Boolean
3. Characters
4. Double
###### Which of these is returned by “greater than”, “less than” and “equal to” operators

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

1. Integers
2. Floating – point numbers
3. Boolean
4. None of the mentioned
###### Which of the following operators can operate on a boolean variable

Which of the following operators can operate on a boolean variable?

1. &&
2. ==
3. ?:
4. +=

1. 3 & 2
2. 1 & 4
3. 1, 2 & 4
4. 1, 2 & 3
###### Which of these operators can skip evaluating right hand operand

Which of these operators can skip evaluating right hand operand?

1. !
2. |
3. &
4. &&
###### Which of these statements is correct

Which of these statements is correct?

1. true and false are numeric values 1 and 0
2. true and false are numeric values 0 and 1
3. true is any non zero value and false is 0
4. true and false are non numeric values
###### What is the output of this program

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);
}
}``````

1. 1
2. 0
3. true
4. false

MCQs

Views