1-If a method does not return a value, the return value type must be static.
False
2-The expression !(true || true && false || !true) is evaluated to true.
False
3-Every array has a length that specifies the number of elements in the array.
True
4-It is possible for the body of a do-while statement to never be executed.
False (the body of the do-while method is always executed at least 1 time)
5-The statement import java.*.*; is valid if placed at the very top of a Java source file.
True
6-The expression s.indexOf(",") returns the position of a comma in s, a String object.
False (it returns int position of a comma in s, not String object)
7-The following statement System.out.print("Hi".compareTo("Hi") == 0); is correct.
True
8-The switch selection structure must end with the default case.
False (The default case in a switch structure is optional and only used when none of the other cases match. )
9-Variables declared in the body of a particular method are known as local variables.
True
10-int array = new int[10]; creates an integer array of size 10.
False ( correct: int[] array = new int[10];)
Comments
Leave a comment