AmbitionBox

Discover Best Places to work in India

Java Programming

Java Programming Questions and Answers

Showing 51 - 60 of 150 questions

51

Which of these array declarations and initializations are legal?

a

int arr[4] = new int[4];

b

int[4] arr = new int[4];

c

int arr[] = new int[4][4];

d

int[] arr = new int[4];

correct answer d
52

Which of these statements is illegal.

a

int arr[][] = new int[5][5];

b

int []arr[] = new int[5][5];

c

int[][] arr = new int[5][5];

d

int[] arr = new int[5][];

correct answer d
53

Given a one dimensional array arr, what is the correct way of getting the number of elements in arr. Select the one correct answer

a

arr.length

b

arr.size

c

arr.length()

d

arr.length() - 1

correct answer a
54

Which of the following class is not included in java.lang?

a

Byte

b

Integer

c

Array

d

Class

correct answer c
55

Which of these is a process of converting a simple data type into a class?

a

type wrapping

b

type conversion

c

type casting

d

None of the above

correct answer a
56

Which of these is a super class of wrappers Double & Integer?

a

Long

b

digits

c

float

d

number

correct answer d
57

Which of these methods is used to check for infinitely large and small values?

a

isInfinite()

b

isNaN()

c

IsInfinite()

d

IsNaN()

correct answer a
58

What is the output of this program?

classisinfinite_output{
        publicstaticvoidmain(String args[]){
            Double d = new Double(1 / 0.);  
            boolean x = d.isInfinite();
            System.out.print(x);
        }
    }
a

0

b

1

c

True

d

False

correct answer c
59

What is the output of this program?

classisNaN_output{
        publicstaticvoidmain(String args[]){
            Double d = new Double(1 / 0.);  
            boolean x = d.isNaN();
            System.out.print(x);
        }
    }
a

0

b

1

c

True

d

False

correct answer d
60

What is the output of this program?

classbinary{
         publicstaticvoidmain(String args[]){
             int num = 17;
             System.out.print(Integer.toBinaryString(num));
        }
    }
a

1001

b

10011

c

11011

d

10001

correct answer d
Select a company to compare with

vs

Similar Companies