So, I gathered some interviews that I was asked for. I answered some and noted the answers to those that I could not. Some questions are not specific and are general. Everyone can add their contribution to the questions. No obligation to follow the answers I wrote!
Q1: What will be the size of the pointer to the 2-bit system and 16-bit system?
A: 2 bits and 2 bytes
Q2: Why do we need OOP / classes when in C we had structures and could achieve the same?
A: Leave this to SO users to reply!
Q3: If you were told to divide the program into separate parts of the embedded system, what would they do?
A: IO part and processor part
Q4: What are some hardware level advantages when using threads? Any of them gives one example for a single processor (single core). A: One thread will make some crunchy numbers, others just live in milliseconds. signal an event to read the hard drive.
Q5: If we had a pointer char* p = NULL
, what would print cout<<sizeof(*p)
? A: char
size, not char*
. This means the amount of memory it points to, not the size of the pointer itself
Q6: What functions point to pointers to objects in a virtual table? A: Virtual Functions
Q7: How would you calculate how many threads a program requires for optimal performance for a single processor (single core)? Will you do a physical test or can you automate your program? Give an example. Or both that, and another, an example.
A: SO users will answer here!
Q8: If a virtual function (not pure) is an inheritance, it is not implemented in a derived class. Now, if I have a base class pointer to a derived class object, then make a call to baseObject->function()
, what will happen? Will there be any problems at any point in compile time / runtime? A: No. :)
c ++
user349026
source share