Question 1 of 25
Hints left: 3
Q1
Automatic type conversion in Java takes place when
Q2
Which of the following automatic type conversion will be possible?
Q3
How many primitive data types are there in Java?
Q4
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); } }
Q5
What is the output of the following program? class A{ public static void main(String args[]){ byte b; int i = 258; double d = 325.59; b = (byte) i; System.out.print(b); i = (int) d; System.out.print(i); b = (byte) d; System.out.print(b); } }
Q6
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 ) ; } }
Q7
Java is a ........... language.
Q8
The following fraction of code double STATIC = 2.5 ; System.out.println( STATIC );
Q9
The smallest integer type is ......... and its size is ......... bits.
Q10
Which of the following is the correct way to declare a byte variable named myByte and initialize it to 5 in Java?
Q11
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); } }
Q12
Which data type is used to store numbers with decimal points and less precision than double?
Q13
Size of float and double in Java is
Q14
What will be output of the following program code? public class Test{ public static void main(String[] a){ short x = 10; x = x*5; System.out.print(x); } }
Q15
Which of the following is not a valid way to declare a char variable in Java?
Q16
Size of int in Java is
Q17
What is the range of values that can be stored in a char variable in Java?
Q18
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); } }
Q19
Determine output: public class Test{ int i = 34; public static void main(String args[]){ Test t1 = new Test(); Test t2 = new Test(); t1.i = 65; System.out.print(t1.i); System.out.print(t2.i); } }
Q20
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(); } }
Q21
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 ) ;
Q22
The following program: public class Test{ static boolean isOK; public static void main(String args[]){ System.out.print(isOK); } }
Q23
In Java, the word true is ................
Q24
What is the default value of a boolean array element in Java if it's not explicitly initialized?
Q25
In Java byte, short, int and long all of these are