Programming Trivia Questions [HELP ME OUT!]

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Programming Trivia Questions [HELP ME OUT!]

Post 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.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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?"
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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.
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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.
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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?"
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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:
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Programming Trivia Questions [HELP ME OUT!]

Post 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
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply