[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given an array of int
values, return true if the group of n
numbers at the start...
Search Results
Searching for: O
Individual Exercises
Design a recursive method for scrambling Strings of length 3 or more. It must swap the first and last character of the input String, then...
There exists an abstract class Bird.
public abstract class Bird { public Bird() {} public String eat() { return "worms"; } public...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Write a function in Java that takes an int
array as its parameter. It should...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given an array containing three ints, return the sum of all the elements.
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Write a function in Java that implements the following logic: Given a string,...
A local grocery store has asked you to design a method to verify if their produce is okay to put on the shelves. The method takes an...
The method wabbajack()
is defined as follows:
public String wabbajack(String input) { if (input.length() < 5) { return "Rabbit"; }...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Write a function in Java that returns a version of the given array where all the...
Write a recursive function int countBTleaves(BinNode root)
to count the number of leaf nodes in the binary tree pointed at by root
. You...
A string is a palindrome if it reads the same forward and backward, with case insensitivity. For example, the words "mom", "dad", "Mom",...
Write a function in Python called 'factorial()' that will take a positive integer as input and returns its factorial as output....
Write a function in C++ called 'factorial' that will take a positive integer as input and returns its factorial. In math, a factorial is...
Write a function in Ruby called 'factorial()' that will take a positive integer as input and returns its factorial as output. backwards.
...Write a function that returns true if a
is even, false otherwise. Just for practice, you must use an if
statement.
This method takes an array of integers as its parameters and returns nothing. The method moves each element in the array to the right by...
This method takes an array of integers as a parameter. It returns true if the elements in the array are unique, false otherwise. For...
Complete this method to return the two String parameters combined (concatenated) together.
Write a Java statement to declare an integer variable with the name hours
that has an initial value of 7.
Complete this method to print out the parameter.
Complete this method to produce the following output:
Every java programmer must understand the difference between a System.out.print...
Complete this method to print the two String parameters combined (concatenated) together.
Complete this method to return the parameter received.
This method takes an integer array as a parameter and returns true if the array includes an odd integer; otherwise, the method returns...
This method accepts two integer arrays as its parameters and returns a new array, which contains all of the elements of first parameter...