Data Types and Variables What will be output of following program?public class Test{ public static void main(String[] args){ byte b=127; b++; b++; System.out.println(b); }} Compiler error -127 2 None of these 129 Compiler error -127 2 None of these 129 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What will the output of the following program?public class Test{ public static void main(String args[]){ float f = (1 / 4) * 10; int i = Math.round(f); System.out.println(i); }} 2.5 25 3 2 0 2.5 25 3 2 0 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables The following program:public class Test{ static boolean isOK; public static void main(String args[]){ System.out.print(isOK); } } Will not compile as boolean is not initialized Will not compile as boolean can never be static Prints true Prints false Will not compile as boolean is not initialized Will not compile as boolean can never be static Prints true Prints false ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables Which of the following automatic type conversion will be possible? short to int long to int int to long byte to int short to int long to int int to long byte to int ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What is the output for the below code ?class A{ int k; boolean istrue; static int p; public void printValue(){ System.out.print(k); System.out.print(istrue); System.out.print(p); }}public class Test{ public static void main(String argv[]){ A a = new A(); a.printValue(); }} None of these 0 0 0 0 false 0 0 true 0 Compile error - static variable must be initialized before use. None of these 0 0 0 0 false 0 0 true 0 Compile error - static variable must be initialized before use. ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What is the output of the following program?public class Test{static int x = 10 ; public static void main(String[] a){ Test test = new Test( ) ; Test test1 = new Test( ) ; test.x += 1 ; System.out.println( test.x + test1.x ) ; }} Compilation Error 21 22 Throws Exception 20 Compilation Error 21 22 Throws Exception 20 ANSWER DOWNLOAD EXAMIANS APP