Data Types and Variables Determine output:class A{ public static void main(String args[]){ int x; x = 10; if(x == 10){ int y = 20; System.out.print("x and y: "+ x + " " + y); y = x*2; } y = 100; System.out.print("x and y: " + x + " " + y); }} 10 20 10 100 10 20 10 10 Error 10 20 10 20 10 20 10 100 10 20 10 10 Error 10 20 10 20 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What is the output for the below code ?1. public class Test{2. public static void main(String[] args){3. int i = 010;4. int j = 07;5. System.out.println(i);6. System.out.println(j);7. }8. } 10 7 None of these Compilation fails with an error at line 5 Compilation fails with an error at line 3 8 7 10 7 None of these Compilation fails with an error at line 5 Compilation fails with an error at line 3 8 7 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables Which of the following automatic type conversion will be possible? byte to int short to int long to int int to long byte to int short to int long to int int to long 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 can never be static Prints false Prints true Will not compile as boolean is not initialized Will not compile as boolean can never be static Prints false Prints true Will not compile as boolean is not initialized ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables How many primitive data types are there in Java? 9 6 7 8 9 6 7 8 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What is the output for the below code ?1. public class Test{2. public static void main(String[] args){3. byte b = 6;4. b+=8;5. System.out.println(b);6. b = b+7;7. System.out.println(b);8. }9. } None of these 14 13 Compilation fails with an error at line 4 14 21 Compilation fails with an error at line 6 None of these 14 13 Compilation fails with an error at line 4 14 21 Compilation fails with an error at line 6 ANSWER DOWNLOAD EXAMIANS APP