Java MCQ Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

3. Automatic type conversion is possible in which of the possible cases?

INT to long

2. What is the size of float and double in java?

32 and 64

6. Find the output of the following program. public class Solution{ public static void main(String[] args){ byte x = 127; x++; x++; System.out.print(x); } }

-127

10. Select the valid statement to declare and initialize an array. int[] A = {} int[] A = {1, 2, 3} int[] A = (1, 2, 3) int[][] A = {1,2,3}

10. int[] A = {1, 2, 3}

8. Find the output of the following program. public class Solution{ public static void main(String[] args){ int[] x = {120, 200, 016}; for(int i = 0; i < x.length; i++){ System.out.print(x[i] + " ") ; } } }

120 200 14

4. Find the output of the following code. int Integer = 24; char String = 'I'; System.out.print(Integer); System.out.print(String);

24 I

1. Number of primitive data types in Java are?

8

5. Find the output of the following program. public class Solution{ public static void main(String[] args){ short x = 10; x = x * 5; System.out.print(x); } }

Compile error

9. When an array is passed to a method, what does the method receive? The reference of the array A copy of the array Length of the array Copy of first element

The reference of the array

7. Select the valid statement. char[] ch = new char(5) char[] ch = new char[5] char[] ch = new char() char[] ch = new char[]

char[] ch = new char[5]


Kaugnay na mga set ng pag-aaral

JROTC LET - The Stars and Stripes

View Set

Finances and Career Planning Quiz

View Set

Principles of Management: Chapter 14

View Set

Chapter 2: General Wisconsin Insurance Laws

View Set

Psychological Assessment-Item Analysis and Test Construction

View Set

General Psychology - Chapter 2: Psychology's Scientific Method

View Set

derivatives test one (ch 3 and 5)

View Set

Statistics 3.1-3.4 Assignment Questions

View Set

Personal Development ::: Personal Relationship

View Set