Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q501: Java arrays are ________ compared to C++ arrays.
- A: Dynamically sized
- B: Fixed size
- C: Immutable
- D: Unchangeable
View Answer
B
Q502: Fill in the blank: In Java, the storage for an array is allocated only when you use the _______ keyword.
- A: new
- B: allocate
- C: create
- D: build
View Answer
A
Q503: Fill in the blank: The keyword used to declare constants in Java is _______.
- A: final
- B: static
- C: const
- D: immutable
View Answer
B
Q504: Fill in the blank: The size of a Java array cannot be changed once it has been _______.
- A: initialized
- B: declared
- C: created
- D: allocated
View Answer
C
Q505: What does a constructor function in Java do?
- A: Initializes an instance of a class
- B: Overloads methods
- C: Creates an object of a class
- D: Overrides a class method
View Answer
A
Q506: Which of the following types cannot be implicitly converted to other primitive types in Java?
- A: Booleans
- B: Shorts
- C: Longs
- D: Floats
View Answer
A
Q507: In Java, which type of conversion requires explicit casting?
- A: Implicit conversion
- B: Character conversion
- C: Primitive type conversion
- D: Overloading methods
View Answer
B
Q508: Which of the following is a valid statement for defining a public method in Java?
- A: public void methodName(){}
- B: private void methodName(){}
- C: protected void methodName(){}
- D: void methodName(){}
View Answer
A
Q509: In Java, all classes are implicitly subclasses of which class?
- A: Object
- B: Class
- C: System
- D: Package
View Answer
A
Q510: What happens when you assign one array to another array in Java?
- A: The arrays point to the same memory location
- B: The arrays are copied element by element
- C: A compile-time error occurs
- D: A runtime exception occurs
View Answer
A