Loading…
Loading…
Topic
Articles and problems tagged DSA Practice.
Exercises with answers: animate the colours of video memory, make text rain down the screen, read and set the BIOS clock, decode the equipment word, predict outputs involving function pointers, far pointers and argv, and answer short questions on near, far and huge pointers.
Seven exercises with full, runnable solutions: a stack as a circular linked list, a circular doubly linked list, preorder and postorder traversal without recursion, copying and comparing binary search trees with recursion, and inserting a node as a left child in a threaded binary tree.
Five exercises with full solutions: a recursive determinant using calloc, reading and changing file attributes in a raw directory entry, a sorted directory listing with a linked list, and decoding a boot sector and partition table byte by byte.
Five exercises on structures and pointers: arrays of pointers to structures, a list of malloc'd nodes, 2-D char arrays in a structure, nested structures through a pointer, and calling a function before declaring it. Predict each output, then find the hidden bug.
Harder puzzles on structures that point to structures: ++ and -- inside ->, arrays of pointers to structures, swapping through structure pointers, malloc'd nodes, a two-node doubly linked list, and a circular list that never ends. Predict each output, then follow the step-by-step explanation.
Worked puzzles on structures: the dot versus arrow rule, the addresses and padding of structure members, arrays of structures, structures holding char arrays and char pointers, nested structures, and arrays of structures that point to each other. Predict each output, then read the explanation.
Write string functions yourself: find a character, find a substring, sort names, compress repeated spaces and encode a message. Each exercise has a hint and a full, runnable solution.
Short questions on strcat with literals, defining your own strcpy, and processing strings, followed by output puzzles that combine pointers, strcmp, strcat and 3-D char arrays.
Puzzles with pointers walking through strings: printing backwards, two pointers meeting in the middle, one-line string copy, three levels of pointers, and arrays of strings.
Worked puzzles on strings: the '\0' terminator, adding numbers to string literals, comparing strings with ==, sizeof on arrays of pointers and more. Predict the output, then check the explanation.
Exercises on 3-D array addresses, arrays of pointers to rows and blocks, a spot-the-bug puzzle on undefined behaviour, and shuffled pointer arrays. Full answers with diagrams.
Short questions that test whether you truly understand arrays and pointers: array vs pointer access, when an array name is not its base address, arr vs &arr, char a[] vs char *a, and more.
Advanced puzzles combining pointers to pointers, arrays of pointers and multi-dimensional arrays. Untangle expressions like **++ptr and *++*ptr with diagrams and step-by-step answers.
More worked puzzles: pointers that walk through arrays forwards and backwards, ++ and * combinations, and pointer subtraction. Each answer is explained step by step with runnable code.
Worked puzzles on arrays and pointers: array names as base addresses, pointer arithmetic, sizeof, and 2-D array addresses. Predict each output, then read the step-by-step explanation.
Practice exercises on pointer basics: predict outputs, find bugs and write small programs using addresses, pointer variables and functions that receive addresses. Solutions included.
Test your understanding of &, * and pointers to pointers with worked puzzles. Predict each program's output, then check the step-by-step explanation and the corrected modern C.