Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6368195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:38:40+00:00 2026-05-25T00:38:40+00:00

Possible Duplicate: Need help in structuring things in XML file have a structure like

  • 0

Possible Duplicate:
Need help in structuring things in XML file

  • have a structure like follows:

    Question0 : What is ur name?
    Answer0: Tina
      Question0.0 : What are your hobbies?
       Answer0.0.0 : reading 
           Question0.0.0.0 :What do you like in reading.?
                  Answer0.. : .....
       Answer0.0.1 : Dancing
           Question0.0.0.1 :which dance do you like?
    ...........
    Answer1:Roger 
    ...........same question answer as above.
    

Searches:
I want to make a datastructure for the above structure which should be able to give me the parent(question) of an answer and also the parent(answer) of a question.can’t think of a solution..?

Deletion and addition:
No need to care about.

A question can have multiple answers. No, every question must have at least one answer. Yes, every question decending from an answer.

Also how I can do this structure numbering very efficiently?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:38:41+00:00Added an answer on May 25, 2026 at 12:38 am

    I would have followup questions:

    class Question {
        static final String DEFAULT = "DefaultFollowup";
        String questionText;
        Map<String,Question> responsesAndFollowups;
        Question(String text) {
           this.questionText = text;
           responsesAndFollowups = new HashMap<String,Question>();
        }
        void addFollowup(String response, Question followup) {
            responsesAndFollowups.put(response,followup);
        }
        void setDefaultFollowup(Question followup) {
            addFollowup(DEFAULT,followup);
        }
        Question getFollowup(String response) {
            Question followup = responsesAndFollowups.get(response);
            if(followup == null) followup = responsesAndFollowups.get(DEFAULT);
            return followup;
        }
    }
    

    Later, you can do this

    Question name = new Question("What is your name?");
    Question hobbies = new Question("What is your favorite hobby?");
    Question dancing = new Question("What is your favorite dance?");
    Question reading = new Question("What is your favorite book?");
    
    name.setDefaultFollowup(hobbies);
    hobbies.setDefaultFollowup(reading); // ask people about reading by default
    hobbies.addFollowup("Dancing",dancing); // if they say they like dancing, ask that instead
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Need help solving Project Euler problem 200 Similar to this question Project
Possible Duplicate: splitting a string i have a string which looks like this: http://pastebin.com/m5508ff19
Possible Duplicate: SQL Server Database query help Hi, I have a problem that I
Possible Duplicate: Need help with a SQL query that combines adjacent rows into a
Possible Duplicate: need help with some stored procedure plz ERROR:- A SELECT statement that
Possible Duplicate: How to get IMG tag code from HTML document? I need help
Possible Duplicate: Determine framework (CLR) version of assembly I have a library/DLL file which
Possible Duplicate: Need help with getline() In the following code, my getline is skipped
Possible Duplicate: UITableView Cell expand on click i need help in UITableViewCell of UITableView.My
Possible Duplicate: easiest way to parse xml in python I need to parse a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.