PROGRAMMING FOR PROBLEM SOLVING
Unit V · Pointers and Strings
Understand pointers, memory and strings through clear explanations and tested examples.
Pointer Basics
Pointers and Functions
- 05Does passing a pointer change C into pass by reference?2 marks
- 06Explain how pointer arguments allow a function to modify caller data.5 marks
- 07What does int **pp mean?2 marks
- 08Explain pointers to pointers with an example.5 marks
- 09What does int (*operation)(int, int) declare?2 marks
- 10Explain function pointers and callback-style use.5 marks
Pointers and Arrays
- 11What does an array expression usually become in an expression?2 marks
- 12Explain the relationship between pointers and one-dimensional arrays.5 marks
- 13How far does p + 1 move an int pointer within an array?2 marks
- 14Explain valid pointer arithmetic and pointer subtraction.5 marks
- 15What does const char *names[3] declare?2 marks
- 16Explain an array of pointers with a string example.5 marks
- 17What pointer type matches the first row of int a[2][3]?2 marks
- 18Explain pointers to rows of a two-dimensional array.5 marks
Dynamic Memory
- 19Which header declares malloc, calloc, realloc and free?2 marks
- 20Explain dynamic memory allocation and its main functions.5 marks
- 21How do malloc and calloc differ in initialisation?2 marks
- 22Compare malloc and calloc with a complete example.5 marks
- 23Why store realloc’s result in a temporary pointer?2 marks
- 24Explain safe use of realloc and free with an example.5 marks
- 25Distinguish a dangling pointer and a memory leak.2 marks
- 26Explain uninitialised pointers, dangling pointers and memory leaks.5 marks
String Basics
- 27What marks the end of a C string?2 marks
- 28Explain C strings, null termination and character arrays.5 marks
- 29Why is fgets useful for reading a line with spaces?2 marks
- 30Explain whole-line string input using fgets and safe newline handling.5 marks
- 31Why use const char * for a function that only reads a string?2 marks
- 32Explain character pointers and const string parameters in functions.5 marks
String Operations
- 33Name four standard string functions and their purposes.2 marks
- 34Explain the main string library functions and their precautions.5 marks
- 35Why is destination = source not an array-content copy in C?2 marks
- 36Explain string initialisation, pointer assignment and copying into a character array.5 marks
- 37What bounds must a substring request satisfy?2 marks
- 38Write a C function to extract a substring from a given position.5 marks
- 39How much capacity is needed to concatenate strings of lengths m and n?2 marks
- 40Explain string concatenation with a capacity-checked example.5 marks
- 41What do the signs of strcmp’s result mean?2 marks
- 42Explain string comparison using strcmp and why == is unsuitable for contents.5 marks
- 43Does a string length include the null terminator?2 marks
- 44Write a function to find a string’s length without strlen.5 marks
Substring Editing
No matching questions. Clear the search or change the marks filter.
The 2- and 5-mark badges are practice allocations. Previous-paper questions retain their printed marks.