Skip to content

Instantly share code, notes, and snippets.

@abhisekp
Last active December 16, 2018 03:48
Show Gist options
  • Save abhisekp/0ff1d41cab47dd93e855d1cd532bf0c0 to your computer and use it in GitHub Desktop.
Save abhisekp/0ff1d41cab47dd93e855d1cd532bf0c0 to your computer and use it in GitHub Desktop.
FreeCodeCamp Quiz

FreeCodeCamp Quiz

— by Abhisek Pattnaik <[email protected]>

How to format the Quiz?

  • Question filenames are numbers (decimal/integer) with an optional extension of text (txt | text) or markdown (md) or (html) (will be converted to markdown)
  • Answers to the correspoding question must append _ANSWER or .ANSWER or -ANSWER or <space | no-space>ANSWER (lowercase/uppercase/mixedcase/any)
  • Multiple answers to the same question can be numbered by appending a number (integer) after answer string. e.g. 45answer1
  • answer without any appended number is given highest priority
  • If a particular file which matches the question/answer file format but is not to be included as a valid question/answer, then append an ! (exclamation mark) within last 8 chars of the filename (not including the extension) e.g. 153 answer !.md or 486.answer!song.md
  • If gist is deleted, then archive the questions from the gist within 7 days.
  • If a gist is starred (not accounting the star by the author themselves), gets more priority. Stars are considered only for the starrers who have a follower count > 3)
  • Individual questions have upvote/downvote enabled
  • Question number and Answer number must match 1:1 (not fallback support)
  • Each question after being parsed will contain a HJSON (http://hjson.org) formatted meta data in comments <!-- --> appended as footer.

E.g. the following are valid question file names

1.md
020.md
000300001.txt
976
95.5
98.49.text

The following are valid answer file names

1.answer.md
545-anSWer.txt
9879 answer
944 ANSWER.md
45answer0
5answer.2
004.5answer-99
004.5answer 485

How to get the Quizes?

  1. Submit gist url in the website
  2. Get author username and check number of brownie points
  • if brownies >= 1000, eligible for Quiz submission
  • if brownies >= 2500, auto accept quiz submission
  • if brownies < 1000, ask other to add the quiz to their quiz list gist
  1. Parse gist for Quiz question and answer (optional)
  2. Manual Quiz addition (without any gist url) must be approved manually.

Conflict resolution

Similar named file names

Random Quiz 101-01

Q: Are strings objects in JavaScript?

No, strings are primitives and not Object in JavaScript

Similarly, numbers are also primitives and not objects.

Example

var num = 1
var name = 'Quiz'

num.x = 2
console.log(num.x) //=> undefined

name.y = 'Something'
console.log(name.y) //=> undefined

Random Quiz 101-02

Q: Are regexp objects in JavaScript? e.g. /\W|_/g

Random Quiz 101-03

Q: How do you make an object a prototype of something else?
i.e. make protoObj, a prototype of myObj

  • a. Object.__proto__(protoObj, myObj)
  • b. myObj.__proto__ = protoObj
  • c. Object.setPrototypeOf(myObj, protoObj)
  • d. myObj = Object.create(protoObj)
  • e. myObj = new protoObj

Random Quiz 101-04

Q: How would you add a method to a string object? (not to the prototype of String)

Random Quiz 101-05

Q: How do you create an undefined value without using an undefined variable?

Random Quiz 101-06

Q: How do you fill an array with one thousand 1s? e.g. [1, 1, 1, 1, 1, 1, 1] (seven 1s)

Random Quiz 101-08

Q: What are the various ways to raise a number to the power of another number? e.g. $$\large{2^4 = 16}$$

Random Quiz 101-08

Q: How to repeatedly run a function for N number of times?

Random Quiz 101-09

Q: What is the size of an IP address?

  • a. 64 bit
  • b. 32 bit
  • c. 16 bit
  • d. 128 bit

Random Quiz 101-10

Q: Write a regex to match an IPv4 address.

Random Quiz 101-11

Q: What is the value of 5**2**2 (mental calculation)

Random Quiz 101-12

Q: How do you know if the value in a variable is actually a number in JavaScript?

Random Quiz 101-13

Q: What is this?
A: this in a function context refers to the object whose method it belongs to. Otherwise, it refers to the object which is explicitly bound using call, apply or bind methods. In case of anonymous arrow function context, this refers to the outer lexically scoped this

Random Quiz 101-14

Q: What is the difference between Object.getOwnPropertyNames and Object.keys?

Random Quiz 101-15

Q: What is the output of [1, 2, 3].map(parseInt)? (become a compiler yourself)

Random Quiz 101-16

Q: What is the difference between a partial function and a curried function?

Random Quiz 101-17

Q: How do you declare a class in JS along with a derived class?

psst. sugar coated sweet classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment