How to Get Help in a Coding Test.

How to Get Help in a Coding Test.

Coding tests have been the standard way of measuring a candidate’s programming ability in the IT industry. They can be challenging for both students and working professionals alike. Practically speaking, knowing what inbuilt functions are available or what are all the methods an Object exposes could help you come up with an approach a lot faster in a coding test. However, at the same time, one can’t remember all the methods or properties a class provides.

The solution:

It’s quite simple; we need to find a way to get all the methods of an object or the inbuilt functions from the code itself. Yes!, We’re going to make our code help us solve the problem! (the irony!). I’ve found ways to do this for few of the more popular programming languages, and I’ll be sharing them here with you.


Java provides a `Method` class and a `getMethods()` method which returns an array of all the public methods provided by a class. Make sure to replace the `StringBuffer` class with your required class name!

import java.lang.reflect.Method;

public class HelloWorld {
 public static void main(String args[]) {

  Class<?> a = StringBuffer.class;

  Method[] methods = a.getMethods();

  for (Method methodName: methods)




Python provides a magic method `__doc__` which gets the documentation related to a module!.

import argparse


coding test - Java

There is also the handy `dir()` method which returns a list of all names in scope with the variable and the names without any underscores in them are the methods.

from pprint import pprint


coding test - python



Like Java, C# also provides a method Type.GetMethods() which returns the information about all the public methods. However, a little more work is required to get the desired result.

using System;
using System.Linq;

public class HelloWorld
    public static void Main()
		//replace DateTime with your choice of class.

	//Prints method name with return type to console
    static void ShowMethods(Type type)
        foreach (var method in type.GetMethods())
            var methodParameters = method.GetParameters();
            var methodTypeNames = string.Join
                (", ", methodParameters
                             .Select(x => x.ParameterType + " " + x.Name)

            Console.WriteLine("{0} {1} ({2})",

coding test - C#


This article is still a work in progress, and I’ll be adding snippets of other languages soon. However, you get the idea right? You can share your tips or code snippets in the comment section below. Also, while you’re at it make sure you check out my other articles related to programming.

I wish you all the best for your next coding test!


You can also consider making a small donation to support me. Your donation will directly contribute to the running cost of this website and hopefully my college too 🙂

Paypal:  |  UPI: [email protected]


0 0 vote
Article Rating
Notify of
1 Comment
newest most voted
Inline Feedbacks
View all comments
1 year ago

Thank you so much for such a good and helpful content. For sure this will help a lot