Java Practice Problems
Sort by: Curriculum unit & section · Just problems, by category
Show: Everything · Lessons · Worksheets · Problems
- Build the line: declare and initialize temperature 1.1 Worksheet 🌶️ Click the tokens below, in order, to build a line that declares an integer variable named…
- Introduction to Algorithms 1.1 Worksheet 🌶️ An algorithm is an ordered series of steps to solve a problem. Let's say that you are …
- Parsons problem: Hello World structure 1.1 Worksheet 🌶️ Arrange the lines below to build a working Hello World program, with each line indented c…
- Line trace: swapping two values with temp 1.3 Worksheet 🌶️ Below is a method that swaps two values using a temp variable. Trace a, b, and temp immed…
- Boolean Operators: Quick Reference 2.1 Worksheet 🌶️ This page reviews the three boolean operators you'll use constantly in conditionals, then…
- Truth table: && vs || 2.2 Worksheet 🌶️ Complete the truth table below for the two boolean expressions.
- Venn diagram: A && !B 2.2 Worksheet 🌶️ Shade the region(s) of the diagram where the expression below is true.
- Venn diagram: (a || b) && !c 2.3 Worksheet 🌶️🌶️ Shade the region(s) of the diagram where the expression below is true.
- Venn diagram: four sets 2.3 Worksheet 🌶️🌶️🌶️ Shade the region(s) of the diagram where the expression below is true.
- Trace: cumulative even sum 4.4 Worksheet Consider the code below. Assume it compiles and runs correctly. ```java int total = 0; f…
- Trace: palindrome check indices 4.4 Worksheet 🌶️🌶️ Below is the loop from a palindrome checker for the String s = "level" (length 5). Trace …
- Parsons problem: Point constructor 5.1 Worksheet Below are candidate lines for a Point class's constructor, which takes parameters px and …
- Trace: factorial recursive calls 10.1 Worksheet 🌶️🌶️ Below is a recursive factorial method. Trace every call and every return as factorial(4) …
- Trace: fibonacci recursive calls 10.2 Worksheet 🌶️🌶️🌶️ Below is a recursive (non-memoized) Fibonacci method. Trace every call and every return a…