Click here to Skip to main content
15,924,193 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
Kent Sharkey12-Jun-24 13:04
staffKent Sharkey12-Jun-24 13:04 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
jmaida12-Jun-24 17:25
jmaida12-Jun-24 17:25 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
honey the codewitch12-Jun-24 20:42
mvahoney the codewitch12-Jun-24 20:42 
GeneralRe: He had a girlfriend named "Megan" and the removal is going slowly Pin
Richard Deeming12-Jun-24 21:41
mveRichard Deeming12-Jun-24 21:41 
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 
I'm creating a data bank of MCQ (Multi Choice Questions) and their answers so that an app can be built around it. Regarding the actual storage format, I have two ideas:
  1. An array of objects with keys (q for question, a for choice-a, etc.).
  2. An array of arrays.
The first one is obviously more readable. Here is a brief sample of what I have so far:
JSON
{
    "data": [
        {
            "q": "What kind of language is Python?",
            "a": "Compiled",
            "b": "Interpreted",
            "c": "Parsed",
            "d": "Elaborated",
            "r": "b"
        },
        {
            "q": "Who invented Python?",
            "a": "Rasmus Lerdorf",
            "b": "Guido Van Rossum",
            "c": "Bill Gates",
            "d": "Linus Torvalds",
            "r": "b"
        }
    ]
}

The app will read the q key to print the question, then present the four options (a, b, c and d). And the last key (r) will store the right answer. This is very much readable when viewed as a JSON file also. However, what I am thinking is that once the data-bank grows in size into hundreds/thousands of QA, a lot of space will be wasted by those keys (q,a,b,etc.) isn't it? In this case, an array like this is more efficient from storage perspective:
JSON
{
    "data": [
        [
            "What kind of language is Python?",
            "Compiled",
            "Interpreted",
            "Parsed",
            "Elaborated",
            1
        ],
        [
            "Who invented Python?",
            "Rasmus Lerdorf",
            "Guido Van Rossum",
            "Bill Gates",
            "Linus Torvalds",
            1
        ]
    ]
}

In this case, each array will have 6 items viz. the question, four choices and finally the index of the correct choice (1==Interpreted, etc.).

Which of these two formats is better? Feel free to suggest any third format which is even better than these two.
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 Pin
Jon McKee12-Jun-24 10:58
professionalJon McKee12-Jun-24 10:58 
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 

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.