Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

_____ refers to the combining of data and code into a single object. a) Data hid

ID: 3811643 • Letter: #

Question

_____ refers to the combining of data and code into a single object. a) Data hiding b) Abstraction c) Object d) Encapsulation Another term for an object of class is _____. a) access specifier b) instance c) member d) method It is common practice in object-oriented programming to make all of a a) methods private b) fields private c) fields public d) fields and methods public Instance methods do not have the key word static in their headers. a) True b) False The statement: double [] array1 = new double [10] a) Declares array1 to be a reference to an array of double values b) Creates an instance of an array of 10 double values c) Will allow valid subscripts in the range 0-9 d) All of the above What will be the results of the following code? final int ARRAY SIZE = 5; float [] x = new float [ARRAY-SIZE]; for (int i = 1; i

Explanation / Answer

28. d) Encapsulation refers to the combining of data and code into a single object.

29. b) Another term for an object of a class is instance. Because it represents the whole class.

30. b) It is common practice in object-oriented programming to make all of a class's fields Private. To hide sensitive information in variables such as username, passwords etc.

31. a) True

32. d) All the statements are true

33. d) There will be a compilation error because possibility of lose of information from double to float conversion. By default, Java uses double to represent its floating-point numerals (so a literal 10.0 is considered as double). Double is also the data type that will give you a much larger number range, so it is recommended to use double over float.

34. a) True, to compare the contents of two arrays, you must compare each elements to avoid array index errors and get accurate comparison.