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 20 Error 10 20 10 10 10 20 10 100 10 20 10 20 Error 10 20 10 10 10 20 10 100 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 Determine output:public class Test { static void test(float x){ System.out.print("float"); } static void test(double x){ System.out.print("double"); } public static void main(String[] args){ test(99.9); }} float Compilation Error Exception is thrown at runtime double float Compilation Error Exception is thrown at runtime double ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables What would be the output of the following fraction of code ?int Integer = 34 ;char String = 'S' ;System.out.print( Integer ) ;System.out.print( String ) ; 34 S 34 Throws exception. S Does not compile as Integer and String are API class names. 34 S 34 Throws exception. S Does not compile as Integer and String are API class names. 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. } 8 7 10 7 Compilation fails with an error at line 3 None of these Compilation fails with an error at line 5 8 7 10 7 Compilation fails with an error at line 3 None of these Compilation fails with an error at line 5 ANSWER DOWNLOAD EXAMIANS APP
Data Types and Variables The following fraction of codedouble STATIC = 2.5 ;System.out.println( STATIC ); Prints 2.5 None of these Raises an exception Rraises an error as STATIC is used as a variable which is a keyword Prints 2.5 None of these Raises an exception Rraises an error as STATIC is used as a variable which is a keyword ANSWER DOWNLOAD EXAMIANS APP