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×

Online Java Coding Test – Basic Level

Topics Covered

  • Class
  • Object Concepts
  • Variables
  • Operators
  • Loops
  • Methods
  • Constructors
  • Coding

Useful for hiring

  • Junior Java Developer
  • Entry Level Java Developer
  • Java Programmer (0-2 yrs of exp.)

Start hiring job-fit candidates using this assessment


"Finding quality talent is a challenge more so when you consider the sheer number of resumes we get each year. To top this, the time we spent on our recruitment process was humongous. Interview Mocha helped us to cut down on our candidate filtration time by 40%, making it our preferred assessment tool."

Pedro Furtado, Altran,
Capacity Manager

Write a program that prints the numbers from 1 to 20. 

For multiples of 3, print usb instead of the number and for multiples of 5, print device
For numbers which are multiples of both 3 and 5, print usbdevice

Print a new line after each string or number.


Which collection class allows you to access its elements by associating a key with an element's value, and provides synchronization?

    • java.util.SortedMap

    • java.util.TreeMap

    • java.util.TreeSet

    • java.util.Hashtable


/* Missing Statement ? */
public class TechMocha
    public static void main(String[]args)throws Exception
    { out = new;

What line of code should replace the missing statement to make this program compile?

    • No statement required.

    • import*;

    • include*;

    • import;

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