I went to an job interview and they asked me to do the following 2 coding in 30 min.

Find a keyword occurrence in  a specific website for its URL. There should be 2 input fields. One will for keyword and another will be for URL input. On submit it will show the occurrence of the keyword in the given website.

Well may be there are many possible good ways to do this but I know php and this seemed to me the easiest way.



keyword Finder


Find the Keyword Occurrence in a website

Output :

Let’s know what I did here:

file_get_contents() reads a file into a string. It will use memory mapping techniques to find string. I used it to read the url and find the specific keyword given occurred in the website.
file_get_contents(path,include_path,context,start,max_length) — Here ‘path’ is the required field

substr_count() function counts the number of times a substring occurs in a string. This function is Case Sensitive.
substr_count(string,substring,start,length) — Here ‘string’ and ‘substring’ are required fields.

strip_tags() function strips a string from HTML, XML, and PHP tags. Strip means remove the covered things.
strip_tags(string,allow) — Here ‘string’is the required field.

Find the exponential value of a number. You can use C++/python/Java. Use recursive method

I did the coding in Java. Here is the code I tried there.

import java.util.*;

public class ExpFinder {
    static void getExponent(){
        Scanner noor = new Scanner(System.in);
        System.out.println("Enter A Number: ");
        double inputVal = noor.nextDouble();
        System.out.println("Exponent value of "+ inputVal +" is: "+ Math.getExponent(inputVal));
        System.out.println("Square Root of the value  "+ inputVal +" is: "+ Math.cbrt(inputVal));
        System.out.println("Cubic Root of the value  "+ inputVal +" is: "+ Math.sqrt(inputVal));


    public static void main(String args[]) {

Enter A Number: 25.0
Exponent value of 25.0 is: 4
Square Root of the value  25.0 is: 2.924017738212866
Cubic Root of the value  25.0 is: 5.0


love coding, freelancer, love to travel and ride bikes