Consider the following code snippet:public static void check(ArrayList chknum1){ int cnt = 0; for(int i = 0; i < chknum1.size(); i++) { if(chknum1.get(i) == 0) { cnt++; } } System.out.println("The total 0 values in the list are: " + cnt);}Which one of the following is true about the check method in the given code snippet?Select one:a. The check method counts all the elements with value 0 in an array list passed as a parameter to the method.b. The check method removes all the elements with value 0 from an array list passed as a parameter to the method.c. The check method counts all the elements with value 0 in an array list passed as a parameter to a method and also returns the count.d. The check method adds 0 to the elements of an array list as a parameter to a method and also returns the array list.
In the given question a method is defined that is "check" this method accepts the array list as a parameter and does not return any value because its returns type is void.
Inside a function, we define an integer variable that is "cnt" and define a loop inside a loop we use conditional statement in the if block we check array list object value is equal to 0. If this condition is true it will print cnt value.
In this question accept option A, all other options are wrong because these options will not count all array elements.