Exploratory testing is done to explore the application and is done to get the knowledge of the application. It is an approach that is most useful where there are few or inadequate specifications and severe time pressure. It also ensures that the most serious defects are found.
Ad-hoc testing is used to check the functionality RANDOMLY. In this the aim is to find the defects by performing different operations randomly. While doing this the tester is aware of expected results which is not the case with exploratory testing.
Ad hoc Testing:
Ad hoc testing is a commonly used term for software testing performed without planning and documentation. Software Testing portal
The tests are intended to be run only once, unless a defect is discovered. Ad hoc testing is a part of exploratory testing, being the least formal of test methods. In this view, ad hoc testing has been criticized because it isn't structured, but this can also be a strength: important things can be found quickly. It is performed with improvisation, the tester seeks to find bugs with any means that seem appropriate. It contrasts to regression testing that looks for a specific issue with detailed reproduction steps, and a clear expected result. Ad hoc testing is most often used as a complement to other types of testing.
Exploratory testing is the tactical pursuit of software faults and defects driven by challenging assumptions. It is an approach in software testing with simultaneous learning, test design and test execution. While the software is being tested, the tester learns things that together with experience and creativity generates new good tests to run. In general, exploratory testing is a black box testing technique.