

![]()


Computer Science I introduces fundamental concepts in computer science, focusing on problem-solving techniques, algorithm development, and basic programming skills. Through practical exercises, students learn the syntax and semantics of a selected programming language, typically covering variables, operators, control structures, functions, and data structures such as arrays and lists. The course emphasizes logical thinking, program design, testing, and debugging, preparing students for more advanced studies in the field.
Recommended Textbook
Java Foundations 3rd Edition by John Lewis
Available Study Resources on Quizplus
16 Chapters
639 Verified Questions
639 Flashcards
Source URL: https://quizplus.com/study-set/3997 Page 2

40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80262
Sample Questions
Q1) A syntax error is a _____________________.
A) a logical error
B) a compile-time error
C) a run-time error
D) a bug
E) an exception
Answer: B
Q2) Name the steps to solving a problem as described by your textbook.
Answer: According to the textbook, the five steps to solving a problem are understanding the problem, designing the solution, considering alternatives to the solution and refining the solution, implementing the solution, and testing the solution and fixing any problems that exist.
Q3) Write a short Java program that outputs your name, your major, and your birthday on three different lines.
Answer: 11edd9cc_2d01_9f13_84e8_134dfbf1e8f5_TB2841_00
Q4) Write a short application that prints out a list of classes that you are currently taking.
Answer: 11edd9cc_977a_6578_84e8_e16f97caa67b_TB2841_00
Q5) Write an application that prints the first few lines of a song (your choice).
Answer: 11edd9cc_5a45_7376_84e8_afca069acf96_TB2841_00
To view all questions and flashcards with answers, click on the resource link above. Page 3

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80257
Sample Questions
Q1) Write a short application that converts inches to centimeters. It should read the number of inches from the user as a floating point number and output the number of inches and the number of centimeters at the end of the program. Note that there are 2.54 centimeters in an inch.
Answer: 11edd9d0_01b8_da9d_84e8_4dcb8b77e1bb_TB2841_00
Q2) Which of the following is an example of an invalid assignment or declaration statement?
A) int age = 30;
B) int money, dollars = 0, cents = 0;
C) int years = 1; months = 12; days = 365;
D) int length, meters, centimeters, millimeters;
E) none of the above
Answer: C
Q3) The Scanner class must be imported using the import statement before it can be used in a program.
A)True
B)False
Answer: True
To view all questions and flashcards with answers, click on the resource link above.
4

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80255
Sample Questions
Q1) Write a short program that allows the user to enter the base and height of a triangle and outputs the hypotenuse, formatted to three decimal places. Answer: import java.util.Scanner; import java.text.DecimalFormat; public class Hypotenuse { public static void main(String [] args) { double base, height, hypotenuse; Scanner input = new Scanner(System.in); DecimalFormat fmt = new DecimalFormat("0.###"); System.out.print("Please enter the base: "); base = input.nextDouble(); System.out.print("Please enter the height: "); height = input.nextDouble(); hypotenuse = Math.sqrt(Math.pow(base,2) + Math.pow(height,2)); System.out.println("The hypotenuse is " + fmt.format(hypotenuse) + ".");
}//end main }//end class
Q2) Write a single line that creates a wrapper for an int variable num. Answer: Integer numWrapper = new Integer(num);
To view all questions and flashcards with answers, click on the resource link above. Page 5

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80254
Sample Questions
Q1) Write a code fragment that determines how many times the character 'A' appears in a String object called name.
Q2) The following snippet of code will not compile because the second part of the if statement needs to be on the second line. if(a < b) System.out.println("a is less than b");
A)True
B)False
Q3) Which of the following statements best describes the flow of control in the main method of a Java program that has no conditionals or loops?
A) Program statements are all executed at the same time.
B) Program statements are executed according to their priority, which is specified by the programmer.
C) Program statements are executed linearly, with earlier statements being executed first.
D) Program statements are executed linearly, with later statements being executed first.
E) Some program statements are executed at the same time, and others are executed in a linear manner.
To view all questions and flashcards with answers, click on the resource link above.

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80253
Sample Questions
Q1) In a class that has variables called height and width, methods called getHeight() and getWidth() are examples of accessor methods.
A)True
B)False
Q2) Explain why method overloading is useful.
Q3) A return statement is not required at the end of every method.
A)True
B)False
Q4) There are times when it is appropriate to return data from a method of a type that is inconsistent with the return type specified in the method header.
A)True
B)False
Q5) Write a method called maxOfThree that accepts three integer parameters and returns the largest of the three.
Q6) A main method can only access static or local variables.
A)True
B)False
Q7) What is encapsulation? How can it be enforced in Java?
Q8) What is the difference between an object and a class?
To view all questions and flashcards with answers, click on the resource link above. Page 7

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80252
Sample Questions
Q1) A dialog box allows the user to select one of several options from a "drop down" menu.
A)True
B)False
Q2) A(n) _______________________ is a graphical window that pops up on top of any currently active window so that the user can interact with it.
A) component
B) dialog box
C) event
D) listener
E) none of the above
Q3) Which of the following event descriptions best describes the mouse entered event?
A) The mouse button is pressed down
B) The mouse button is pressed down and released without moving the mouse in between
C) The mouse pointer is moved onto a component
D) The mouse button is released
E) The mouse is moved while the mouse button is pressed down
Q4) Explain the difference between check boxes and radio buttons.
To view all questions and flashcards with answers, click on the resource link above. Page 8

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80251
Sample Questions
Q1) Write a method that takes in an arbitrary number of String objects, and then prints out all of them that have over 10 characters.
Q2) Write a loop that cycles through an array of String objects called names and prints them out, one per line. Your loop should not use a foreach loop.
Q3) Write a method called doubleSize that accepts an integer array as a parameter and returns a reference to a new integer array that is twice as long and contains all of the elements of the first array in the same positions.
Q4) Multi-dimensional arrays that contain arrays of different lengths in any one dimension are called _________________.
A) ragged arrays
B) static arrays
C) two-dimensional arrays
D) constant arrays
E) overloaded arrays
Q5) There is only one way to declare and initialized an array in Java.
A)True
B)False
Q6) Explain how arrays are passed to methods as parameters.
To view all questions and flashcards with answers, click on the resource link above. Page 9

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80250
Sample Questions
Q1) Once a method is overridden in a subclass, the original version can never be referenced from within the subclass.
A)True
B)False
Q2) The derived class created using inheritace is called ______________________
.
A) a child class
B) a superclass
C) a parent class
D) all of the above
E) neither a, b, nor c
Q3) If a subclasses constructor does not make an explicit call to a superclass's constructor, ______________________ .
A) a run-time error will result.
B) a compile-time error will result.
C) the constructor will be called anyway.
D) the class will be implicitly declared as abstract.
E) none of the above
Q4) What is an abstract class, and why might it be useful in an inheritance hierarchy?
Q5) Explain why inheritance is useful.
To view all questions and flashcards with answers, click on the resource link above. Page 10

Available Study Resources on Quizplus for this Chatper
39 Verified Questions
39 Flashcards
Source URL: https://quizplus.com/quiz/80249
Sample Questions
Q1) Consider the following line of code. Comparable s = new String(); Which of the following statements is true about this line?
A) It will result in a compile-time error.
B) It will result in a run-time error.
C) It will create a String object pointed to by a Comparable reference.
D) Although it is perfectly valid Java, it should be avoided due to confusion.
E) none of the above are true
Q2) A parameter to a method can be polymorphic.
A)True
B)False
Q3) The next method of the Iterator interface returns a reference to the next element in a collection and removes it.
A)True
B)False
Q4) Late binding is _______________ than _______________ .
A) more efficient, compile-time binding
B) less efficient, compile-time binding
C) more efficient, run-time binding
D) less efficient, run-time binding
Q5) What is polymorphism?
To view all questions and flashcards with answers, click on the resource link above. Page 11

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80260
Sample Questions
Q1) Write a recursive method that computes the product of all of the even integers less than or equal to n.
Q2) Write a recursive method that computes the sum of the first n integers.
Q3) What is recursion?
Q4) All recursive methods must have a base case.
A)True
B)False
Q5) The Towers of Hanoi puzzle cannot be solved iteratively.
A)True
B)False
Q6) The recursive solution of the Towers of Hanoi problem has _______________ complexity.
A) exponential
B) polynomial
C) logarithmic
D) low
E) none of the above
Q7) Describe the Towers of Hanoi puzzle.
Page 12
Q8) Write a recursive method that returns the factorial of an integer.
Q9) Write the recursive definition of the factorial of a number.
To view all questions and flashcards with answers, click on the resource link above. Page 13

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80261
Sample Questions
Q1) The getMessage method of the Exception class prints out the stack trace, which helps the user to track down the source of the exception.
A)True
B)False
Q2) When accessing an element of an array, if the index is outside of the range of the indexes of the array, an exception is thrown.
A)True
B)False
Q3) Attempting to divide by zero will result in an Error being thrown, not an Exception.
A)True
B)False
Q4) Every line of a(n) __________________ is executed no matter what exceptions are thrown.
A) try block
B) call stack trace
C) catch block
D) interface
E) finally block
To view all questions and flashcards with answers, click on the resource link above. Page 14

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80259
Sample Questions
Q1) Explain what O(1) means.
Q2) Write a method that accepts an array of integers as a parameter and sorts them using the selection sort algorithm.
Q3) In the binary search algorithm, if the number of elements in the search pool is even, which value is used as the midpoint? Explain.
Q4) As the number of items in a search pool grows, the number of comparisons required to search _______________ .
A) increases B) decreases C) stays the same D) goes to 0 E) none of the above
Q5) With each comparison, a binary search eliminates approximately half of the items remaining in the search pool.
A)True
B)False
Q6) Write a method that accepts an integer and an array of integers, and returns true if the integer is contained in the array. The method should use a linear search.
To view all questions and flashcards with answers, click on the resource link above. Page 15

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80258
Sample Questions
Q1) Which of the following best describes a balanced tree?
A) A balanced trees has all nodes at exactly the same level.
B) A balanced tree has no nodes at exactly the same level.
C) A balanced tree has half of the nodes at one level and half the nodes at another level.
D) A balanced tree has all of the nodes within one level of each other.
E) none of the above correctly describe a balanced tree.
Q2) A balanced binary tree with m elements will have height ______________ .
A) 2m
B) 2<sup>m</sup>
C) log<sub>m</sub> 2
D) log<sub>2</sub> m
E) none of the above
Q3) What property of the tree does its order specify?
A) maximum height
B) maximum number of leaves
C) maximum number of internal nodes
D) maximum number of edges
E) maximum number of children per node
Q4) What is an internal node in a tree?
To view all questions and flashcards with answers, click on the resource link above. Page 16

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80248
Sample Questions
Q1) A stack is a LIFO structure.
A)True
B)False
Q2) What is the result of evaluating the following postfix expression: 4 8 + 2 *
A) 40
B) 24
C) 64
D) 20
E) none of the above are correct
Q3) In a circular array-based implementation of a queue, the elements must all be shifted when the dequeue operation is called.
A)True
B)False
Q4) A queue is helpful in implementing a __________________ sort.
A) insertion
B) selection
C) quick
D) radix
E) merge
Q5) List the five basic operations on a queue.
To view all questions and flashcards with answers, click on the resource link above. Page 17

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80247
Sample Questions
Q1) Does the find and add operations on a binary search tree always require at most O(log<sub>2</sub> n) comparisons? If so, why? If not, why not?
Q2) In the worst case, a general binary search tree could require __________________ comparisons to find an element.
A) O(1)
B) O(n)
C) O(2<sup>n</sup>)
D) O(log<sub>2</sub> n)
E) none of the above
Q3) A ____________________ is a complete binary tree in which each element is greater than or equal to both of its children.
A) binary search tree
B) stack
C) full tree
D) heap
E) none of the above
Q4) A binary search tree is always a full tree.
A)True
B)False
To view all questions and flashcards with answers, click on the resource link above. Page 18

Available Study Resources on Quizplus for this Chatper
40 Verified Questions
40 Flashcards
Source URL: https://quizplus.com/quiz/80256
Sample Questions
Q1) A __________________ traversal can be used to determine if a graph is connected.
A) inorder
B) preorder
C) depth-first
D) breadth-first
E) none of the above
Q2) In a(n) _____________________ graph, an edge from node labeled A to a node labeled B is the same as having an edge from B to A.
A) directed
B) undirected
C) sparse
D) tree-like
E) none of the above
Q3) What is the maximum number of edges in a directed graph on n vertices? Explain how you arrived at your solution.
Q4) Consider the following undirected graph.
vertices: 1, 2, 3, 4, 5 edges: (1,2),(3,4), (2,4), (2, 3), (3,5), (4,5)
Write out an adjacency matrix for this graph.
Q5) Write out all of the edges in a complete graph on 4 vertices.
To view all questions and flashcards with answers, click on the resource link above. Page 19