When and how whiteboarding practice is implemented will be up to your teacher. Below is a recommended prompt.
For this section's whiteboarding lesson, we’ll continue to practice with arrays, looping, and using C#'s basic operators (+
, -
, *
, /
, %
)
As the interviewee:
As the interviewer:
1st Prompt: Write a method that returns a boolean indicating whether a number is prime. Recall that a number is prime if it is greater than 1 and is not evenly divisible by any other numbers excepting 1 and itself.
Examples:
Given: 7, Output: true
Given: 2, Output: true
Given: 8, Output: false
2nd Prompt: Write a method that returns an array of all of the multiples for a given number. A multiple of a given number is a number that can be multiplied by a second number to make the given number.
Examples:
Given: 7, Output: [ 1, 7 ]
Given: 24, Output: [ 1, 2, 3, 4, 6, 8, 12, 24 ]
Write a method that returns an array of all the prime numbers that are less than a given number.
Write a method that returns the greatest common multiple (GCM) for two given numbers. The GCM is the largest number that both given numbers are evenly divisible by.