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:

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!

 

Python:

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

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.

coding test - python

 

C#:

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.

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!

P.S:

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: https://www.paypal.me/sapneshnaik | UPI: [email protected]

 

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
1 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Vageesh Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Vageesh
Guest
Vageesh

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