Welcome to your Java Programming MCQ
1.
What does the equals() method do in Java?
What does the equals() method do in Java?
2.
What is the purpose of void in method declarations in Java?
What is the purpose of void in method declarations in Java?
3.
How do you declare a method that does not return any value in Java?
How do you declare a method that does not return any value in Java?
4.
What is the purpose of the System.out.println() method in Java?
What is the purpose of the System.out.println() method in Java?
5.
How do you declare a variable that cannot be modified in Java?
How do you declare a variable that cannot be modified in Java?
6.
How do you write a for loop in Java that iterates 5 times?
How do you write a for loop in Java that iterates 5 times?
7.
How do you declare an interface in Java?
How do you declare an interface in Java?
8.
How do you declare a multi-dimensional array in Java?
How do you declare a multi-dimensional array in Java?
9.
How do you declare a generic class in Java?
How do you declare a generic class in Java?
10.
What is the purpose of import statement in Java?
What is the purpose of import statement in Java?
11.
How do you declare an integer variable in Java?
How do you declare an integer variable in Java?
12.
What is the purpose of static keyword in Java?
What is the purpose of static keyword in Java?
13.
How do you pass an array to a method in Java?
How do you pass an array to a method in Java?
14.
How do you declare a static method in Java?
How do you declare a static method in Java?
15.
What is the correct way to initialize an array in Java?
What is the correct way to initialize an array in Java?
16.
How do you define a class in Java?
How do you define a class in Java?
17.
How do you define a constant in Java?
How do you define a constant in Java?
18.
How do you declare a constructor in Java?
How do you declare a constructor in Java?
19.
How do you access the third element of an array arr in Java?
How do you access the third element of an array arr in Java?
20.
How do you dynamically allocate memory in Java?
How do you dynamically allocate memory in Java?
21.
What is the purpose of try-catch block in Java?
What is the purpose of try-catch block in Java?
22.
How do you open a file named data.txt for writing in Java?
How do you open a file named data.txt for writing in Java?
23.
What does the break statement do in a switch statement in Java?
What does the break statement do in a switch statement in Java?
24.
What is the purpose of public access modifier in Java?
What is the purpose of public access modifier in Java?
25.
What is the output of System.out.println(10 % 3); in Java?
What is the output of System.out.println(10 % 3); in Java?
26.
How do you declare an abstract method in Java?
How do you declare an abstract method in Java?
27.
What is the output of System.out.println("Hello".charAt(1)); in Java?
What is the output of System.out.println("Hello".charAt(1)); in Java?
28.
How do you catch an exception in Java?
How do you catch an exception in Java?
29.
What is the purpose of this keyword in Java?
What is the purpose of this keyword in Java?
30.
What is the purpose of the super keyword in Java?
What is the purpose of the super keyword in Java?