Unit4 - Subjective Questions

CSE357 • Practice Questions with Detailed Answers

1

Compare and contrast C, C++, and Java with respect to programming paradigms, memory management, and platform dependency.

2

Explain the concept of Pointers in C/C++. How is the address-of operator (\&) different from the dereference operator (*)?

3

Define Pointer Arithmetic. If an integer pointer holds the address $1000$ and the size of an integer is 4 bytes, what will be the value of ? Explain the calculation.

4

Describe the four distinct Storage Classes in C/C++ and their scope, lifetime, and default initial values.

5

Differentiate between a Class and a Structure in the context of C++.

6

Explain the four pillars of Object-Oriented Programming (OOP).

7

Discuss the concept of Constructors and Destructors in C++. When are they invoked?

8

Compare Call by Value and Call by Reference with appropriate examples.

9

What is Binding? Distinguish between Static Binding and Dynamic Binding.

10

Explain the difference between Stack and Heap memory in the context of OOP languages.

11

How is dynamic memory management handled in C++ versus C? Compare new/delete with malloc/free.

12

What is Garbage Collection in Java? Briefly explain the concept of 'Reachability'.

13

Explain the concept of Virtual Functions in C++. Why are they necessary for runtime polymorphism?

14

What is the this pointer in C++? What is its significance?

15

Distinguish between Shallow Copy and Deep Copy in the context of memory handling.

16

What is a Memory Leak? Provide a C++ code snippet that would cause a memory leak and explain how to fix it.

17

Define Access Specifiers in OOP. Explain public, private, and protected.

18

What is a Reference in C++? How does it differ from a pointer regarding initialization and nullability?

19

Explain the concept of Friend Functions in C++. Why does it seemingly violate encapsulation, and when is it useful?

20

Derive the logic for Pass by Address (Pointer) in C by writing a function to swap two integers. Explain the memory operations involved.