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×

Core Java Online Test

Topics Covered

  • Core Java
  • Data Types
  • Threads
  • Servlets
  • General Aptitude

Useful for hiring

  • Core Java Developer
  • Core Java Programmer
  • Java Developer with 1-3 yrs of experience

Start hiring job-fit candidates using this assessment

GET A DEMO

"We realized that to acquire quality talent, our recruitment process was in dire need of automation. Too many of our technicalteam were simply wasting hours conducting interviews that did not yield the desired results. For us the foremost criteria were to finda recruitment partner who could tick all the right boxes"

Rehana Nisar, Gartner,
Global Product & Services Recruitment Head
Question

1. List list = new ArrayList<>();
2. list.add(21);
3. list.add(13);
4. list.add(30);
5. list.add(11);
6. list.add(2);

Which of the following should be inserted at Line 5 to get output [21, 13, 11]

Answer
    • list.removeIf(e > e%2 != 0);

    • list.removeIf(e -> e%2 != 0);

    • list.removeIf(e -> e%2 == 0);

    • list.remove(e -> e%2 == 0);

Question

Consider the following code:
Comparator scheduleComparator = Comparator.comparingInt(Schedule::getReference);
Optional mostRecent = schedules.stream.collectIn(maxby(scheduleComparator))

The above code has an error. How can we solve the problem?

Answer
    • Optional<Schedule> mostRecent = schedules.stream().collect(maxBy->scheduleComparator));

    • Optional<Schedule> mostRecent = schedules.stream().collect(maxby::scheduleComparator));

    • Optional<Schedule> mostRecent = schedules.stream().collect(maxby::scheduleComparator);

    • Optional<Schedule> mostRecent = schedules.stream().collect(maxBy(scheduleComparator));

Question

The FleetControl system must create an object of type LocalDate with the following values:

Day: 5
Month: January
Year: 2018

Which of the below code snippet will create the above object?

Answer
    • LocalDate sysDate = LocalDate.values(5, 1, 2018);

    • LocalDate sysDate = LocalDate.values(2018, 1, 5);

    • LocalDate sysDate = LocalDate.of(5, 1, 2018);

    • LocalDate sysDate = LocalDate.of(2018, 1, 5);

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 support@interviewmocha.com 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...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO