logic to check question type