Welcome to your Java Programming MCQ
1.
What is the purpose of static keyword in Java?
What is the purpose of static keyword in Java?
2.
What is the correct way to initialize an array in Java?
What is the correct way to initialize an array in Java?
3.
What is the purpose of the System.out.println() method in Java?
What is the purpose of the System.out.println() method in Java?
4.
What is the purpose of void in method declarations in Java?
What is the purpose of void in method declarations in Java?
5.
How do you declare a generic class in Java?
How do you declare a generic class in Java?
6.
What is the purpose of import statement in Java?
What is the purpose of import statement in Java?
7.
How do you declare a multi-dimensional array in Java?
How do you declare a multi-dimensional array in Java?
8.
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?
9.
How do you catch an exception in Java?
How do you catch an exception in Java?
10.
How do you declare an interface in Java?
How do you declare an interface in Java?
11.
What is the purpose of this keyword in Java?
What is the purpose of this keyword in Java?
12.
What is the output of System.out.println(10 % 3); in Java?
What is the output of System.out.println(10 % 3); in Java?
13.
How do you define a class in Java?
How do you define a class in Java?
14.
What is the purpose of public access modifier in Java?
What is the purpose of public access modifier in Java?
15.
How do you declare a static method in Java?
How do you declare a static method in Java?
16.
How do you declare a constructor in Java?
How do you declare a constructor in Java?
17.
How do you declare a variable that cannot be modified in Java?
How do you declare a variable that cannot be modified in Java?
18.
What does the break statement do in a switch statement in Java?
What does the break statement do in a switch statement in Java?
19.
How do you declare an integer variable in Java?
How do you declare an integer variable in Java?
20.
How do you declare an abstract method in Java?
How do you declare an abstract method in Java?
21.
How do you dynamically allocate memory in Java?
How do you dynamically allocate memory in Java?
22.
What is the purpose of the super keyword in Java?
What is the purpose of the super keyword in Java?
23.
How do you pass an array to a method in Java?
How do you pass an array to a method in Java?
24.
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?
25.
What does the equals() method do in Java?
What does the equals() method do in Java?
26.
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?
27.
What is the purpose of try-catch block in Java?
What is the purpose of try-catch block in Java?
28.
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?
29.
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?
30.
How do you define a constant in Java?
How do you define a constant in Java?