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 9053969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:33:39+00:00 2026-06-16T13:33:39+00:00

I am working on a Single choice and Multiple choice test. I have couple

  • 0

I am working on a Single choice and Multiple choice test.

I have couple of questions and 4 answers for each question.

I am shuffling the answers as each answer is assigned to radio button.
This is how i am shuffling the arraylist where Random is a arraylist with items and r1,r2,r3,r4 are radio buttons.

random.add(val);
Collections.shuffle(random);


r1.setText(random.get(0));
r2.setText(random.get(1));
r3.setText(random.get(2));
r4.setText(random.get(3));

I am able to display the answers in jumbled way but when i select the answer i need to show that the answer is correct or wrong.

Sample question and options.
1. which language is used for android programming?
 A.PHP
 B.JAVA
 C.C
 D.C++

Correct answer is B i need to display that correct answer is B.

How to acheive this.

EDIT:
I have tried this:

Onclick of each radio button assign the value A and compare the value with xml value if its correct display correct but when i jumble its will not work.

EDIT 2
xml

<Question no="1" text="Which Programming language is used in android develoment" type="SCA" noc="4" jumble="NO" correctans="PHP">
<choice a = "PHP" flag="A"> 
<choice b = "JAVA" flag="B"> 
<choice c = "C" flag="C"> 
<choice d = "C++" flag="D"> 
  • 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-06-16T13:33:40+00:00Added an answer on June 16, 2026 at 1:33 pm

    Here is a somewhat naive solution but it should work.

    class Question {
        String message;
        String answer;
        List<String> options; //"Java", "PHP", etc
    }
    

    Shuffle the keys of the Map in your Question object
    In your radio buttons, do something like r1.setText(random.get(0))

    On click, do

    String choice = null;
    for (RadioButton rb : rBtns) {
        if (rb.isSelected) {
            choice = rb.getText(); break();
        }
    }
    
    if (choice.equals(question.getAnswer))
        return true; //correct
    else
        return false; //wrong
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on talking multiple choice test. I have some images as answers
If I am working in multiple branches on a single feature, I use git
I'm working on a relatively simple website with (currently) a single resource. I have
I'm working on a project that will have a single table holding lots and
I have an application level (PThreads) question regarding choice of hardware and its impact
I have a general IO question. I was trying to replace a single line
I am working on an online survey. Most questions have a scale of 1-5
I have got below XSLT which working for single grouping, however I need to
So I have ListView with the Single Choice mode enable. I have a selector
I'm programming this game in OpenGL, mostly working inside an single EAGLView (I'm not

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.