Title | CS1102 Self-quiz Unit 7 |
---|---|
Course | Programming 1 |
Institution | University of the People |
Pages | 2 |
File Size | 67.1 KB |
File Type | |
Total Downloads | 30 |
Total Views | 140 |
Download CS1102 Self-quiz Unit 7 PDF
Self-Quiz Unit 7 Question 1 Which one of the following does NOT describe an array? Select one: a. It can be used in a for-each loop. b. It has a numbered sequence of elements. c. It provides efficient random access to its elements. d. Its elements can be a primitive type. e. The number of its elements can change.
Question 2 Which one of the following does NOT describe an ArrayList? Select one: a. It can be used in a for-each loop. b. It has a numbered sequence of elements. c. It provides efficient random access to its elements. d. Its elements can be a primitive type. e. The number of its elements can change.
Question 3 Consider the following Java method. Which term best describes what this method computes? static double doSomething(int[] a) { int b = 0 ; for (int c : a) b += c; return (double)b/(double)a.length; } Select one: a. average b. maximum c. minimum d. sum
e. transpose
Question 4 What is the output of the following Java program? import java.util.*; class ArrayGames { public static void main(String[] args) { ArrayList a = new ArrayList(); for (i nt i = 1; i...