You are on page 1of 1

1# (a) Define Java Virtual Machine (JVM)

(b) How to change the String into Integer?


(c) Given: arrayB = {20, 3, 4, 15, 92, 70, 8, 3, 50, 21}
arrayC = {5, 4, 3, 2, 1, 8, 7, 6, 5, 4}
Show the contents of these arrays after these instructions?
(i) System.arraycopy(arrayB,0,arrayC,3,4);
(ii)Arrays.sort(arrayB,3,7)
2# (a) What does the implements and extends keywords means?
(b) Write the instruction to generate a random number between 45 and 51?
(c) Determine the value, True or False, assuming that A= 12 and B=1.
(i) (A != 12) || (B < 2)
(ii) (B < 10) && ! (A < 5)
3# (a) What are the JRE, and JSL?
(b) Identify and fix the errors in the following code:
public class Welcome {
public void Main(String[] args) {
System.out.printline('Welcome to Java!);
}
)
(c) Write the correct statements for these equations;
(i) y 3T

RC

(ii) y

(ax 2 b)
c

4# (a) Give the instruction to generate the following output:


(b) Which of the following will output 1.5
(i) System.out.println(Math.floor( -1.5));
(ii) System.out.println(Math.ceil(-1.5));
(iii)
System.out.println(Math.max(-1.5, 1.5));
(c) What is the output:
public class Addition{
public static void main (String[] args) {
int a = 35, b = 8;
System.out.println("a or b =: " + (a | b) );
System.out.println("~a = " + (~a) );
System.out.println("a >> 3 =: " + (a >> 3) );
}
}

You might also like