A question type in LimeSurvey 2.1 will always be part of a plugin.
A plugin can contain multiple question types, the plugin takes care of registering the question types.
A simple plugin contianing just one question could look like this:
A question object has several tasks.
Each question object must implement the iQuestion (https://github.com/LimeSurvey/LimeSurvey/blob/master/application/libraries/PluginManager/Question/iQuestion.php) interface. It is strongly recommended to simply extends the QuestionBase class, this class offers a lot of useful functionality simplifying creation of new question types.
The questionbase class handles the following tasks.
Besides handling these base function it also exposes 2 very useful functions:
These functions allow the question object to save and restore data without knowing about storage details. Each datum is stored using a key and a value; by default the datum is related to the question type itself, for example when configuring global options like allowed file types for a file upload question.
When a question object is created it may be passed a question id, if it is it uses this id to relate the data it saves or retrieves to the specific instance of the question.
The getter and setter functions support localization by passing an optional language identifier.