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)

Useful for hiring

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

Start hiring job-fit candidates using this assessment


"Interview Mocha's assessments eliminated reliance on resumes and reduced our time to hire by half. Now we spend time only on relevant candidates and take data-driven hiring decisions."

George Nichkov, Gett,
Global Analytics Team Lead

You need to write a code which takes input as a string and replaces all the consecutively occurring characters in the string by a single, same character.

Input Format
The line contains the string

Output Format
Print the modified string

Sample Input

Sample Output


Which of these represents the CORRECT path for the core JSTL library in JSTL version 1.1? 






What's the difference between servlets and applets?

Note: There are multiple correct answers to this question.

    • Servlets executes on Servers, where as Applets executes on Browser

    • Servlets have no GUI, where as an Applet has GUI

    • Servlets creates static web pages, where as Applets creates dynamic web pages

    • Servlets can handle only a single request, where as Applet can handle multiple requests

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