knatten / cppquiz Goto Github PK
View Code? Open in Web Editor NEWSource for the http://cppquiz.org website (not the questions)
License: GNU General Public License v3.0
Source for the http://cppquiz.org website (not the questions)
License: GNU General Public License v3.0
Which questions get the most wrong answers
What are the most common answers for each question
Probably a lot more we could do
Publish a blog post at some point about what are common misunderstandings of C++
To have a low threshold for giving feedback
Hi, I've just noticed that question #117 (and probably others) refers to a section from the standard as §14.5.7.1, while I think it would be more future-proof to use the syntax that makes use of brackets and the abbreviated title of the section, which in this case would be [temp.alias].1 (I am not sure about how to indicate the fact that you are referring to the first stanza).
Thanks for your work on C++ Quiz!
It seems like if an URL is at the end of a paragraph, a
is appended to the url.
Also, if it is on the first column of a line, it is not converted.
Should have been "virtual".
Categorize questions with difficulty levels. Allow the user to only view questions of one or more levels.
It says variable a is static, but it's not (probably forgot to add static?).
int a;
int main () {
std::cout << a;
}
Correct!
Since a is a static variable, it is guaranteed to be initialized to its default value, 0. Had a been defined as a local non-static variable inside main(), this would not have happened.
An input field for hints is currently not shown on the contribute page.
class A {
public:
virtual void f() { std::cout << "A"; }
};
class B : public A {
private:
void f() { std::cout << "B"; }
};
void g(A& a) { a.f(); }
int main () {
B b;
g(b);
}
you can add this question in cppquiz if you like.
No compile error as compiler only checks for the A function at the compile time. It can not see we are calling with B object.
B function gets called during run time even it is private.
For some reason I sometimes get visitors who have lowercased the entire quick link key, and cannot see the quiz. Find a solution to this.
Some calls are made to deprecated Django functions, fix these
When in quiz mode, UsersAnswers are not saved. This is bad for statistics, but also makes debugging difficult.
Go through questions and make them follow a coding standard
std::endl is sent to standard output, but the answer that is selected is "0", not "0\n".
If the user doesn't know the answer - and guessing is failing - he needs some way to "give up" and let the quiz tell him the answer (in training mode, at least).
Great product! Thanks for setting this up.
Question 35 tries to use cppquiz.org/static/level-0.png for the difficulty icon. But the image does not exist.
cppquiz.org/quiz/question/35
It says:
The base class constructor is called before the inherited constructor. The inherited constructor is called before the base class constructor.
It should say:
The base class constructor is called before the inherited constructor. The inherited destructor is called before the base class destructor.
The answer to question #112 is correct, but the explanation given is wrong.
12.8/15 applies to implicitly-defined [copy and] move constructors only. But the move constructor B::B(B&&) is user-defined.
The real reason copy constructor A::A(const A&) is called is that in the move constructor's mem-initializer "a(b.a)", expressions "b" and "b.a" are lvalues, not xvalues.
Postpone until webfaction has clang-format installed
Allow several people to take the same quiz at the same time, getting scored by the number of correct answers they gave in a limited time. Announce the winner at the end.
It would be cool if they could see live how the competitors are doing.
Use GET in quiz mode (like in training mode), to make debugging easier
They should be moderated though
Example: quiz_extras_test.py
Should rewrite to use something like exclude(id__in = [a.question.pk for a in self.answers])
Does the standard say that std::cout is initialized before the global variable A a; that's ctor uses std::cout or after its destruction . IMHO, the initialization sequence of global variables in different compilation units is unspecified. At least we have been bitten about that in the past, but today compilers, linkers or the standard might be more definitive. Please enlighten me.
Check that they continue to run
Question 3 could use an explanation. Simple "ambiguous call to overloaded function" would probably suffice.
Question #27 has an meaningless endl
Add a link to try another question. Even though one page has crashed, the site itself might be fine.
Make it possible to generate a quiz with a given number of questions, so that several people can take the same set of questions.
When in training mode, you get some interesting explanation text after answering a question successfully. This text does not appear in quiz mode, which means if you see a question you don't fully understand then you have no idea why the answer is correct
Should allow multiline code examples in answers and hints. Maybe something like the four spaces on StackOverflow.
Export all questions and given answers under a free license, so that others can play with the data.
Allow the user to enter his/her own explanation after answering correctly, to gather more and better explanations
Let questions be preview-able by anyone who has a preview-key. This will make it easier to discuss questions which are not published yet.
(There is currently a preview-functionality which requires the user to be logged in as an admin)
It would be nice if there was a link to show the quiz solution in case someone cannot answer the question
Hi,
On the quiz#109, I tested the following correction with clang and it also worked, and think it works better(less verbose):
replace the call to call_with(print, 42) with
call_with(print, 42);
I think the compiler just needed a little help on the type for T, an explicit specialization should suffice.
Thank you for providing such a great site. I learned a lot from it.
Regards,
Steve
I don't think there should be std::endl here:
std::cout << ++i << std::endl;
After bumping into std::endl it's quite obvious, that the answer cannot be compilable and deterministic, because otherwise we would have to deal with inputting std::endl in the answer field and it was nowhere explained how to do that (\n? hit enter?). It gives a huge hint, I didn't even think about the answer and clicked "is undefined" right away because of that.
The question is
What is the output of this program?
class A {
public:
A() { std::cout << 'a'; }
~A() { std::cout << 'A'; }
};
class B
{
public:
B() { std::cout << 'b'; }
~B() { std::cout << 'B'; }
A a;
};
int main () {
B b;
}
The answer is:
Correct!
The base class constructor is called before the inherited constructor. The inherited constructor is called before the base class constructor.
But there is no inheritance in this question. (Copy paste bug from an other question?)
I think you meant that B inherited from A and that B did not have an A member variable
This field is ignored in those cases, so just hide it
Don't allow a question to be published without a hint or difficulty level. (Remember to remove default 'no hint' from models.py)
Log all answers that people give. This can make for some interesting statistics, seeing which questions are most often answered wrongly etc.
Make a "did you mean..." page when people mistype a quiz key (as they apparently do now and again)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.