Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q481: Which of the following types does Java support for arrays?
- A: Structs
- B: Enums
- C: Union
- D: Reference types
View Answer
D
Q482: What is the maximum number of public classes allowed in a single Java source file?
- A: None
- B: One
- C: Two
- D: Multiple
View Answer
B
Q483: What file extension does the compiled Java code have?
- A: .java
- B: .class
- C: .src
- D: .exe
View Answer
B
Q484: What is the purpose of the System.arraycopy method in Java?
- A: Copies data from one array to another
- B: Sorts an array
- C: Reverses an array
- D: Fills an array with default values
View Answer
A
Q485: In Java, what happens if you try to access an array element out of bounds?
- A: Runtime error
- B: Compilation error
- C: Program terminates successfully
- D: None of the above
View Answer
A
Q486: In Java, which of the following types is used to declare a reference to an array?
- A: int[] A
- B: int A[]
- C: int[]
- D: A[]
View Answer
A
Q487: In Java, how do you determine the length of an array at runtime?
- A: Using "length" operator
- B: Using "size" method
- C: Using "length()" method
- D: Using "getSize" method
View Answer
A
Q488: Which of the following is true about arrays in Java?
- A: All arrays are dynamically sized
- B: Arrays can be multidimensional
- C: Only one-dimensional arrays are supported
- D: None of the above
View Answer
B
Q489: Which keyword is used to declare a constant in Java?
- A: const
- B: final
- C: static
- D: immutable
View Answer
B
Q490: What is the default value for a reference type variable in Java?
- A: 1
- B: null
- C: undefined
- D: 0
View Answer
B