Java Basic Programs for Beginners
Java Basic Programs for Beginners - Important Points
11. | Which of the following is not a control structure in Java? |
---|
A. if
B. for
C. switch
D. call
View Answer Discuss Work SpaceAnswer: option d
Explanation:
12. | What is the output of the following program? public class Main { |
---|
A. 2.5
B. 2
C. 3
D. 5
View Answer Discuss Work SpaceAnswer: option b
Explanation:
13. | What is the output of the following program? public class Main { |
---|
A. 1
B. 0
C. Compile error
D. Runtime error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
14. | Which of the following is a valid way to declare and initialize an array of integers in Java? |
---|
A. int[] arr = new int[5];
B. int arr[5] = {1, 2, 3, 4, 5};
C. int[] arr = {1, 2, 3, 4, 5};
D. int arr[] = new int[]{1, 2, 3, 4, 5};
View Answer Discuss Work SpaceAnswer: option c
Explanation:
15. | What is the output of the following program? public class Main { |
---|
A. 1
B. 0
C. Compile error
D. Runtime error
View Answer Discuss Work SpaceAnswer: option a
Explanation: