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 true Will not compile as boolean is not initialized Prints false TRUE ANSWER : ? YOUR ANSWER : ?
Which of the following automatic type conversion will be possible? byte to int int to long short to int long to int TRUE ANSWER : ? YOUR ANSWER : ?
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 TRUE ANSWER : ? YOUR ANSWER : ?
Determine output:public class Test{ int a = 10; public void method(int a){ a += 1; System.out.println(++a); } public static void main(String args[]){ Test t = new Test(); t.method(3); }} 11 12 4 None of these 5 TRUE ANSWER : ? YOUR ANSWER : ?
Size of float and double in Java is 32 and 32 64 and 64 32 and 64 64 and 32 TRUE ANSWER : ? YOUR ANSWER : ?
The following fraction of codedouble STATIC = 2.5 ;System.out.println( STATIC ); Raises an exception Rraises an error as STATIC is used as a variable which is a keyword Prints 2.5 None of these TRUE ANSWER : ? YOUR ANSWER : ?
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); }} Error 10 20 10 10 10 20 10 100 10 20 10 20 TRUE ANSWER : ? YOUR ANSWER : ?
What is the output for the below code?public class Test{ int _$; int $7; int do; public static void main(String argv[]){ Test test = new Test(); test.$7=7; test.do=9; System.out.println(test.$7); System.out.println(test.do); System.out.println(test._$); }} Compile error - $7 is not valid identifier. Compile error - do is not valid identifier. 7 0 0 7 9 0 None of these TRUE ANSWER : ? YOUR ANSWER : ?
Java is a ........... language. strongly typed weakly typed None of these moderate typed TRUE ANSWER : ? YOUR ANSWER : ?
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); }} 0 3 25 2.5 2 TRUE ANSWER : ? YOUR ANSWER : ?