Short Answer Questions
Q.1: What is Computational Structure?
- Refers to the underlying framework or organization of computing systems and programs.
- Involves arrangement of data, algorithms, and how computations are performed.
- Uses various data structures (arrays, lists, trees, graphs, etc.) to organize and represent data.
- Each structure has strengths/weaknesses for different types of data/operations.
Q.2: What is primitive computational structure?
- Refers to the most basic building blocks of computation.
- Primitive data types: integers, floats, booleans, characters.
- Basic control structures:
- Sequence (executing statements in order)
- Selection (if-else, switch-case)
- Iteration (for, while loops)
- Primitive operations:
- Arithmetic (+, -, *, /)
- Comparison (==, <, >)
- Logical (AND, OR, NOT)
Q.3: What is List?
- A list is a data structure used to store an ordered collection of items.
- Lists are fundamental in programming and computer science.
Q.4: How List is created?
- Depends on programming language/context.
- General idea: define a collection of items in a sequence.
- Example in Python:
my_list = [10, 20, 30, 40] print(my_list[1]) # Output: 20 my_list.append(50) # Adds 50 to the end
Q.5: Write a short note on List Properties.
- Lists are widely used due to flexibility and ease of use.
- Key properties:
- Ordered – elements stored in sequence.
- Indexed Access – elements accessed via index (starting from 0).
- Heterogeneous – can contain elements of different types (in dynamic languages).
- Mutable – items can be added/modified/removed.
- Can hold duplicates – same value may appear multiple times.
- Can hold any type of data – integers, strings, other lists, etc.
- Example in Python:
my_list = [1, 2, 3, 4, 5] empty_list = []
I see you’ve shared two pages from a computer science book (ICS Part-I, Vintage Computer Science, pages 149–150).
These pages are explaining list operations, applications of lists, stacks, and queues in Python. Let me give you a clear summary:
Q.6: What is List Operation? Explain with an example.
- A list operation is any action performed on a list to add, remove, modify, or retrieve elements.
- Examples of operations:
- Appending Elements
my_list = [10, 20, 30] my_list.append(40) print(my_list) # [10, 20, 30, 40]
- Removing Elements
my_list.remove(20) print(my_list) # [10, 30, 40]
- Popping Elements (by index)
item = my_list.pop(1) print(item) # 30 print(my_list) # [10, 40]
- Searching in a List
my_list = [1, 2, 3, 4, 5] print(3 in my_list) # True print(my_list.index(3)) # 2
Q.7: Applications of List
Lists are versatile and useful in many areas:
- Data Storage and Management – store multiple items like names, scores, tasks.
- Implementing Other Data Structures – build stacks, queues, linked lists, graphs, trees.
- Searching and Sorting – used in algorithms like linear search, binary search, bubble sort, merge sort.
Q.8: Define Stacks
- A stack is a linear data structure that follows LIFO (Last In, First Out).
- Example: like plates stacked on top of each other.
Q.9: Write a short note on stack operations
Basic Stack Operations:
- Push – Add element to top.
stack.append(10)
- Pop – Remove and return top element.
element = stack.pop()
- Is Empty – Check if stack has no elements.
is_empty = len(stack) == 0