Top 5 C++ Interview Questions to Test Your Programming Prowess
Vložit
- čas přidán 22. 05. 2024
- Are you gearing up for a C++ job interview? Whether you're a seasoned C++ developer or a recent graduate looking to land your first job, it's essential to be prepared for the technical questions that may come your way during the interview process. In this video, we've compiled a list of the top 5 C++ interview questions that are frequently asked by hiring managers and technical interviewers.
Top 5 C++ Interview questions and Answers
Take a look at the top 5 C++ interview questions you face on an interview and how to answer those questions in the best possible way
Job Interview
Interview Preparation
C++ interview
C++ Interview Questions - Věda a technologie
I'll give this guy 6 of 10. Q1 + Q2 are quite stupid, you should never mess with the stack and heap in a way that was not intended. If you are not a compiler developer - end of discussion... Size of the structs matter even today in many cases, for example - keeping cache alignment, when working with GPUs. #ifdef #endif have a lot of usages. Include guards are not the best example, since most compilers have #pragma once which is faster. NULL is basically for C programming, while nullptr is for C++. NULL is still used in legacy code, low level WIN32 programming, and one should follow the general convention there.
Q1. If the local variable is living in stack frame of another thread, the access of that memory piece is valid through a pointer from another thread until the threads are running. Although some lifetime management and synchronisation are needed.
Q3: Size of the structs can be important regarding different communication protocols and their packets.
Great job!
Thanks man
He looks so much like benedict. :D
Q3: So designing it like this makes more sense, right?
struct TStruct
{
char a;
char b;
short c;
int d;
};
Yes.
I'd recommend u to read smth about data structure alignment in C++. Actually, it's very cool to understand how architecture of computer processor manage all this work with memory and why on earth this padding happened.
#1, create another dummy function. this will most likely prove your point.
Awesome
oy prashant babu!
Eazy
:)
It took you forever to get to the point. These don't sound like C++ questions... They're too basic. This is like... Guy right out of college level...?
Im sure your good man.. I just wanted more questions about the language and less about how pointers work.
I mean you didn't cover things like virutal inheritance how it works in multiple inheritance. The new Lambdas C++ supports. The mutex, critical section classes... Whats new in std template library stuff like that...
You just sorta noodle noised on basic stack allocation during method calls. Is this really how C++ interviews are conducted? I expected more code, patterns and newer features and less explanation about boiler plate interactions of heap and stack.
useful info: keyword new - calls the constructor
keyword delete - calls the destructor.
Hit like, if you didn't know 'bout this.
call to foo(NULL) is ambiguous in most compilers and leads to a compilation error, it's bad example imo
what the hell are you talking about NULL is defined as 0 and for compatibilityreasons whidely used instead of nullptr. WTF ^^
@@greatbullet7372 run cpp.sh/8zqjo, go back to school and do not post your stupid comments
Isn't that beginner level..?
I believe yes
#1. you can do this, if you use shared_ptrs
Nice point, but for those reading this is somewhat of a “clever” solution (not in a good way) and I would never say this in an interview. It’s frankly a kludge.
Any programmer who jumps to this as a potential solution would immediately set off red flags for me. Code would be totally unmanageable, hard to read, dangerously subject to memory leaks.
If you need dynamic memory, use the heap. If you need to pass values down function calls by reference, you should be passing by reference. If you need static memory, allocate it statically. Don’t do this as a workaround for any of those three.