Java Questions & Answers – Character and Boolean Data Types Posted on June 10, 2020June 10, 2020 by admin 1 Created on June 10, 2020 By admin Java Questions & Answers – Character and Boolean Data Types 1 / 10 1. What is the numerical range of a char data type in Java? A. -128 to 127 B. 0 to 256 C. 0 to 32767 D. 0 to 65535 2 / 10 2. Which of these coding types is used for data type characters in Java? A. ASCII B. ISO-LATIN-1 C. UNICODE D. None of the mentioned 3 / 10 3. Which of these values can a boolean variable contain? A. True & False B. 0 & 1 C. Any integer value D. true 4 / 10 4. Which of these occupy first 0 to 127 in Unicode character set used for characters in Java? A. ASCII B. ISO-LATIN-1 C. None of the mentioned D. ASCII and ISO-LATIN1 5 / 10 5. Which one is a valid declaration of a boolean? A. boolean b1 = 1; B. boolean b2 = ‘false’; C. boolean b3 = false; D. boolean b4 = ‘true’ 6 / 10 6. What will be the output of the following Java 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++; } } } A. i i i i i B. 0 1 2 3 4 C. i j k l m D. None of the mentioned 7 / 10 7. What will be the output of the following Java program? class mainclass { public static void main(String args[]) { char a = 'A'; a++; System.out.print((int)a); } } A. 66 B. 67 C. 65 D. 64 8 / 10 8. What will be the output of the following Java 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); } } A. 0 B. 1 C. true D. false 9 / 10 9. What will be the output of the following Java code? class booloperators { public static void main(String args[]) { boolean var1 = true; boolean var2 = false; System.out.println((var1 & var2)); } } A. 0 B. 1 C. true D. false 10 / 10 10. What will be the output of the following Java code? class asciicodes { public static void main(String args[]) { char var1 = 'A'; char var2 = 'a'; System.out.println((int)var1 + " " + (int)var2); } } A. 162 B. 65 97 C. 67 95 D. 66 98 Your score is The average score is 20% LinkedIn Facebook Twitter 0% Restart quiz