Programming  Java  Variables

1. Int, long, byte, short are the data types of _____data types?

unsigned signed both a. and b. None of these

2. Which of the following is correct?

int a = 16, a>>2 = 4 int b = -8, b>>1 = -4 int a = 16, a>>>2 = 4 All of the above

3. Which of the following is the mutable wrapper class?

Integer BigInteger Boolean Character

4. What is the range of data type short in Java?

-128 to 127 -32768 to 32767 -2147483648 to 2147483647 None of the mentioned

5. What is the range of data type byte in Java?

-128 to 127 -32768 to 32767 -2147483648 to 2147483647 None of the mentioned

6. Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;

1 and 2 2 and 3 3 and 4 All statements are correct.

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

int long byte float

8. 18. Which of these literals can be contained in a data type float variable?

1.7e-308 3.4e-038 1.7e+308 3.4e-050

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

int float double long

10. 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

 

*Click on the QNo to display a Question.

Total Ans

 

 

';
Aptitude Coaching - Free Live Session !!