Question: All are multiple choice questions, please answer all if possible, Will give big thumbs up, It is greatly appreciated! Thank you 2. Consider the following
2. Consider the following code snippet: public class Vehicle private String type; public String Vehicle(String type What is wrong with this code? a) The class instance variable type must be initialized when it is declared b) The constructor must not have any arguments. c) The constructor must not have a retun type declared. d) The constructor's return type must be void. 3. The process of hiding object data and providing methods for data access is called a) documentation b) extension c) encapsulation 4. Which of the following statements about classes is correct? a) A class is an object that can be manipulated by a program. b) A class describes a set of objects with the same behavior c) Class is another name for a method. d) A class can contain only methods. S. Consider the following code snippet: Coin coin1 new Coin("dime, 0.10); Coin coin2 = new Coin("dime", 0.10); Which of the following statements is correct? a) coin1 and coin2 contain references to the same object. b ) coin 1 and coin2 refer to the same object. c) coin1 and coin2 contain the same memory location d) coin1 and coin2 each have their own set of instance variables. 6, Trying to access an element that is outside of the valid indices of an array generates what type of exception? a) NumberFormatException c) ArrayIndexoutofBoundsException b) IShouldHaveStudiedChapterTException d) IllegalStateException Consider the statement: Apple[] cart- new Apple[512 What type is cart [131 a) integer b) Apple c) String d) unknown All of the following are methods of the ArrayList class except: c) set0 8. a) length0 b) size0 d) get0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
