Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Java Coding Assessment Test (Medium)

Topics Covered

  • JSP
  • Servlet
  • Core Java 8
  • Java OOPs

Useful for hiring

  • Experienced Java Programmer
  • Java Developer with 2 to 5 years of experience

Start hiring job-fit candidates using this assessment


"We are impressed by the caliber, depth, and breadth of the assessments provided by Interview Mocha. With Interview Mocha's online proctoring & powerful reports, we are able to hire quality candidates overcoming geographical barriers."

Megan Akhras, J'Excelle,Canada,
Co-founder & director

Write a code to remove duplicate occurrences of a character in a string.

Input Format
The line contains the string

Output Format
Print the modified string

Sample Input

Sample Output


It is said in java that “Everything created is an object”.
You define the following string array:

String arr[] = {"Sample1", "Sample2", "Sample3", "Sample4"};

Which of the following is the correct number of objects created with the above array?

    • 4

    • 5

    • 8

    • 9


You want to create a filter for your web application and your filter will implement javax.servlet.Filter.
Which two statements are TRUE?

Note: There are multiple correct answers to this question.

    • Your filter class must implement an init method and a destroy method.

    • Your filter class must also implement javax.servlet.FilterChain.

    • When your filter chains to the next filter, it should pass the same arguments it received in its doFilter method.

    • The method that your filter invokes on the object it received that implements javax.servlet.FilterChain can invoke either another filter or a servlet.

    • Your filter class must implement a doFilter method that takes, among other things, an HTTPServletRequest object and an HTTPServletResponse object.

Test details:

The Java Coding Online test enables employers and recruiters to identify potential hires by evaluating working skills and job readiness. The medium level Java programming skill test is useful to hire Java Developers with a few years of experience. For this reason, emphasis is laid upon evaluating the knowledge of applied skills gained through real work experience, rather than theoretical knowledge.
Questions : 22
Duration : 60 minutes

  • Core Java : The test contains 5 questions on Core Java concepts to check the knowledge of candidate in related area.
  • OOPs : The test contains 5 questions on OOPs concepts to check the knowledge of candidate in related area.
  • JSP : The test contains 5 questions on JSP concepts to check the knowledge of candidate in related area.
  • Servlets : The test contains 5 questions on Servlets to check the knowledge of candidate in related area.
  • Coding : The test contains 2 Coding questions.

Test description:

Java Coding Online Test helps recruiters to assess Java programming skills of a candidate.

The Java Coding Online test helps to  validate candidates theroy as well as programming knowledge. This Java programming skills test has been developed and reviewed by qualified and experienced Subject Matter Experts (SME). The candidate has to write a code in a Coding Simulator. If a programmer also write appropriate comments for his code then he is considered a good programmer.

Using powerful reporting, you will have detailed analysis of test results to help you make better decisions and predict candidate and employee success.

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates