From 06174c839c71f5725bc682d96d0406c3fc72b781 Mon Sep 17 00:00:00 2001 From: Shivam Thakur Date: Sun, 2 Jan 2022 23:47:22 +0530 Subject: [PATCH 1/2] Added one question in each category. --- index.html | 228 +++++++++++++------------- quiz.js | 458 +++++++++++++++++++++++++++-------------------------- 2 files changed, 340 insertions(+), 346 deletions(-) diff --git a/index.html b/index.html index 631d3d2..6c44134 100644 --- a/index.html +++ b/index.html @@ -14,133 +14,125 @@ or in LICENSE.CC-BY-3 file. --> - + + FOSS Quiz! - - + + +
-

FOSS Quiz!

+

FOSS Quiz!

+ +

People

+ +

What is Linus Torvalds' native language?

+

Even thought Linus Torvalds is Finnish, his native language is Swedish.

+ +

Who is the father of GNU?

+

Richard Stallman

+ +

Who according to Linus Torvalds, “really is about a thousand gnomes working in [an] under-ground caves in Swansea”?

+

It's Alan Cox.

+ +

What does M in RMS stand for?

+

RMS refers to Richard Stallman, and M stands for his middle name which is Matthew.

+ +

UFS' magic number is based on the date 1954-01-19. Who was born on that day to justify the use as a magic number for that file system?

+

Marshall Kirk McKusick was born that day.

+ +

Who is FSF Associate Member number 1?

+

Bradley M. Kuhn is the first FSF Associate Member.

+ + +

Names, logos and mascots

+ +

What was the original name Linus wanted to use for his kernel? +

+

Freax, but mirror maintainer where it has been first distributed decided that Linux is better.

+ +
+

Which operating system's mascot is a pufferfish named Puffy. +

+
Puffy
+
+

Puffy is OpenBSD's mascot.

+ +
+

Which distribution is the oldest Linux distribution still being maintained?

+
Tux smoking a pipe
+
+

The oldest still distribution still being maintained is Slackware. +

+ +

What is the name of open source document store which is used to build versioned data products and it's mascot is a cartoon hybrid of cow and duck?

+

TerminusDB

+ +

What are the names of two followup BSD 4.3 released which were named after popular American holiday destinations?

+

Two followup BSD 4.3 releases are Tahoe and Reno.

-

People

+
+

Who drew in 1984 BSD 4.2 mascot called Beastie and is now a chief creative officer at Pixar?

+
Beastie
+
+

Even though McKussick holds the copyright it's John Alan Lasseter who drew it.

-

What is Linus Torvalds' native language?

-

Even thought Linus Torvalds is Finnish, his native language is - Swedish.

-

Who according to Linus Torvalds, “really is about a thousand - gnomes working in [an] under-ground caves in Swansea”?

-

It's Alan Cox.

- -

What does M in RMS stand for?

-

RMS refers to Richard Stallman, and M stands for his middle - name which is Matthew.

- -

UFS' magic number is based on the date 1954-01-19. Who was - born on that day to justify the use as a magic number for that - file system?

-

Marshall Kirk McKusick was born that day.

- -

Who is FSF Associate Member number 1?

-

Bradley M. Kuhn is the first FSF Associate Member.

- - -

Names, logos and mascots

- -

What was the original name Linus wanted to use for his - kernel?

-

Freax, but mirror maintainer where it has been first - distributed decided that Linux is better.

- -
-

Which operating system's mascot is a pufferfish named - Puffy.

-
Puffy
-
-

Puffy is OpenBSD's mascot.

- -
-

Which distribution is the oldest Linux distribution still - being maintained?

-
Tux smoking a pipe
-
-

The oldest still distribution still being maintained is - Slackware.

- -

What are the names of two followup BSD 4.3 released which - were named after popular American holiday destinations?

-

Two followup BSD 4.3 releases are Tahoe and Reno.

- -
-

Who drew in 1984 BSD 4.2 mascot called Beastie and is now - a chief creative officer at Pixar?

-
Beastie
-
-

Even though McKussick holds the copyright it's John Alan - Lasseter who drew it.

- - -

Licenses

- -

Which licenses third version was released on 29 of June 2007?

-

GNU General Public License.

- -

What is the license Android kernel is released under?

-

Even though a lot of Android uses more permissive license, - the kernel is based on Linux and thus distributed under the - terms of the GNU General Public License version 2.

- -

Name license which has a politically incorrect name and is - one of the shortest free software licenses whose legal text - consists of only one sentence.

-

Do What The Fuck you want to Public License.

- -

Which international organisation, whose primary focus is - advance in physics, has released a license used by most projects - in the Open Hardware Repository?

-

CERN.

- -

What are the differences between plain GNU General Public - License and Affero General Public License?

-

AGPL includes a clause requiring source code distribution of - software run as a service (eg. web applications).

- - -

Misc

- -

When did the initial release of Linux happen? Give month and - year.

-

The initial Linux release happened on September 1991.

- -

Which year Linus Torvalds was born.

-

Linus Torvalds was born on the year of Moon landing, - 1969.

- -

What is the name of a 16-bit microcomputer which was the - first architecture BSD system run on.

-

PDP-11.

- -
-

What's the Linux-based machine which competed in 2011 on - Jeopardy against Brad Rutter and Ken Jennings winning the - first prize of $1 million.

-
Watson's avatar
-
-

It's IBM's Watson.

- -

Lack of access to the source code of the software controlling - which printer convinced Richard Stallman of importance of - people's freedom to study, modify and use software?

-

Xerox 9700.

+

Licenses

+ +

Which licenses third version was released on 29 of June 2007?

+

GNU General Public License.

+ +

What is the license Android kernel is released under?

+

Even though a lot of Android uses more permissive license, the kernel is based on Linux and thus distributed under the terms of the GNU General Public License version 2.

+ +

What are the 3 Ps of licensing?

+

Portability, Piracy, and Profitability

+ +

Name license which has a politically incorrect name and is one of the shortest free software licenses whose legal text consists of only one sentence.

+

Do What The Fuck you want to Public License.

+ +

Which international organisation, whose primary focus is advance in physics, has released a license used by most projects in the Open Hardware Repository?

+

CERN.

+ +

What are the differences between plain GNU General Public License and Affero General Public License?

+

AGPL includes a clause requiring source code distribution of software run as a service (eg. web applications).

+ + +

Misc

+ +

What is the official birthday of linux operating system?

+

September 17, 1991

+ +

When did the initial release of Linux happen? Give month and year. +

+

The initial Linux release happened on September 1991.

+ +

Which year Linus Torvalds was born.

+

Linus Torvalds was born on the year of Moon landing, 1969. +

+ +

What is the name of a 16-bit microcomputer which was the first architecture BSD system run on.

+

PDP-11.

+ +
+

What's the Linux-based machine which competed in 2011 on Jeopardy against Brad Rutter and Ken Jennings winning the first prize of $1 million.

+
Watson's avatar
+
+

It's IBM's Watson.

+ +

Lack of access to the source code of the software controlling which printer convinced Richard Stallman of importance of people's freedom to study, modify and use software?

+

Xerox 9700.

- - + + + \ No newline at end of file diff --git a/quiz.js b/quiz.js index b3d5b6b..3bb0dbc 100644 --- a/quiz.js +++ b/quiz.js @@ -19,260 +19,262 @@ */ document.addEventListener('DOMContentLoaded', function() { - /* Must be two. */ - var teams = ['Team 1', 'Team 2']; - - var strTie = 'Tie'; - var strClose = 'Close'; - - /***********************************************/ - /* No need to configure anything further down. */ - /***********************************************/ - - var NS = 'http://www.w3.org/1999/xhtml'; - var D = document; - - /* Get categories and questions from DOM. */ - var categories = (function() { - var ret = [], questions = null, question = null; - var el = D.getElementById('questions').firstChild; - for (; el !== null; el = el.nextSibling) { - if (el.nodeType !== 1) { - continue; - } - - if (el.nodeName.toLowerCase() === 'h2') { - questions = []; - question = null; - ret.push({ - title: el.textContent, - questions: questions, - }); - continue; - } - - if (questions === null) { - continue; - } - - if (el.nodeName.toLowerCase() === 'p') { - var e = D.createElementNS(NS, 'div'); - el.parentNode.replaceChild(e, el); - e.appendChild(el); - el = e; - } else if (el.nodeName.toLowerCase() !== 'div') { - continue; - } - - if (question === null) { - el.className = 'q'; - question = el; - } else { - el.className = 'a'; - questions.push([question, el]); - question = null; - } - } - return ret; - })(); + /* Must be two. */ + var teams = ['Team 1', 'Team 2']; + + var strTie = 'Tie'; + var strClose = 'Close'; + + /***********************************************/ + /* No need to configure anything further down. */ + /***********************************************/ + + var NS = 'http://www.w3.org/1999/xhtml'; + var D = document; + + /* Get categories and questions from DOM. */ + var categories = (function() { + var ret = [], + questions = null, + question = null; + var el = D.getElementById('questions').firstChild; + for (; el !== null; el = el.nextSibling) { + if (el.nodeType !== 1) { + continue; + } + + if (el.nodeName.toLowerCase() === 'h2') { + questions = []; + question = null; + ret.push({ + title: el.textContent, + questions: questions, + }); + continue; + } + + if (questions === null) { + continue; + } + + if (el.nodeName.toLowerCase() === 'p') { + var e = D.createElementNS(NS, 'div'); + el.parentNode.replaceChild(e, el); + e.appendChild(el); + el = e; + } else if (el.nodeName.toLowerCase() !== 'div') { + continue; + } + + if (question === null) { + el.className = 'q'; + question = el; + } else { + el.className = 'a'; + questions.push([question, el]); + question = null; + } + } + return ret; + })(); - /* Scores will be saved here. */ - var scores = []; + /* Scores will be saved here. */ + var scores = []; - /* Helper functions */ + /* Helper functions */ - var nukeChildren = function(el) { - while (el.firstChild) { - el.removeChild(el.firstChild); - } - }; + var nukeChildren = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + + var addText = function(el, text) { + el.appendChild(D.createTextNode(text)); + }; - var addText = function(el, text) { - el.appendChild(D.createTextNode(text)); - }; + var addNewElement = function(parent, el, opt_text) { + var el = D.createElementNS(NS, el); + parent.appendChild(el); + if (opt_text) { + addText(el, opt_text); + } + return el; + }; - var addNewElement = function(parent, el, opt_text) { - var el = D.createElementNS(NS, el); - parent.appendChild(el); - if (opt_text) { - addText(el, opt_text); + var addNewClass = function(el, class_name) { + el.className += " " + class_name; } - return el; - }; - var addNewClass = function(el, class_name){ - el.className += " " + class_name; - } + /* Create the question board. */ - /* Create the question board. */ + var mDiv, linksList, xLink, tieLink, team0Link, team1link, closeLink; - var mDiv, linksList, xLink, tieLink, team0Link, team1link, closeLink; + (function() { + mDiv = addNewElement(D.getElementsByTagName('body')[0], 'div'); + mDiv.id = 'm'; + + var div = addNewElement(addNewElement(mDiv, 'div'), 'div'); + + xLink = addNewElement(div, 'a', 'x'); + xLink.id = 'x'; + + linksList = addNewElement(div, 'ul'); + linksList.id = 'links'; + team0Link = addNewElement(addNewElement(linksList, 'li'), 'button', teams[0]); + tieLink = addNewElement(addNewElement(linksList, 'li'), 'button', strTie); + team1Link = addNewElement(addNewElement(linksList, 'li'), 'button', teams[1]); + addNewClass(team0Link, 'btn_select'); + addNewClass(tieLink, 'btn_select btn_blue_light'); + addNewClass(team1Link, 'btn_select'); + + var el = addNewElement(div, 'ul'); + closeLink = addNewElement(addNewElement(el, 'li'), 'button', strClose); + addNewClass(closeLink, 'btn_select btn_blue_light'); + })(); - (function() { - mDiv = addNewElement(D.getElementsByTagName('body')[0], 'div'); - mDiv.id = 'm'; - var div = addNewElement(addNewElement(mDiv, 'div'), 'div'); + /* Build table with quesitons. */ - xLink = addNewElement(div, 'a', 'x'); - xLink.id = 'x'; + var makeClickHandler = (function() { + var questionShown = false; + var question, points, td; - linksList = addNewElement(div, 'ul'); - linksList.id = 'links'; - team0Link = addNewElement(addNewElement(linksList, 'li'), 'button', teams[0]); - tieLink = addNewElement(addNewElement(linksList, 'li'), 'button', strTie); - team1Link = addNewElement(addNewElement(linksList, 'li'), 'button', teams[1]); - addNewClass(team0Link, 'btn_select'); - addNewClass(tieLink, 'btn_select btn_blue_light'); - addNewClass(team1Link, 'btn_select'); + var close = function() { + mDiv.className = ''; + questionShown = false; + question[0].parentNode.removeChild(question[0]); + question[1].parentNode.removeChild(question[1]); + return false; + }; - var el = addNewElement(div, 'ul'); - closeLink = addNewElement(addNewElement(el, 'li'), 'button', strClose); - addNewClass(closeLink, 'btn_select btn_blue_light'); - })(); + xLink.onclick = close; + tieLink.onclick = function() { + m.className += ' showAnswer'; + return false; + }; + (function() { + var makeTeamClickHandler = function(team) { + return function() { + if (team !== -1) { + scores[team][0] += points; + nukeChildren(scores[team][1]); + addText(scores[team][1], '' + scores[team][0]); + } + td.className = ''; + td.onclick = null; + close(); + return false; + }; + }; + + team0Link.onclick = makeTeamClickHandler(0); + team1Link.onclick = makeTeamClickHandler(1); + closeLink.onclick = makeTeamClickHandler(-1); + })(); + + return function(_question, _points) { + return function() { + if (!questionShown) { + question = _question; + points = _points; + td = this; + + question[0] = question[0].cloneNode(true); + question[1] = question[1].cloneNode(true); + linksList.parentNode.insertBefore(question[0], linksList); + linksList.parentNode.insertBefore(question[1], linksList); + m.className = 'show'; + } + return false; + }; + }; + })(); - /* Build table with quesitons. */ + var makeScoreHandler = function(team) { + return function() { + var score = window.prompt('Enter new score:', scores[team][0]); + if (score) { + score = parseInt(score); + scores[team][0] = score + nukeChildren(scores[team][1]); + addText(scores[team][1], '' + score); + return false; + } + } + }; - var makeClickHandler = (function() { - var questionShown = false; - var question, points, td; + (function() { + var table, rowset, row, cell; - var close = function() { - mDiv.className = ''; - questionShown = false; - question[0].parentNode.removeChild(question[0]); - question[1].parentNode.removeChild(question[1]); - return false; - }; + table = D.createElementNS(NS, 'table'); + mDiv.parentNode.insertBefore(table, mDiv); + rowset = addNewElement(table, 'thead'); + row = addNewElement(rowset, 'tr'); + row.className = 'title'; - xLink.onclick = close; - tieLink.onclick = function() { - m.className += ' showAnswer'; - return false; - }; + cell = addNewElement(row, 'th'); + cell.setAttribute('colspan', '' + categories.length); - (function() { - var makeTeamClickHandler = function(team) { - return function() { - if (team !== -1) { - scores[team][0] += points; - nukeChildren(scores[team][1]); - addText(scores[team][1], '' + scores[team][0]); - } - td.className = ''; - td.onclick = null; - close(); - return false; - }; - }; + var title = D.getElementsByTagNameNS(NS, 'title')[0]; + addNewElement(cell, 'h1', title.textContent); - team0Link.onclick = makeTeamClickHandler(0); - team1Link.onclick = makeTeamClickHandler(1); - closeLink.onclick = makeTeamClickHandler(-1); - })(); + row = addNewElement(rowset, 'tr'); + row.className = 'categories'; - return function(_question, _points) { - return function() { - if (!questionShown) { - question = _question; - points = _points; - td = this; - - question[0] = question[0].cloneNode(true); - question[1] = question[1].cloneNode(true); - linksList.parentNode.insertBefore(question[0], linksList); - linksList.parentNode.insertBefore(question[1], linksList); - m.className = 'show'; - } - return false; - }; - }; - })(); - - var makeScoreHandler = function(team) { - return function() { - var score = window.prompt('Enter new score:', scores[team][0]); - if (score) { - score = parseInt(score); - scores[team][0] = score - nukeChildren(scores[team][1]); - addText(scores[team][1], '' + score); - return false; - } - } - }; - - (function() { - var table, rowset, row, cell; - - table = D.createElementNS(NS, 'table'); - mDiv.parentNode.insertBefore(table, mDiv); - rowset = addNewElement(table, 'thead'); - row = addNewElement(rowset, 'tr'); - row.className = 'title'; - - cell = addNewElement(row, 'th'); - cell.setAttribute('colspan', '' + categories.length); - - var title = D.getElementsByTagNameNS(NS, 'title')[0]; - addNewElement(cell, 'h1', title.textContent); - - row = addNewElement(rowset, 'tr'); - row.className = 'categories'; - - categories.forEach(function(cat) { - cell = addNewElement(row, 'th', cat.title); - }); - - rowset = addNewElement(table, 'tbody'); - - var max = 0; - categories.forEach(function(cat) { - if (cat.questions.length > max) { - max = cat.questions.length; - } - }); - - for (var i = 1; i <= max; ++i) { - row = addNewElement(rowset, 'tr'); - - categories.forEach(function(cat) { - cell = addNewElement(row, 'td'); - if (i <= cat.questions.length) { - addText(cell, '' + (i * 100)); - cell.className = 'active'; - cell.onclick = makeClickHandler(cat.questions[i - 1], i * 100); - } else { - addText(cell, '\u00A0'); + categories.forEach(function(cat) { + cell = addNewElement(row, 'th', cat.title); + }); + + rowset = addNewElement(table, 'tbody'); + + var max = 0; + categories.forEach(function(cat) { + if (cat.questions.length > max) { + max = cat.questions.length; + } + }); + + for (var i = 1; i <= max; ++i) { + row = addNewElement(rowset, 'tr'); + + categories.forEach(function(cat) { + cell = addNewElement(row, 'td'); + if (i <= cat.questions.length) { + addText(cell, '' + (i * 100)); + cell.className = 'active'; + cell.onclick = makeClickHandler(cat.questions[i - 1], i * 100); + } else { + addText(cell, '\u00A0'); + } + }); } - }); - } - rowset = addNewElement(table, 'tfoot'); - row = addNewElement(rowset, 'tr'); + rowset = addNewElement(table, 'tfoot'); + row = addNewElement(rowset, 'tr'); - var addScoreCell = function(team) { - cell = addNewElement(row, 'td'); + var addScoreCell = function(team) { + cell = addNewElement(row, 'td'); - var div = D.createElementNS(NS, 'div'); - cell.appendChild(div); - div.appendChild(D.createTextNode(teams[team])); + var div = D.createElementNS(NS, 'div'); + cell.appendChild(div); + div.appendChild(D.createTextNode(teams[team])); - div = D.createElementNS(NS, 'div'); - cell.appendChild(div); - div.appendChild(D.createTextNode('0')); - div.onclick = makeScoreHandler(team); - return div; - }; + div = D.createElementNS(NS, 'div'); + cell.appendChild(div); + div.appendChild(D.createTextNode('0')); + div.onclick = makeScoreHandler(team); + return div; + }; - scores.push([0, addScoreCell(0)]); - if (categories.length > 2) { - cell = D.createElementNS(NS, 'td'); - cell.setAttribute('colspan', '' + categories.length - 2); - row.appendChild(cell); - } - scores.push([0, addScoreCell(1)]); - })(); -}); + scores.push([0, addScoreCell(0)]); + if (categories.length > 2) { + cell = D.createElementNS(NS, 'td'); + cell.setAttribute('colspan', '' + categories.length - 2); + row.appendChild(cell); + } + scores.push([0, addScoreCell(1)]); + })(); +}); \ No newline at end of file From 71833925ec737b4d98b0a952fd28c5b38cd69578 Mon Sep 17 00:00:00 2001 From: Shivam Thakur Date: Sun, 2 Jan 2022 23:56:57 +0530 Subject: [PATCH 2/2] Added a comment for more understanding of code. --- quiz.js | 1 + 1 file changed, 1 insertion(+) diff --git a/quiz.js b/quiz.js index 3bb0dbc..e162827 100644 --- a/quiz.js +++ b/quiz.js @@ -193,6 +193,7 @@ document.addEventListener('DOMContentLoaded', function() { }; })(); + // Function to correct the score, if there was any kind of mix - up. var makeScoreHandler = function(team) { return function() { var score = window.prompt('Enter new score:', scores[team][0]);