NSMutableArray?? NSMutableDictionary?? help

Discussion in 'iOS Programming' started by moomy, Apr 28, 2010.

  1. moomy macrumors newbie

    Apr 28, 2010
    Hi all,
    I'm just learning iPhone programming. I'm starting to work with files and thought a good project to learn this would be a multiple choice style quiz.

    I have managed to do a simple quiz with a text file linked to an array... however I want to randomize the questions and remove questions once they have been asked.

    Do you think a NSMutableDictionary would do this.. can a key be linked to the question, the possible answers and a marker to the correct answer??
    or would a MutableArray be better??

    Any advice would be fantastic as I am struggling to find a lot on info on this on the web.

  2. ChOas macrumors regular

    Nov 24, 2006
    The Netherlands
    I would use an NSMutableArray filled with NSDictionaries which hold the questions and answers. You pick a random dictionary from the array, then you have your question and answers. After picking you remove it from the NSMutableArray.
  3. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    I would use an NSMutableArray of objects that represent questions, modeled using a class that contains the question, the answers (probably an array here), and index of the correct answer.
  4. moomy thread starter macrumors newbie

    Apr 28, 2010
    Thanks you two,

    I'll look into these ideas. I really appreciate you taking the time to reply.

Share This Page