Page 1 of 1

Programming Trivia Questions [HELP ME OUT!]

Posted: Wed Aug 28, 2013 10:09 am
by TheBuzzSaw
I am preparing to host a programming trivia game at where I work. I haven't set a date yet, so, hopefully we have some time.

Yes, I will be Googling around for a few trivia question repositories, but I wanted to come up with a few of my own and let you guys contribute a few.

I want multiple choice only. I would rather avoid having to subjectively judge answers. Questions can be ABCD or true/false. I want a wide range of difficulty too. The categories are C++, C#, Java, and General. I'll post a link to my trivia doc once I've gathered a few.

--- EXAMPLES ---

[GENERAL] True or false? In 2's complement, -n == ~n + 1.

[C++] Which of the following will not compile?
A -- const int * x = 0;
B -- int const * x = 0;
C -- int * const x = 0;
D -- const int * const x = 0;
E -- int const * const x = 0;
F -- None of the above.

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Thu Aug 29, 2013 1:31 pm
by Falco Girgis
I had a boss at work who was notorious for destroying poor coop students who were interviewing at my job. My all-time favorite interview question to ask the CS kiddies is probably this:

"What is the difference between run-time and compile-time polymorphism and give examples of both."

So to make it multiple choice, I would just say something like "which of the following is an example of compile-time polymorphism?"

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Thu Aug 29, 2013 7:22 pm
by bbguimaraes
How about this: give me the declaration of a pointer to a function that takes a pointer to a function which accepts an int, const pointer to char and a pointer to a const double and returns an array of pointers to functions that accept a const pointer to const char and returns an array of pointers to void and returns a long long.

That was difficult to write, imagine solving it. The multiple choices would be fun, though.

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Fri Aug 30, 2013 10:06 pm
by TheBuzzSaw
bbguimaraes wrote:How about this: give me the declaration of a pointer to a function that takes a pointer to a function which accepts an int, const pointer to char and a pointer to a const double and returns an array of pointers to functions that accept a const pointer to const char and returns an array of pointers to void and returns a long long.

That was difficult to write, imagine solving it. The multiple choices would be fun, though.
Considering that the majority of my co-workers do not work in C++ (ever), even a question as simple as asking for the correct syntax of a function pointer would blow their minds.

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Sat Aug 31, 2013 4:49 am
by bbguimaraes
TheBuzzSaw wrote:Considering that the majority of my co-workers do not work in C++ (ever), even a question as simple as asking for the correct syntax of a function pointer would blow their minds.
If the goal is for everybody to learn something new, I think it'd be a nice question, could generate some interesting discussion.

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Sat Aug 31, 2013 11:49 am
by dandymcgee
Syntax is too language specific for large audiences. Falco's conceptual question seems more appropriate. If all else fails, you could revert to history questions like: "Who created the first compiler?" and "For which programming language was the compiler created?"

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Sun Sep 01, 2013 11:27 pm
by TheBuzzSaw
dandymcgee wrote:Syntax is too language specific for large audiences. Falco's conceptual question seems more appropriate. If all else fails, you could revert to history questions like: "Who created the first compiler?" and "For which programming language was the compiler created?"
That can be a category too, but try to focus here. I never said I'm wanting them to learn a ton from this. It's a game. :mrgreen:

Re: Programming Trivia Questions [HELP ME OUT!]

Posted: Tue Sep 03, 2013 6:18 pm
by MarauderIIC
Wide range of difficulty? Here's a couple:

What is the result of the following code?

Code: Select all

int x = 5;
if (x == 6);
{
    x = 4;
}
A) x will be four
B) x will be six
C) x will be five
Answer: A

What is the difference between a syntax error and a semantic error?
A) They are the same thing
B) A syntax error will not compile and a semantic error will compile and run but not produce the expected result
C) Both will compile but a semantic error will not affect the output of the program; a syntax error will
Answer: B