CSO Midterm Study Guide Exam Questions
and Answers with Verified Solutions | Latest
Updated 2026
What is the main difference Stack memory is automatically managed
between and has
stack and heap memory? limited size, while heap memory requires
manual
management and has a larger capacity.
What structure does the stack LIFO (Last In, First Out)
follow?
What happens to variables stored They are destroyed.
in
the stack when a function returns?
What is the purpose of malloc() in To allocate memory on the heap.
C?
What must every malloc() have? A corresponding free() to release the
allocated
memory.
What is the difference between Traditional arrays have a fixed size at
traditional and dynamic arrays in compile time,
C? while dynamic arrays can be resized at
runtime.
, How do you declare a dynamic Declare a pointer and allocate memory
array using
in C? malloc().
What is the purpose of realloc()? To resize previously allocated memory.
What is the structure definition for typedef struct cell { int value; struct cell
a *next; }
linked list cell in C? CELL;
What is the time complexity for O(1) - Constant Time
adding an element to the front of a
linked list?
What is the algorithm to add an Create a new cell, traverse to the last
element to the end of a linked list? node, and
connect it to the new cell.
What is the traversal pattern for Use a separate pointer to traverse and
printing a linked list? check for
NULL to avoid dereferencing it.
What does the AND bitwise It results in 1 only if both bits are 1.
operator
do?
What is the effect of the left shift It moves bits left and fills the right with 0s,
(<<) effectively multiplying the number by 2^n.
operator?
and Answers with Verified Solutions | Latest
Updated 2026
What is the main difference Stack memory is automatically managed
between and has
stack and heap memory? limited size, while heap memory requires
manual
management and has a larger capacity.
What structure does the stack LIFO (Last In, First Out)
follow?
What happens to variables stored They are destroyed.
in
the stack when a function returns?
What is the purpose of malloc() in To allocate memory on the heap.
C?
What must every malloc() have? A corresponding free() to release the
allocated
memory.
What is the difference between Traditional arrays have a fixed size at
traditional and dynamic arrays in compile time,
C? while dynamic arrays can be resized at
runtime.
, How do you declare a dynamic Declare a pointer and allocate memory
array using
in C? malloc().
What is the purpose of realloc()? To resize previously allocated memory.
What is the structure definition for typedef struct cell { int value; struct cell
a *next; }
linked list cell in C? CELL;
What is the time complexity for O(1) - Constant Time
adding an element to the front of a
linked list?
What is the algorithm to add an Create a new cell, traverse to the last
element to the end of a linked list? node, and
connect it to the new cell.
What is the traversal pattern for Use a separate pointer to traverse and
printing a linked list? check for
NULL to avoid dereferencing it.
What does the AND bitwise It results in 1 only if both bits are 1.
operator
do?
What is the effect of the left shift It moves bits left and fills the right with 0s,
(<<) effectively multiplying the number by 2^n.
operator?