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