Data Types And Variables MCQs
Practice Data Types And Variables MCQs for competitive exams.
Data Types And Variables MCQs
Practice questions from this topic.
What will be the output of the following Java code snippet? enum Enums { A, B, C; private Enums() { System.out.println(10); } } public class MainClass { public static void main(String[] args) { Enum en = Enums.B; } }
Correct Answer: A
What is the limitation of toString() method of BigDecimal?
Correct Answer: D
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); } }
Correct Answer: C
What will be the output of the following Java code snippet? class A { } enum Enums extends A { ABC, BCD, CDE, DEF; }
Correct Answer: B
Which class is a library of functions to perform arithmetic operations of BigInteger and BigDecimal?
Correct Answer: A
How to get UTC time?
Correct Answer: C
What is the order of variables in Enum?
Correct Answer: D
Which of these is long data type literal?
Correct Answer: A
Literals in java must be appended by which of these?
Correct Answer: D
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++; } } }
Correct Answer: A
What will be the output of the following Java code? 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); } }
Correct Answer: C
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); } }
Correct Answer: B
