Giter Site home page Giter Site logo

cppquiz's Issues

Show the quiz solution

It would be nice if there was a link to show the quiz solution in case someone cannot answer the question

The explanation of the answer for Question 17 is wrong

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.

Question 3 - no explanation

Question 3 could use an explanation. Simple "ambiguous call to overloaded function" would probably suffice.

Use [syntax] to refer to the standard

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!

Export questions

Export all questions and given answers under a free license, so that others can play with the data.

Need explanation when you don't know the answer

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 #25

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.

Filter by difficulty

Categorize questions with difficulty levels. Allow the user to only view questions of one or more levels.

quiz on constructors/destructors

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.

Log all answers

Log all answers that people give. This can make for some interesting statistics, seeing which questions are most often answered wrongly etc.

User-explanations

Allow the user to enter his/her own explanation after answering correctly, to gather more and better explanations

URL converter bugs

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.

Generate a deterministic quiz

Make it possible to generate a quiz with a given number of questions, so that several people can take the same set of questions.

Question 11

It says variable a is static, but it's not (probably forgot to add static?).

include <iostream>

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.

Not an issue, but a suggestion on Q#109

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

New Question

include

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.

Improve HTTP 500 page

Add a link to try another question. Even though one page has crashed, the site itself might be fine.

Race mode

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.

Preview-key

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)

Wrong comment to question

The question is

What is the output of this program?

include

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

Q 112 explanation

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.

Coding standard

Go through questions and make them follow a coding standard

Ideas for statistics

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++

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.