Programming  Java  Variables

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

unsigned signed both a. and b. None of these

Workspace

Comments

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

Workspace

Comments

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

Integer BigInteger Boolean Character

Workspace

Comments

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

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

Workspace

Comments

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

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

Workspace

Comments

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

Workspace

Comments

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

int long byte float

Workspace

Comments

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

Workspace

Comments

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

int float double long

Workspace

Comments

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

Workspace

Comments

 

*Click on the QNo to display a Question.

Total Ans