Hard C++ questions

Me and a HR person are interviewing five candidates for a C++ job. One of the candidates is a Poojeet born and raised in the US.

I don't want non-white colleagues. What are some hard C++ questions that will confuse and upset the Poojeet?

Attached: 1520247941365.jpg (602x249, 26K)

Other urls found in this thread:

en.cppreference.com/w/cpp/numeric/fenv
youtube.com/watch?v=3MB2iiCkGxg&t=2249s
twitter.com/SFWRedditVideos

hahahaha, as a non-white & and non-pojeet.. you're a retard.

> I don't regret not taking any music or languages
What a fucking brainlet pleb.

ask him to write code without "using namespace std"

"what is a diamond problem"

Smart pointers
Templates
Usually pajeets writes C++ as plain C or OOP sintaxis like java(abuse a lot new operator).

>Why can't you put std::string into a union?
>Why can C++ be faster than C?
>Why are headers shit?
>Why are templates a clunky way of metaprogramming?
>What are the differences between struct/class?
>Are arithmetic operations with floating point values pure?

these, desu

>I don't want non-white colleagues. What are some hard C++ questions that will confuse and upset the Poojeet?
"Are you white?"

>Are arithmetic operations with floating point values pure?
Depends on the compiler options desu.

kek

Just ask extreme details regarding how templates/inheritance/friend functions/obscure STL functionalities interact with each other

>One of the candidates is a Poojeet born and raised in the US.

So he is an American?

He's a pajeet you civpat cuckold, nobody wants to work with racially inferior mudskins

#include

int main()
{
std::string(s);
}

Will this compile? Why/why not?

>sintaxis

Attached: 1438054951504.png (241x230, 15K)

>civpat

?

>nobody wants to work with racially inferior mudskins

I'm curious. What is your educational background?

This makes me feel like I retard.
>Why can't you put std::string into a union?
I had to google that. Apparently, it's because it has a non-trivial constructor and thus when instantiating the union, the compiler wouldn't know whether to call the constructor or not.
>Why can C++ be faster than C?
Type safety removes the need for runtime type checks and needless void pointers like in C. Also the compiler can understand your abstractions well.(?)
>Why are headers shit?
Because you have to re-compile them every time you include them, thus skyrocketing compile times, especially when the headers contain much templated code. Precompiled headers are a pain in the ass and don't fully help.
>Why are templates a clunky way of metaprogramming?
They were not meant to be used that way. It was a pure accident that they enable template metaprogramming at all. Template metaprogramming is fully stateless and completely different from how you write C++ code. Also you can only use numbers, not strings... unless you go full workaround (?)
>What are the differences between struct/class?
Struct's members are public by default, class's private. Never heard of any other differences.
>Are arithmetic operations with floating point values pure?
If they aren't, please tell me why. That would be pretty broken.

>try to write code without it
>fucking strings don't function as normal
>cout won't print them
>put it back
>still don't work

it's syntax user

Hire him if he's qualified, don't hire if he isn't. What's any of that got to do with his skin color?

en.cppreference.com/w/cpp/numeric/fenv

He could be super nice you know.

it will, std::string(s); is in fact declaration and initialization of string variable "s"
just deal with C++ having the most retarded declaration syntax rules ever and you'll be fine, there is no point in fighting it, it's over 30 years of tradition in doing retarded things after all

He's already got the job

Amerifats are all mutts anyway, what does it matter?

>it's over 50 years of tradition in doing retarded things after all
ftfy

do you count C or what?

Attached: Screenshot_20180506_175301.png (285x58, 6K)

yes

Considering that OP even needed to ask this, it's because OP's a racist redneck along with his redneck buddies supporting him here.

Attached: 75f61e40c2207e63911c1264ac95d1b6.jpg (450x455, 38K)

I know user. I'm typing this with my dick, because my hands are full with guns.

>implying there is anything wrong with self defense
>implying the police have any duty to protect you
>implying pajeets aren't subhuman.

OP is a LARPing. There are racist programmers but no there are no racist C++ programmer.

>Americans complaining about race

Haha, goddamn, you can't blame the 56%ers. Cheeky lads.

Attached: 1525364549519.gif (640x550, 204K)

If your country was 44% shitskins, you'd hate them too.

>What are some hard C++ questions that will confuse and upset the Poojeet?
Something that you can't solve yourselves, though there's a big chance that he can.

>claims to be above poojet
>can't even think of C++ questions to ask on his own

use my favorite spoj problem
spoj.com/problems/OLOLO

Onotole has a lot of pyani. Each pyani has a number, writing on it. Pyanis with equal numbers are indistinguishable. Onotole knows everything, so, he knows that each pyani appeared twice, and only one pyani is unique. He wants to get вздpъжни эффeкт, and he needs the unique pyani. Given the list of pyanis denote which one of them appeared once (it is guaranteed that other pyanis appeared twice).

First line of input contains number of pyanis N

Jow Forums here.
For fucks sake don't actually do this. Don't EVER do this. Hold people to the same standard, your question should always be hard.

Does the following code compile?
If not, what error message would you expect?
#include

void f() {
std::string(foo);
}

int main() {
f();
return 0;
}

What about
#include

void f() {
std::string(foo);
std::string(foo);
}

int main() {
f();
return 0;
}
?

>Jow Forums here.

You civnat cucks don't speak for the rest of us. Jow Forums is a white nationalist board.

Shitskins are not welcome in white countries.

Attached: civnat.jpg (1600x1600, 817K)

With an attitude like that I’m betting you really aren’t a nice person

(When did Jow Forums start shitting up every other board?)

Write a thread-safe, exception-safe linked list. You're free not to explicitly mention thread-safety and exception-safety.

>I don't want non-white colleagues.
Then go ask your question in Jow Forums.

I think he just asks a hard question that a white person could answer, but not a pajeet who has minimal experience that isn't a memorized solution

I’ll take a guess, poor neighbourhood, white kid who got bullied cause the other kids were even poorer. Grew up assuming these issues are based on the amount of melanin in your skin and not a socioeconomic problem. Probably had parents who reinforced this concept and barely scraped through college as much more wealthy asians worked diligently to finish on high accolades. He’s been bitter ever since. Isn’t that right Tim?

Clarification: only mention the implementation has to "be correct according to our demanding tests," not that your tests will involve concurrent accesses and exceptions everywhere.

doesn't compile.
undeclared variable "foo"" in booth.

A homogeneous environment is a productive environment

Smart pointers, ask to implement an immutable binary search tree
Ask about the importance of copy constructor and copy assignment, then ask why move semantics are important efficiency wise (you can expand this to RAII and r-values)

Other than that ask about algorithms, that'll filer out 99% of street shitters.

Wrong.
The first one compiles fine, and is interpreted as a declaration of "foo"
The second one does not, as "foo" has already been declared.

Better luck next time, pajeet :^)

The more you know.

Attached: 2018-05-06-112603_1920x1080_scrot.png (243x369, 20K)

Ask them about all the horrible bits of C++.
Ask them about Most Vexing Parse, forwarding references and reference collapsing rules, variadic templates and SFINAE, overload resolution (especially for constructors) and how they interact with function template specialization. Ask about undefined behavior.

This, and about the many compiler passes.

>ask about trivia that will never come up when writing proper code

OP wanted to make Pajeet squirm.

Also, each of those issues will appear eventually for an experienced C++ dev. It's just a mater of time.

care to explain why the fuck first one should compile?

You're allowed parenthesis as part of a declarator. This is used to facilitate pointer/reference-to-function/array declarations, but you can have parens that do contain neither * nor & for consistency's sake.

So it's functionally equivalent to std::string foo;

It's interpreted as a declaration, for some reason.
#include
#include

std::string f()
{
std::string(foo);
foo = ":^)";
return foo;
}

int main()
{
std::cout

Just some random eastern eggs?
What is this shit?

C++ grammar is ambiguous. You can see that it can either be interpreted as a functional-style cast, but it can also be read as a declaration if you squint.
For the sake of backward compatibility with C, C++ will always interpret an ambiguous statement of this kind as a declaration even if it's unintuitive.
It gets worse.
Foo bar(Baz());
What do you think this statement does? Answer without googling.

It initializes Bar with the return from Baz

declare "bar" as function pointer that takes a function pointer name "Baz" that takes void and return (bar return) "Foo"
Fuck this is insane.
Tell me this was useful for John Carmack or any of those top level programmer ever in life?

>answer without googling
It is hard to google trivial stuff like this so I doubt it would help.

Without knowing the context, I would assume Baz() returns a data type with is used in the constructor of a Foo type when initializing bar.

lol

its from a video :

youtube.com/watch?v=3MB2iiCkGxg&t=2249s

Never touch C, and I left C++ 20 years ago in uni. Looks like a good decision for me. My brain can't process those weird things.

>65827535
Almost. bar is a regular old function, not a function pointer. But you're right in that Baz() was coerced to Baz(*)() because that was allowed for function parameters in C. Which is absolutely retarded, but you know. "Backward compatibility".

And you two were wrong. This is so heinous it has its own name, Most Vexing Parse.

What answer would satisfy you except "I can't possibly tell you what anything means without context"?

I kind of guessed it somewhat correct because last year I read The C programming language completely.