The following method takes in an int
representing some number of inches. Implement it so that it returns a string reporting the number of...
Exercises
The following method takes in a 2D character array. Somewhere in that array, there may be one '*'
character. This method should find that...
The following method will appear in a class with a generic type parameter T
. It takes in a 2D array of elements of that generic type T
,...
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The animated image below shows a traversal of a binary tree. Which type of traversal is it?
The image below shows an in progress inorder traversal. The nodes highlighted in purple have already been visited in order (e.g. 36 14 24...
The image below shows a binary tree. Which of the options below include only internal nodes?
The image below shows a binary tree. Which nodes are leaf nodes?
This Answer
class stores an integer called value
as a field. However, something is wrong with the constructor and it is not working...
This method returns the sum of ages stored in a 1-dimensional array. For example if ages
contains {24, 12, 32, 56}
, this method should...
The Rectangle
class below has two integer fields to store its length
and width
. The toString()
method should do the following:
- If the...
The method below returns the product of numbers from 1 to i
. For example, product(4)
should return 24 (or 1 * 2 * 3 * 4). However,...
This Person
class stores a String name
and an int id
. However the toString()
method is not working correctly. The toString()
method...
The following Dog
class stores a String name
and an integer numSpots
that represents how many spots the dog has on its fur. It also...
Write a function in C++ called factorial()
that will take a positive integer as input and returns its factorial as output.
A teacher is creating an answer key to a true/false quiz. They need a map that can store an integer question number and the corresponding...
Create a Map that can store Integer
ID numbers that will map to String
name values. Create a Map
object that can store such data. You...
For this question, you can assume you have access to a class called Pet
that stores all of the data that applies to a specific pet (name,...
A teacher is creating an answer key to a true/false quiz. They need a map that can store an integer question number and the corresponding...
Create a Set
that can hold a series of ages. All ages will be whole numbers (meaning no decimal point) represented as Integer
values. You...
For this question, create a Set
that can hold a set of names (ex. "Heather"). You do not need to add any values to the set, just create...
For this question, create a Set
that can hold a series of temperature values. All values will have a decimal point (no integers). You do...
The following method takes in a set of boolean values. Add both true
and false
to the set, and then return it.
The method below takes in a Set called strSet
and a string representing a person's name. Add the parameter name
to strSet
, then return...