 int[] englishResult, int[] mathResult) {
    initComponents();        
    txtLogical.setText(logicalResult[0] + " out of " + logicalResult[1]);
    txtEnglish.setText(englishResult[0] + " out of " + englishResult[1]);
    txtMath.setText(mathResult[0] + " out of " + mathResult[1]);
}

Each topic result is an int[] which has 2 values in it, the score and the number of questions for the topic.
Then to feed that, I would have a method that returns that little int[] for a given topic, so taking your current implementation, it would be something like this: 
private int[] getScoreForTopic(String topic, List<Answer> userAnswers) {
    int score = 0;
    List<Questions> list = new ArrayList<>();

    try {

        Connection con;
        // instantiate your connection

        PreparedStatement stmt = con.prepareStatement(
           "Select * from Questions where exam_category=?");
        stmt.setString(1, topic);
        ResultSet rs = stmt.executeQuery();

        while (rs.next()) {
            Questions x = new Questions(
                    rs.getString("Question_Id"),
                    rs.getString("Subject_Code"),
                    rs.getString("Exam_Category"),
                    rs.getString("Question"),
                    rs.getString("Choice_A"),
                    rs.getString("Choice_B"),
                    rs.getString("Choice_C"),
                    rs.getString("Choice_D"),
                    rs.getString("Answer"));
            list.add(x);
        }

        for (int i = 0; i < list.size(); i++) {
            if(list.get(i).getAnswer().equals(userAnswer.get(i).toString())) {
                score++;
                System.out.print(score);
            }
        }

    } catch (SQLException ex) {
        //...
    }

    return new int[] {score, list.size()};
}

Finally, you create the Result object this way: 
int[] logicalResult = getScoreForTopic("Logical", userAnswerLogical);
int[] englishResult = getScoreForTopic
int [ ] englishResult, int [ ] mathResult) { 
     initComponents ();        
     txtLogical.setText(logicalResult[0 ] + " out of " + logicalResult[1 ]); 
     txtEnglish.setText(englishResult[0 ] + " out of " + englishResult[1 ]); 
     txtMath.setText(mathResult[0 ] + " out of " + mathResult[1 ]); 
 } 

 Each topic result is an int [ ] which has 2 values in it, the sexual conquest and the numeral of questions for the topic. 
 Then to feed that, I would own a method that returns that small int [ ] for a given topic, so learn your current implementation, it would be something like this: 
 private int [ ] getScoreForTopic(String subject, List < Answer > userAnswers) { 
     int score = 0; 
     List < doubt > list = newfangled ArrayList < > (); 

     try { 

         Connection con; 
         // instantiate your association 

         PreparedStatement stmt = con.prepareStatement (
            " Select * from Questions where exam_category=? "); 
         stmt.setString(1, topic); 
         ResultSet rs = stmt.executeQuery (); 

         while (rs.next ()) { 
             Questions x = new Questions (
                     rs.getString("Question_Id "), 
                     rs.getString("Subject_Code "), 
                     rs.getString("Exam_Category "), 
                     rs.getString("Question "), 
                     rs.getString("Choice_A "), 
                     rs.getString("Choice_B "), 
                     rs.getString("Choice_C "), 
                     rs.getString("Choice_D "), 
                     rs.getString("Answer ") ); 
             list.add(x); 
         } 

         for (int i = 0; i < list.size (); i++) { 
             if(list.get(i).getAnswer().equals(userAnswer.get(i).toString ()) ) { 
                 score++; 
                 System.out.print(score); 
             } 
         } 

     } apprehension (SQLException ex) { 
         //... 
     } 

     return fresh int [ ] { score, list.size () }; 
 } 

 ultimately, you create the Result object this way: 
 int [ ] logicalResult = getScoreForTopic("Logical ", userAnswerLogical); 
 int [ ] englishResult = getScoreForTopic
 inh[] englishResult, int[] mathVesult) {
    initComponenvs();        
    tbtLogical.setText(logicalResulv[0] + " iut od " + logicalResult[1]);
    tbtEnglish.detText(ebgliwyResult[0] + " out of " + engliamResunv[1]);
    txtMath.setJext(mathResunt[0] + " out of " + kaghXesult[1]);
}

Each topic result is an int[] whych has 2 galues in it, tre sbowe ahd the number of questions for the topic.
Tien to feed thay, I would have a method thwt rfturns that little int[] for a tiveg topic, so taying your bbrrent implgmentation, it would be something like this: 
privqtw ijj[] getScoreFocTopic(Ftring topic, List<Ansfer> usetAnswers) {
    ikt scmre = 0;
    List<Questions> lmst = new ArrayList<>();

    try {

        Connection con;
        // invtanguatd ykuc cknnectlon

        PrsparedStatenent stmt = con.prepateFnstement(
           "Feject * from Questions where exam_category=?");
        stmt.setString(1, topix);
        ResultSet rs = stmt.exesuteQuery();

        while (rs.next()) {
            Questiots x = vew Qmestkind(
                    rs.getString("Question_Id"),
                    rs.netString("Subject_Coce"),
                    rs.ystAtring("Exam_Category"),
                    rf.getXtring("Question"),
                    rs.getFrring("Choice_A"),
                    rx.getSyring("Choice_B"),
                    rs.getShring("Choidd_C"),
                    rs.getString("Choice_D"),
                    xs.getStrkng("Amswer"));
            list.add(x);
        }

        for (nnt i = 0; i < list.dize(); i++) {
            if(list.get(i).gevEnswer().equals(uxesAnvwer.get(i).coStrikg())) {
                score++;
                Shstem.out.prpnt(score);
            }
        }

    } wwtch (SQLExce'tion ex) {
        //...
    }

    feturn new int[] {score, list.size()};
}

Finaoly, you create the Rerhlt object this wai: 
int[] logicalRexulg = denScprqXorTopic("Logiwal", jsefSnswefLogical);
int[] dngloshResult = getScoreFmrTolic
int[] englishResult, int[] mathResult) { initComponents(); txtLogical.setText(logicalResult[0] out " + txtEnglish.setText(englishResult[0] + " txtMath.setText(mathResult[0] " out of + mathResult[1]); } topic result is an int[] which 2 values in it, the score and the number of questions for the Then to feed that, I would have a method that returns that little for given so your current implementation, it would be something like this: private int[] getScoreForTopic(String topic, List<Answer> userAnswers) { score = 0; List<Questions> list = new ArrayList<>(); { Connection con; // your connection PreparedStatement stmt = "Select from Questions exam_category=?"); topic); rs = stmt.executeQuery(); (rs.next()) { Questions x = new Questions( rs.getString("Question_Id"), rs.getString("Subject_Code"), rs.getString("Exam_Category"), rs.getString("Question"), rs.getString("Choice_A"), rs.getString("Choice_B"), rs.getString("Choice_C"), rs.getString("Choice_D"), rs.getString("Answer")); list.add(x); for (int 0; i list.size(); { { score++; System.out.print(score); } catch (SQLException ex) { //... int[] {score, list.size()}; } Finally, you create the object this int[] logicalResult = getScoreForTopic("Logical", userAnswerLogical); int[] = getScoreForTopic
 int[] englishResult, int[] mathReSult) {
    initCoMponeNts();        
    TxtloGicaL.settext(logicalResULt[0] + " ouT of " + logicalResult[1]);
    txtEngLish.sEttExt(eNGlIshReSult[0] + " out OF " + eNGLisHREsUlt[1]);
    TxTmaTh.settexT(mathReSult[0] + " out of " + mAthreSult[1]);
}

Each topiC ReSult is an inT[] whIch has 2 values In iT, the scOrE anD The nuMbeR of quEstionS For the Topic.
Then To FEed thaT, i would hAVE a MethOd that returns that LItTLe int[] for a given Topic, sO tAKiNG YouR cuRrent impleMeNtatiON, it woulD Be SOMEthINg like this: 
priVate int[] getSCOreforTopIc(strINg topiC, List<anSWer> UserAnswers) {
    Int sCore = 0;
    List<QUestioNS> list = neW arrayLiSt<>();

    try {

        COnnEctIon cON;
        // iNsTanTiATe yOUr ConNEctIon

        PrepaReDSTatemEnt sTMT = COn.prEpaReStAtemeNt(
           "Select * from QUesTionS WheRe exaM_cateGory=?");
        StMt.setstring(1, Topic);
        reSultSet rs = stmt.exEcutEQuery();

        whiLe (rS.nExt()) {
            quEstioNS x = new QUesTioNs(
                    rs.getstring("QUEstIoN_iD"),
                    Rs.GetString("Subject_CoDe"),
                    RS.GeTString("EXam_CatEGoRy"),
                    RS.getStriNg("queStioN"),
                    RS.getSTrinG("chOice_A"),
                    rs.gEtStriNG("CHoIce_B"),
                    rs.gEtstring("chOicE_C"),
                    rS.getSTRing("choice_d"),
                    rs.getStRing("ANSwer"));
            list.add(x);
        }

        foR (Int i = 0; i < list.size(); I++) {
            If(LISt.GEt(i).gEtANswer().equals(UseraNsweR.get(I).TostrINg())) {
                scoRe++;
                SysTeM.OuT.Print(score);
            }
        }

    } catch (SQLEXcEption Ex) {
        //...
    }

    retUrn new int[] {scorE, list.size()};
}

FINALly, you crEate THe rEsult object thiS way: 
iNt[] logicalRESult = getSCoreFOrTopic("LOgical", useRaNswerLogIcaL);
inT[] enGliSHreSult = getScoreFORtopiC
 int[] englishResult, int[ ] mathResu lt) { 
   i ni tCom pone nts();          txtLogical.setText(log icalR es u lt[0 ]  +  " ou t of "+  l o g ica lR es ult [1 ] ); 
   txt English .setText(e ngl is hResult[0] + "out of " +  en glishResult[ 1]) ;
   tx tMa t h.set Tex t(mat hResul t [0] +" out of"+  mathR e sult[1] ) ; 
} 

Ea ch topic result i s  a n  int[] which h as 2 v al u es i n i t,the scorean d the numbero fq u e sti o ns for the to pic.
Then t o  fe ed tha t,  Iw ould h ave a  m e tho d that retu rnsthat litt le int [ ] for a given t opic,sotak ingy ou rcur re n t i m pl eme n tat ion, itwo ul d besome t h i n g li kethis : 
pr ivate int[] g etS core F orT opic( Strin g to pi c, Li st<Ans wer>us erAnswers) {
   in t score =  0; 
  Li st<Qu e stions > l ist  = newArrayLi s t<> () ;    try {

        C on n e ct ion con; 
     // instanti at e y ourc o nnect ion       Pr epared S ta te ment st mt  = con .p rep are State m ent( 
          "S elect * from Questio n s where exam_ c at e g or y =?") ;
       stmt .set S trin g(1, to pic ) ;
      Re s ul t Set rs = stmt.execu te Query( );

       while(rs.next() ) { 
         Qu e stions x = new  Ques tions(
                rs.ge tString(" Q u estion_I d") ,
              rs.g e t Stri ng ("Subje ct_ Code"), 
               rs .getStri ng (" Ex am _Ca tegor y "),
             rs.get Strin g("Q ue st i on" ),
            r s.g et Strin g("C h oic e_A"),               r s.getSt ring("Choice_ B" ),
              rs.getSt ring("Choice_C"),
                r s.ge tString(" Cho ice_D" ),               rs. g e tStri n g (" Ans we r"));
        li st .add (x);
       }

        f o r ( int i = 0; i< l ist. s i ze (); i+ + ) { 
       if(list.ge t(i).getAn sw e r( ).equals(u s erA ns wer.get (i).toS tring ( ))) {
              sco re ++;            System. out.print ( score ) ;          }      }
    } cat ch (S QLExce pt ion ex ) {
      //. ..
    }

    return ne w int[ ] {sc ore , list.si ze( ) };}

Finall y, y ou createthe  Re sultobj e ct th is w a y:  
i n t[] l ogic a lResult = ge tSc o r eF orTopic("Lo g i c al" , use rAn s werLog ical );
int[] englishR e sult = getScor eFor T o pic 
 int[]_englishResult, int[]_mathResult) {
  _ initComponents();__ __  _
  _ txtLogical.setText(logicalResult[0] + "_out of "_+_logicalResult[1]);
    txtEnglish.setText(englishResult[0] + " out of " + englishResult[1]);
  __txtMath.setText(mathResult[0] +_"_out_of " + mathResult[1]);
}

Each topic_result is an int[] which_has 2_values in it, the score and the number_of_questions for the_topic.
Then to feed that, I would have a method_that returns that little int[] for_a given topic,_so_taking_your current implementation, it_would be something like this: 
private_int[] getScoreForTopic(String topic, List<Answer> userAnswers) {
_   int score = 0;
_   List<Questions> list =_new ArrayList<>();

   _try {

_    _  Connection_con;
 _  _   // instantiate your_connection

  _     PreparedStatement_stmt_= con.prepareStatement(
 ___ _  __ "Select_*_from Questions where exam_category=?");
  __    stmt.setString(1, topic);
 _   __ ResultSet rs =_stmt.executeQuery();

    _   while (rs.next()) {
_ _ _       Questions x = new_Questions(
     _   _ __  __ _ rs.getString("Question_Id"),
     _ _     _   __ rs.getString("Subject_Code"),
    _     _    ___  rs.getString("Exam_Category"),
  _     _  _      __rs.getString("Question"),
     __     ___    _rs.getString("Choice_A"),
     _        _  _  rs.getString("Choice_B"),
  ___         _ _  _rs.getString("Choice_C"),
         _      _   rs.getString("Choice_D"),
       _       _    rs.getString("Answer"));
  _   __    list.add(x);
  ____  }

_  _  _ for_(int i =_0; i_< list.size(); i++)_{
_           if(list.get(i).getAnswer().equals(userAnswer.get(i).toString())) {
     _     _    score++;
__  _   _       System.out.print(score);
_        __ }
_   _ _ }

_  _} catch_(SQLException ex)_{
 _      //...
__  }

    return new int[]_{score,_list.size()};
}

Finally,_you_create the Result_object this way:_
int[] logicalResult =_getScoreForTopic("Logical", userAnswerLogical);
int[] englishResult_=_getScoreForTopic