Skip to content

Programming test

Rajesh Khadka edited this page Apr 3, 2019 · 2 revisions

Questions:

  1. Find the count of prime numbers given by the user? test cases

    countPrime(100) = 25
    countPrime(100000) = 9592
    fun countPrime(number: Int):Int {
        - your code
        
    }
    
  2. you are given a string of space separated numbers, and have to return the highest and lowest number.

    highAndLow("1 2 3 4 5")  // return "5 1"
    highAndLow("1 2 -3 4 5") // return "5 -3"
    highAndLow("1 9 3 4 -5") // return "9 -5"
  3. You will be given an array and a limit value. You must check that all values in the array are below or equal to the limit value. If they are, return true. Else, return false.

    smallEnough([10,5, 6 ,5], 11) = true
    smallEnough([10,5, 6 ,5], 5) = false
  4. Return the number (count) of vowels in the given string.

    countVowel('hello how you doing') = 7
  5. Find missing letter Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array.

    You will always get an valid array. And it will be always exactly one letter be missing. The length of the array will always be at least 2. The array will always contain letters in only one case. Example:

    ['a','b','c','d','f'] -> 'e'
    ['O','Q','R','S'] -> 'P'
Clone this wiki locally