1. What is output of bellow code?
B. 2.0
C. 2
D. 3.0
A. 2.5
2. What is output of bellow code?
B. 2.0
C. 2
D. 3.0
C. 2
3. What is output of bellow code?
B. 11.25
C. 11.0
D. 11
C. 11.0
4. What is output of bellow code?
B. 90
C. 97
D. 122
D. 122
5. What is output of bellow code?
B. Addition = 15.9
C. Addition = 15.89
D. Addition = 16.0
A. Addition = 10.55.4
6. What is output of bellow code?
B. 15.9 = Addition
C. 15.89 = Addition
D. 16.0 = Addition
B. 15.9 = Addition
7. What is output of bellow code?
B. 1
C. Compile error
D. Run-time error
A. 0
8. What is output of bellow code?
B. Garbage Value
C. Compile error
D. Run-time error
A. 0
9. What is output of bellow code?
B. Garbage Value
C. 0
D. Run-time error
D. Run-time error
10. What is output of bellow code?
B. 35.5
C. 60.5
D. 70.5
D. 70.5
11. What is output of bellow code?
B. 30 30 60
C. 30 30 30
D. 60 60 60
C. 30 30 30
12. What is output of bellow code?
B. 10 20 24
C. 10 20 030
D. Compile error
B. 10 20 24
13. What is output of bellow code?
B. 0 0
C. 10 20 30 40
D. 30 40
A. 10 20
14. What is output of bellow code?
B. 0
C. 10
D. Garbage Value
B. 0
15. When you pass an array to a method, the method receives ________.
A. A copy of the array.
B. A copy of the first element.
C. The reference of the array.
D. The length of the array.
C. The reference of the array.
16. In Java arrays are
A. Objects
B. Primitive data type
C. Object references
D. None of the above
A. Objects
17. What is output of bellow code?
B. 1.0
C. 2
D. 2.0
D. 2.0
18. Which will legally declare, construct, and initialize an array?
A. int[] myList = {
B. int[] myList = (5, 8, 2);
C. int myList[][] = {4,9,7,0};
D. int myList[] = {4, 3, 7};
D. int myList[] = {4, 3, 7};
System.out.println(5/2.0);
A. 2.5B. 2.0
C. 2
D. 3.0
A. 2.5
2. What is output of bellow code?
System.out.println(8/3);
A. 2.5B. 2.0
C. 2
D. 3.0
C. 2
3. What is output of bellow code?
int i= 5;
int z= 10;
double d = 5 + i * z /8;
System.out.println(d);
A. 11.15int z= 10;
double d = 5 + i * z /8;
System.out.println(d);
B. 11.25
C. 11.0
D. 11
C. 11.0
4. What is output of bellow code?
int c = ‘z’;
System.out.println(c);
A. 65System.out.println(c);
B. 90
C. 97
D. 122
D. 122
5. What is output of bellow code?
System.out.println("Addition = " + 10.5 + 5.4);
A. Addition = 10.55.4B. Addition = 15.9
C. Addition = 15.89
D. Addition = 16.0
A. Addition = 10.55.4
6. What is output of bellow code?
System.out.println(10.5 + 5.4 + " = Addition");
A. 10.55.4 = AdditionB. 15.9 = Addition
C. 15.89 = Addition
D. 16.0 = Addition
B. 15.9 = Addition
7. What is output of bellow code?
public class Arrays {
public static void main(String... args) {
int[] array = new int[0];
System.out.print(array.length);
}
}
A. 0public static void main(String... args) {
int[] array = new int[0];
System.out.print(array.length);
}
}
B. 1
C. Compile error
D. Run-time error
A. 0
8. What is output of bellow code?
public class Arrays {
public static void main(String[] args) {
int[] x = new int[3];
System.out.println(x[0]);
}
}
A. 0public static void main(String[] args) {
int[] x = new int[3];
System.out.println(x[0]);
}
}
B. Garbage Value
C. Compile error
D. Run-time error
A. 0
9. What is output of bellow code?
public class Arrays {
public static void main(String []args) {
int[] a = {1, 2, 3, 4, 5, 8};
System.out.println(a[6]);
}
}
A. 8public static void main(String []args) {
int[] a = {1, 2, 3, 4, 5, 8};
System.out.println(a[6]);
}
}
B. Garbage Value
C. 0
D. Run-time error
D. Run-time error
10. What is output of bellow code?
public class Arrays {
static Double[] methodOne(Double[] D) {
D[1] = 35.5;
return methodTwo(D);
}
static Double[] methodTwo(Double[] D) {
D[1] = 60.5;
return methodThree(D);
}
static Double[] methodThree(Double[] D) {
D[1] = 70.5;
return D;
}
public static void main(String[] args) {
Double[] D = {10.5, 20.5, 30.5, 40.5, 50.5};
D = methodOne(D);
System.out.println(D[1]);
}
}
A. 20.5static Double[] methodOne(Double[] D) {
D[1] = 35.5;
return methodTwo(D);
}
static Double[] methodTwo(Double[] D) {
D[1] = 60.5;
return methodThree(D);
}
static Double[] methodThree(Double[] D) {
D[1] = 70.5;
return D;
}
public static void main(String[] args) {
Double[] D = {10.5, 20.5, 30.5, 40.5, 50.5};
D = methodOne(D);
System.out.println(D[1]);
}
}
B. 35.5
C. 60.5
D. 70.5
D. 70.5
11. What is output of bellow code?
public class Arrays {
static int[] one(int[] a) {
int[] b = new int[30];
a = b;
System.out.print(a.length + " ");
System.out.print(b.length + " ");
return a;
}
public static void main(String[] args) {
int[] a = new int[60];
a=one(a);
System.out.print(a.length);
}
}
A. 30 60 60static int[] one(int[] a) {
int[] b = new int[30];
a = b;
System.out.print(a.length + " ");
System.out.print(b.length + " ");
return a;
}
public static void main(String[] args) {
int[] a = new int[60];
a=one(a);
System.out.print(a.length);
}
}
B. 30 30 60
C. 30 30 30
D. 60 60 60
C. 30 30 30
12. What is output of bellow code?
public class Arrays {
public static void main(String[] args) {
int[] arr = { 10, 20, 030 };
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
}
A. 10 20 30public static void main(String[] args) {
int[] arr = { 10, 20, 030 };
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
}
B. 10 20 24
C. 10 20 030
D. Compile error
B. 10 20 24
13. What is output of bellow code?
public class Arrays {
public static void main(String[] args) {
int[] a = { 10, 20, 30, 40 };
int[] b = a;
a = new int[2];
for (int i = 0; i < a.length; i++) {
System.out.print(b[i] + " ");
}
}
}
A. 10 20public static void main(String[] args) {
int[] a = { 10, 20, 30, 40 };
int[] b = a;
a = new int[2];
for (int i = 0; i < a.length; i++) {
System.out.print(b[i] + " ");
}
}
}
B. 0 0
C. 10 20 30 40
D. 30 40
A. 10 20
14. What is output of bellow code?
public class Arrays {
public static void main(String[] args){
int[] a = new int[4];
a[1] = 1;
a = new int[2];
System.out.println(a[1]);
}
}
A. 1public static void main(String[] args){
int[] a = new int[4];
a[1] = 1;
a = new int[2];
System.out.println(a[1]);
}
}
B. 0
C. 10
D. Garbage Value
B. 0
15. When you pass an array to a method, the method receives ________.
A. A copy of the array.
B. A copy of the first element.
C. The reference of the array.
D. The length of the array.
C. The reference of the array.
16. In Java arrays are
A. Objects
B. Primitive data type
C. Object references
D. None of the above
A. Objects
17. What is output of bellow code?
public class Arrays {
public static void main(String[] args) {
double[] x = new double[] { 1, 2, 3 };
System.out.println(x[1]);
}
}
A. 1public static void main(String[] args) {
double[] x = new double[] { 1, 2, 3 };
System.out.println(x[1]);
}
}
B. 1.0
C. 2
D. 2.0
D. 2.0
18. Which will legally declare, construct, and initialize an array?
A. int[] myList = {
B. int[] myList = (5, 8, 2);
C. int myList[][] = {4,9,7,0};
D. int myList[] = {4, 3, 7};
D. int myList[] = {4, 3, 7};
No comments:
Post a Comment