0% found this document useful (0 votes)
14 views4 pages

Programming For Problem Solving (PPS) Assignment Solutions: 1. Draw The Memory Hierarchy Representation

The document provides an overview of key concepts in programming and computer architecture, including memory hierarchy, the definition and importance of syntax, header files, and the distinction between algorithms and pseudocode. It also explains digital computer architecture, the functions and types of operating systems, and differentiates between various programming languages and tools. Additionally, it covers data types and storage classes in C programming.

Uploaded by

khaniqra1006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

Programming For Problem Solving (PPS) Assignment Solutions: 1. Draw The Memory Hierarchy Representation

The document provides an overview of key concepts in programming and computer architecture, including memory hierarchy, the definition and importance of syntax, header files, and the distinction between algorithms and pseudocode. It also explains digital computer architecture, the functions and types of operating systems, and differentiates between various programming languages and tools. Additionally, it covers data types and storage classes in C programming.

Uploaded by

khaniqra1006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Programming for Problem Solving (PPS) Assignment Solutions

1. Draw the memory hierarchy representation.

Memory hierarchy is structured as follows:


1. Registers (Fastest, smallest, inside CPU)
2. Cache Memory (Small but fast, stores frequently used data)
3. Main Memory (RAM - Volatile, stores running programs)
4. Secondary Storage (HDD, SSD - Non-volatile, large storage)
5. Tertiary Storage (Optical Disks, Magnetic Tapes - Backup storage)

2. Why is RAM called volatile memory?

RAM is called volatile memory because its contents are lost when the power is turned off. It requires
continuous power to retain stored data.

3. Define syntax. Write the importance of syntax in programming.

Syntax refers to the set of rules that define the structure of a programming language.
Importance:
- Ensures proper communication between programmer and computer.
- Helps avoid errors and improve code readability.
- Essential for compilation and execution.

4. What are header files? Why are they important?

Header files in C/C++ contain function declarations and macro definitions.


Importance:
- Allow code reusability.
- Provide standard libraries (e.g., stdio.h, math.h).
- Improve code organization.

5. Differentiate between algorithm and pseudo code.

Algorithm: A step-by-step procedure for solving a problem.


Pseudocode: A high-level description of an algorithm using a mix of natural language and
programming logic.
Algorithms are more structured, whereas pseudocode is informal and easier to understand.
6. Define:

i) Syntax Error: Errors due to incorrect use of programming language rules.


ii) Logical Error: Errors that cause incorrect output without breaking program execution.
iii) Runtime Error: Errors that occur during program execution, e.g., division by zero.

1. Explain digital computer with proper architecture.

A digital computer is an electronic device that processes data using binary (0s and 1s).
Architecture:
- Input Unit: Takes input from the user.
- CPU (Control Unit + ALU): Processes data.
- Memory Unit: Stores data and instructions.
- Output Unit: Displays results.
- Storage: Hard drives, SSDs for permanent data storage.

2. Discuss the functions and types of an Operating System in brief.

Functions of OS:
- Process Management
- Memory Management
- File System Management
- Device Management
- Security and User Interface

Types:
- Batch OS
- Multi-tasking OS
- Real-time OS
- Distributed OS

3. Define Algorithm with its characteristics. Write the algorithm for greatest of three numbers

and draw its flowchart.

An algorithm is a step-by-step procedure to solve a problem.


Characteristics:
- Input and Output
- Definiteness
- Finiteness
- Effectiveness

Algorithm:
1. Start
2. Read three numbers A, B, C
3. If A > B and A > C, print A is greatest
4. Else if B > C, print B is greatest
5. Else print C is greatest
6. End

4. Differentiate:

i) High-level vs. Low-level languages:


- High-level: Easy to read (e.g., Python, C++)
- Low-level: Machine code (Assembly, Binary)

ii) Compiler vs. Interpreter vs. Assembler:


- Compiler: Translates whole code before execution
- Interpreter: Executes line by line
- Assembler: Converts assembly language to machine code

iii) Algorithm vs. Program:


- Algorithm: Logical steps
- Program: Implementation in a language

5. Explain:

i) Primary Data Types: int, float, char, double


ii) Derived Data Types: Arrays, Pointers, Structures
iii) User-defined Data Types: Enum, Struct, Typedef

6. Explain Storage Classes used in C programming.

Storage classes define scope, lifetime, and visibility of variables in C:


- Auto: Default for local variables
- Static: Retains value between function calls
- Extern: Used for global variables
- Register: Stores variables in CPU registers for fast access

You might also like