The Semantic Web contains a large amount of data in the form of knowledge bases. Question Answering system is the most promising way of retrieving data from the available knowledge base to the end-users, to get the appropriate result for their questions. Although many systems have been developed over the years, it remains a challenge that most systems yet to require improvements to increase the accuracy for correct interpretation of the question and provide an answer. Many Question Answering systems convert the questions into triples which are mapped to the Knowledge base from which answer is derived. However, these triples do not express the semantic representation of the question, due to which the answers cannot be located. To handle this, a template-based approach is proposed which classifies the question types and finds appropriate SPARQL query templates for each type including comparatives and superlatives. The SPARQL query built is executed in the DBpedia endpoint and results are obtained. Compared with other factoid question answering systems, the proposed approach has the potential to deal with a large number of question types, including comparatives and superlatives. Also, the experimental evaluations of the system performed on the QALD-8 dataset present good performance and can help users to find answers to their questions. © 2013 IEEE.