T4Tutorials .PK

VU Past Papers CS302 – Introduction to Data Structures and Arrays Questions & Answers (Lectures 1–22)

Lecture-Wise Questions & Answers (Lectures 1–22)


Lecture 1: Introduction to Data Structures and Arrays

Q1: What are constraints?
A: Constraints define limitations or restrictions on resources of a system (like memory, disk space, or time). Efficient solutions solve problems within resource constraints.

Q2: What is lvalue?
A: Lvalue is a memory location where a value can be stored. Appears on the left-hand side of assignment. Example: int var = 7;var is lvalue.

Q3: What is the “current” pointer?
A: A variable showing the currently focused element in an array or list. Example: current = 5 means focus is on element 5.

Q4: What is an algorithm?
A: A finite sequence of steps to solve a problem.

Q5: Role of arrays in data structures:

Q6: How many types can data be organized?

  1. Linear (arrays, lists)
  2. Non-linear/Hierarchical (trees)

Q7: Importance of data structures:

Q8: What is a chunk?
A: A piece of memory of reasonable size.

Q9: Basic purpose of data structure:

Q10: What are argc and argv?

Q11: Difference between data structure and algorithm:

Q12: What is efficiency?

Q13: What is Array Name and x?

Q14: List Data Structure & Operations:

OperationDescription
createList()Create a new list
copy()Copy one list to another
clear()Remove all elements
insert(X, ?)Insert element X at a position
remove(?)Remove element at a position
get(?)Get element at position
update(X, ?)Replace element at position with X
find(X)Check if X exists
length()Return list length

Q15: Dynamic arrays:

Q16: Difference between Array and List:

FeatureArrayList
MemoryContiguous/staticDynamic/random
SizeFixedCan grow
ModificationEasyComplex
Addition/DeletionNot possible after declarationCan add/delete nodes

Lecture 2: Linked Lists and Dynamic Memory

Q1: What are linked lists?

Q2: Why use arrays for implementing lists?

Q3: Difference between static and dynamic arrays:

FeatureStatic ArrayDynamic Array
MemoryStackHeap
SizeFixedCan be input by user
Exampleint arr[6];int* arr = new int[size];

Q4: Difference between array and list:

FeatureArrayList
ElementsHomogeneousHeterogeneous
MemoryContinuousRandom
SizeFixedCan be dynamic

Q5: How to set current position?

Q6: How to shift elements left/right in array?

Q7: Main operations on lists: (same as Lecture 1)

Q8: Main difference between array and list:

Exit mobile version