Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Introduction to Java Programming
Quiz 3: Selections
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Question 1
Multiple Choice
To create a set that consists of string elements "red", "green", and "blue", use
Question 2
Short Answer
Suppose List<String> list = new ArrayList<String>(). Which of the following operations are correct? A. list.add(new Integer(100)); B) list.add(new ArrayList()); C) list.add("Red"); D) list.add(new java.util.Date());
Question 3
Short Answer
To create a list to store integers, use B. ArrayList<Number> list = new ArrayList<Integer>(); C) ArrayList<Object> list = new ArrayList<Integer>(); D) ArrayList<int> list = new ArrayList<int>();
Question 4
Short Answer
Show the time complexity of the following program: for (int k = 0; k < 10; k++) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { System.out.print('*'); } } }
Question 5
Short Answer
Write a recursive mathematical definition for computing
for a positive integer.
Question 6
Essay
(Displaying words) Write a program that reads words separated by spaces from a text file and displays words in ascending order. (If two words are the same, display only one). Pass the text filename from the command line.
Question 7
Multiple Choice
Suppose your program frequently tests whether a student is in a soccer team, what is the best data structure to store the students in a soccer team?
Question 8
Multiple Choice
Suppose the rule of the party is that the participants who arrive later will leave earlier. Which data structure is appropriate to store the participants?
Question 9
Short Answer
Are there any compile errors in (a) and (b)?