Note that there are some explanatory texts on larger screens.

plurals
  1. POSome real interview questions C++
    primarykey
    data
    text
    <p>So I compiled some interview questions I was asked. I answered some and noted down the answers to the ones I could not. Some questions are not C specific and are general. Everyone can add their input to the questions. No obligation to follow the answers I wrote!</p> <p>Q1: What would be the size of a pointer on a 2 bit system and a 16 bit system?<br> A: 2 bits and 2 bytes</p> <p>Q2: Why did we need OOPs/classes when in C we had structs and could achieve the same?<br> A: Leave this to SO users to answer!</p> <p>Q3: If you were told to divide a program into distinct parts for an embedded system, what would they be?<br> A: IO part and CPU part</p> <p>Q4: What are some hardware level benefits of using threads? Any give a single example for a single CPU (single core) A: One thread would be doing some number crunching, the other just living for a millisec could signal an event to read the hard drive.</p> <p>Q5: If we had a pointer <code>char* p = NULL</code>, what would <code>cout&lt;&lt;sizeof(*p)</code> print? A: the size of <code>char</code>, not <code>char*</code>. Which means the amount of memory it can point to, not the size of the pointer itself</p> <p>Q6: Which functions do function pointers point to in a virtual table? A: Virtual functions</p> <p>Q7: How would you calculate how many threads a program needs to generate for an optimal performance for a single CPU (single core)? Will you do a physical test or can you automate your program? Give an example. Or both, again an example.<br> A: SO users your answer here!</p> <p>Q8: If a virtual function (not pure), is inheritance, is not implemented in the derived class. Now, If I have a base class pointer to a derived class object, and then make a call <code>baseObject-&gt;function()</code>, what will happen? Will there be any problem at any point in compile time/run time? A: None. :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload