I’m stuck on a Programming question and need an explanation.
Need all these questions checked and need correct answers for the whole test. I have provided the test in a word document.
If you need screen shots of the test they are here TEST 1 – MIDTERM – 1) What is the value of names[4] in the following array? String[] names - {"Jeff", "Dan", "Sally", "Jill", "Allie"}; a) Sally b) Allie (CORRECT) c) Jill d) None 2) Values held by attributes of an object describe the object's a) identity (CORRECT) b) operation c) state d) class 3) Which of the following can contain multiple entries and can grow its size/length automatically? a) Array (CORRECT) b) HashMap c) String d) StringBuilder 4) Which keyword is used to indicate that a class cannot be extended through inheritance a) abstract b) final (CORRECT) c) public d) static 5) An abstract class cannot a) be instantiated b) have abstract methods c) be used as a superclass d) have fields/attributes (CORRECT) 6) What is wrong with the following constant declaration? final int count = "2"; a) type int is not valid for final designation b) count is a Java reserved keyword and cannot be used as an identifier (CORRECT) c) count must be assigned an integer value d) visibility is not provided for the constant. 7) What value is printed for the following statement? int n = 0; for (int i=1; i < 6; i = i + 2) { n = n + 1; } System.out.println(n); a) 2 b) 3 (CORRECT) c) 4 d) 5 8) What happens when this statement is executed? Automobile car = new Automobile (1); a) An object of the Automobile class is created. (CORRECT) b) An object of the Automobile class is declared, but not created. c) A constructor that accepts a string in the Automobile class is called. d) The default constructor in the Automobile class is called. 9) A methods signature is defined by which of the following? a) method name only b) method name, number of arg, and arg types c) method name, number of arg, abd arg types and sequences d) method name, number of arg, arg types and sequences, and method return type (CORRECT) 10) The maximum number of interfaces which can be implemented by a class is a) zero b) one c) two d) more than two (CORRECT) 11) Two or more methods in the same class may have the same name as long as ___ are different. a) their return values (CORRECT) b) their signatures c) the statements within their curley braces d) their access specifiers 12) Where an object is passed as an argument for a method _________ is actually passed. a) a copy of the object b) a reference to the object c) the name of the object d) none of the following 13) What keyword do you use in class declaration to create a subclass? a) extends