Programming basics
The questions asked about C, Java and Python: pointers, memory, strings, exceptions. 19 questions with model answers.
1. What is the difference between a compiler and an interpreter? Basic
A compiler translates the whole program into machine code or bytecode before it runs, reporting all errors first; the result runs fast. An interpreter reads and runs the program line by line, stopping at the first error; it is easier to test with but usually slower. C and C++ are compiled. Python is usually interpreted, though it first turns code into bytecode. Java compiles to bytecode, which the JVM interprets and compiles just in time.
What the interviewer listens for
- Whole program first versus line by line
- Speed and error reporting
- Examples
- Java's mixed approach
They may ask next: What is JIT compilation?
2. What is the difference between the stack and the heap in memory? Basic
The stack holds function calls: local variables and return addresses. It is fast, managed automatically, and freed when the function returns, but it is small. The heap holds data that must outlive a function or whose size is known only at run time, such as objects made with new or malloc. It is larger but slower, and must be freed by the programmer or by a garbage collector.
What the interviewer listens for
- Stack: local variables, automatic, fast, small
- Heap: dynamic data, larger, slower
- Freeing: automatic versus manual or garbage collected
- Stack overflow and memory leaks
They may ask next: What causes a stack overflow?
3. What is a pointer? What is a null pointer and a dangling pointer? Basic
A pointer is a variable that holds the memory address of another variable. A null pointer holds no valid address and points to nothing; using it crashes the program. A dangling pointer still holds the address of memory that has been freed, so using it reads or corrupts whatever is there now. Set pointers to null after freeing to avoid that.
What the interviewer listens for
- Holds an address
- Null pointer points nowhere
- Dangling pointer points to freed memory
- Set to null after free
They may ask next: What is the difference between a pointer and a reference in C++?
These are 3 of the 19 questions. The rest, and practice rounds with Ari, come with Campus Ready.
Sign up free to take the placement tests and see your readiness
It takes a minute with your email. AiTeky Pass (₹999/month or ₹9,999/year) is free for your first 30 days.

