Data Types in Java MCQs

@T-Bone

This question paper focuses on the "Data Types" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This question paper focuses on the "Data Types" of the Java programming. These Multiple Choice Questions (mcq) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. Which of the following is smallest integer data type ?

Mark the correct option

2. Which of the following is not a primitive data type ?

Mark the correct option

3. Integer Data type does not include following primitive data type ____________.

Mark the correct option

4. Which of the following data types comes under floating data types ?

Mark the correct option

5. Character data type cannot store following value.

Mark the correct option

6. Range of Byte Data Type is ____________.

Mark the correct option

7. What is size of integer in Java Programming.

Mark the correct option

8. Which of the following data type(s) can store 64 bit Value.

Mark the correct option

9. Short data type has a minimum value of _____________.

Mark the correct option

10. Default value of variable having boolean data type is ___________.

Mark the correct option

11. What will be the output of the program? class Main { public static void main(String args[]) { int t; System.out.println(t); } }

Mark the correct option

12. What will be the output of the program? class Test { public static void main(String[] args) { for(int i = 0; 0; i++) { System.out.println(""Hello""); break; } } }

Mark the correct option

13. What will be the output of the program? class mainclass { public static void main(String args[]) { boolean var1 = true; boolean var2 = false; if (var1) System.out.println(var1); else System.out.println(var2); } }

Mark the correct option

14. Predict the output of the following program. class LFC { public static void main(String[] args) { Double object = new Double("2.4"); int a = object.intValue(); byte b = object.byteValue(); float d = object.floatValue(); double c = object.doubleValue(); System.out.println(a + b + c + d ); } }

Mark the correct option

15. 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;

Mark the correct option

16. 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); } }

Mark the correct option

17. What is the output of this program? class output { public static void main(String args[]) { double a, b,c; a = 4.0/0; b = 0/3.0; c=0/0.0; System.out.println(a); System.out.println(b); System.out.println(c); } }

Mark the correct option

18. What will be the output of the program? class increment { public static void main(String args[]) { int g = 4; System.out.print(++g * 8); } }

Mark the correct option

19. What will be the output of the program? class area { public static void main(String args[]) { double r, pi, a; r = 9.8; pi = 3.14; a = pi * r * r; System.out.println(a); } }

Mark the correct option

20. What will be the output of the program? class increment { public static void main(String args[]) { int g = 6; System.out.print(--g * 8); } }

Mark the correct option

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

Mark the correct option

22. 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;

Mark the correct option

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

Mark the correct option

24. Which of these literals can be contained in float data type variable?

Mark the correct option

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

Mark the correct option

26. Which of these coding types is used for data type characters in Java?

Mark the correct option

27. Which one is a valid declaration of a boolean?

Mark the correct option

28. What is the output of this program? class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = 'i'; System.out.print(array_variable[i] + """" ); i++; } } }

Mark the correct option

29. Which of these is long data type literal?

Mark the correct option

30. Which of these can be returned by the operator &?

Mark the correct option