Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q491: Which of the following is NOT a valid array declaration in Java?
  • A: int[] A = new int[5];
  • B: int A[] = new int[5];
  • C: int[5] A;
  • D: int[] A = {1, 2, 3};
View Answer
C

Q492: What is the correct way to declare a two-dimensional array in Java?
  • A: int[][] A;
  • B: int[] A[];
  • C: int[5][5] A;
  • D: Two-dimensional arrays are not allowed
View Answer
A

Q493: What is the purpose of the main function in Java?
  • A: To start the execution of a program
  • B: To perform calculations
  • C: To define global variables
  • D: To manage memory
View Answer
A

Q494: Java eliminates which of the following C++ features?
  • A: Multiple inheritance
  • B: Pointers
  • C: Structs
  • D: All of the above
View Answer
D

Q495: What type of data type is used for storing a single 16-bit Unicode character in Java?
  • A: byte
  • B: char
  • C: int
  • D: long
View Answer
B

Q496: What is the file extension for Java source code?
  • A: .java
  • B: .class
  • C: .js
  • D: .txt
View Answer
A

Q497: Which of the following is true about arrays in Java?
  • A: They are fixed size once declared
  • B: They can only store integers
  • C: They cannot be multidimensional
  • D: None of the above
View Answer
A

Q498: Which Java class method is used to output text to the console?
  • A: System.out.println
  • B: System.print()
  • C: Stream.out.println
  • D: Console.write()
View Answer
A

Q499: Which of the following is NOT allowed in a Java source file?
  • A: Multiple main functions
  • B: One public class
  • C: Multiple classes
  • D: Single class
View Answer
B

Q500: What will the statement "System.arraycopy(A, 0, B, 0, 5)" do in Java?
  • A: Copies 5 elements from array A to array B
  • B: Copies 5 elements from array B to array A
  • C: Sorts array A
  • D: Reverses array A
View Answer
A

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now