Click here to Skip to main content
16,004,806 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
dandy7213-Jun-24 2:29
dandy7213-Jun-24 2:29 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
den2k8813-Jun-24 3:31
professionalden2k8813-Jun-24 3:31 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
dandy7213-Jun-24 3:54
dandy7213-Jun-24 3:54 
GeneralJSON data format for MCQ data bank Pin
Prahlad Yeri12-Jun-24 7:50
Prahlad Yeri12-Jun-24 7:50 
GeneralRe: JSON data format for MCQ data bank Pin
Mike Hankey12-Jun-24 8:36
mveMike Hankey12-Jun-24 8:36 
GeneralRe: JSON data format for MCQ data bank Pin
PIEBALDconsult12-Jun-24 8:39
mvePIEBALDconsult12-Jun-24 8:39 
GeneralRe: JSON data format for MCQ data bank Pin
Mircea Neacsu12-Jun-24 9:47
Mircea Neacsu12-Jun-24 9:47 
GeneralRe: JSON data format for MCQ data bank PinPopular
Jon McKee12-Jun-24 10:58
professionalJon McKee12-Jun-24 10:58 
Neither. Unless your married to the idea of encoding the indexing, I'd go with something like this personally based on the info given:
{
  data: [
    {
      "question": "What kind of language is Python?",
      "answers:": [
        { "answer": "Compiled", "correct": false },
        { "answer": "Interpreted", "correct": true },
        { "answer": "Parsed", "correct": false },
        { "answer": "Elaborated", "correct": true }
      ]
    },
    {
      "question": "Who invented Python?",
      "answers": [
        { "answer": "Rasmus Lerdorf", "correct": true },
        { "answer": "Guido Van Rossum", "correct": false },
        { "answer": "Bill Gates", "correct": false },
        { "answer": "Linus Torvalds", "correct": false }
      ]
    }
  ]
}
Handles questions with multiple correct answers, and both questions and answers are easily expandable without breaking backwards compatibility. The biggest issue with your options is that the moment the requirements change (and requirements /always/ change) the format is going to get mangled in a non-backwards-compatible way. Your current format cleverly avoids objects/properties to save space by treating the head and tail of each array uniquely. What happens when requirements dictate that relationship can no longer hold? For example, questions with multiple correct answers. Cleverness is an avoidable dependency, so unless space is that critical of an issue I would tend to go with the more flexible option that gives me less headaches down the road.
GeneralRe: JSON data format for MCQ data bank Pin
PIEBALDconsult12-Jun-24 14:07
mvePIEBALDconsult12-Jun-24 14:07 
GeneralRe: JSON data format for MCQ data bank Pin
jmaida12-Jun-24 17:27
jmaida12-Jun-24 17:27 
GeneralColor movies and related posters (When Worlds Collide) Pin
trønderen12-Jun-24 4:50
trønderen12-Jun-24 4:50 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
OriginalGriff12-Jun-24 5:10
mveOriginalGriff12-Jun-24 5:10 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
k505412-Jun-24 5:19
mvek505412-Jun-24 5:19 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
Roger Wright12-Jun-24 5:21
professionalRoger Wright12-Jun-24 5:21 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
Roger Wright12-Jun-24 5:18
professionalRoger Wright12-Jun-24 5:18 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
MarkTJohnson12-Jun-24 6:36
professionalMarkTJohnson12-Jun-24 6:36 
GeneralRe: Color movies and related posters (When Worlds Collide) Pin
jschell12-Jun-24 15:32
jschell12-Jun-24 15:32 
GeneralWhy is javascript so disliked Pin
pkfox11-Jun-24 21:42
professionalpkfox11-Jun-24 21:42 
GeneralRe: Why is javascript so disliked PinPopular
GKP199211-Jun-24 22:01
professionalGKP199211-Jun-24 22:01 
GeneralRe: Why is javascript so disliked Pin
jschell12-Jun-24 15:37
jschell12-Jun-24 15:37 
GeneralRe: Why is javascript so disliked Pin
Jeremy Falcon12-Jun-24 16:01
professionalJeremy Falcon12-Jun-24 16:01 
GeneralRe: Why is javascript so disliked Pin
Chris Copeland11-Jun-24 23:46
mveChris Copeland11-Jun-24 23:46 
GeneralRe: Why is javascript so disliked Pin
MarkTJohnson12-Jun-24 1:25
professionalMarkTJohnson12-Jun-24 1:25 
GeneralRe: Why is javascript so disliked Pin
Jacquers12-Jun-24 1:48
Jacquers12-Jun-24 1:48 
GeneralRe: Why is javascript so disliked Pin
OriginalGriff12-Jun-24 2:33
mveOriginalGriff12-Jun-24 2:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.