Unit5 - Subjective Questions

CSE101 • Practice Questions with Detailed Answers

1

Define a Pointer in C programming. Explain the Indirection operator () and the Address-of operator () with a suitable example.

2

Explain the concept of Generic Pointers (Void Pointers). How do we dereference a void pointer?

3

Distinguish between a Dangling Pointer and a Wild Pointer with examples.

4

What is Pointer Arithmetic? Explain the rules for addition and subtraction operations on pointers with a diagrammatic representation or calculation.

5

Explain how pointers are used to pass arguments to functions (Call by Reference). Write a C program to swap two numbers using pointers.

6

Describe the relationship between Pointers and One-Dimensional Arrays. How can array elements be accessed using pointer notation?

7

What is a Null Pointer? How is it different from an uninitialized pointer? Why is it useful?

8

Compare Static Memory Allocation and Dynamic Memory Allocation. List the functions used for Dynamic Memory Management in C.

9

Explain malloc() and calloc() with their syntax. Differentiate between them.

10

What is the purpose of realloc() and free()? Explain the concept of a Memory Leak.

11

How are Strings defined and initialized in C? Explain the significance of the Null Character (\0).

12

Discuss the different ways of reading a string from the user. Compare scanf() and gets()/fgets().

13

Explain Character Arithmetic with examples. How does C handle characters internally?

14

Write a C program (or function logic) to find the Length of a String without using the library function strlen().

15

Explain the working of strcpy() and write a custom function to copy one string to another using pointers.

16

Write a C program to Concatenate two strings without using the strcat() library function.

17

Explain the logic behind the strcmp() function. What values does it return and why?

18

What is a Pointer to a Pointer (Double Pointer)? How is it declared and used? Give an example.

19

Explain the difference between an Array of Pointers and a Pointer to an Array with syntax and usage examples.

20

Briefly describe the functionality of the following string library functions: strrev(), strlwr(), strupr(), and strncpy().