Q17) List and explain different components of Computer
System.
1. Input Devices:
• Function: Allow users to enter data and
instructions into the computer.
• Examples: Keyboard, mouse, touchpad,
scanner, microphone, webcam,
2. Output Devices:
• Function: Present information and results to
the user.
• Examples: Monitor, printer, speakers,
headphones, projector.
3. Central Processing Unit (CPU):
• Function: The "brain" of the computer, responsible
for processing data and instructions.
• Components:
o Arithmetic Logic Unit (ALU): Performs
arithmetic and logical operations.
o Control Unit (CU): Fetches, decodes, and
executes instructions.
4. Motherboard:
• Function: The main circuit board that connects all
components of the computer.
• Key components: CPU socket, RAM slots, expansion
slots, storage connectors, ports for peripherals.
5. Memory:
• Function: Stores data and instructions temporarily or
permanently.
• Types:
o Random Access Memory (RAM): Temporary
storage for active programs and data.
o Read-Only Memory (ROM): Permanent storage
for essential instructions.
o Storage Devices: Long-term storage for files and
programs (e.g., hard drives, solid-state drives,
external drives).
6. Power Supply Unit (PSU):
• Function: Converts AC power from the outlet to DC
power that the computer components need.
7. Expansion Cards:
• Function: Add additional functionality to the computer
(e.g., graphics cards, sound cards, network adapters).
7. Communication Devices:
• Function: Enable the computer to connect to other
devices and networks.
• Examples: Modems, network cards, wireless
adapters.
8. Software:
• Function: Instructs the hardware on how to
operate and perform tasks.
• Types:
o Operating System (OS): Manages the
computer's resources and provides a user
interface.
o Application Software: Programs that perform
specific tasks, such as word processing, web
browsing, or gaming.
10. Firmware:
• Function: Permanent software embedded in
hardware components, providing low-level control
and instructions.
• Examples: BIOS, UEFI.
Q18) What is a function prototype?
• It's a declaration of a function that specifies its
name, return type, and parameters.
• It acts as a blueprint for the function, informing
the compiler about its interface before the actual
function definition is encountered.
• It doesn't contain the function's body (code).
Syntax:
C Language:
returnType functionName(parameterType1 parameter1,
parameterType2 parameter2, ...);
Example:
C Language:
// Function prototype
int addNumbers(int a, int b); // Declares a function named
addNumbers that takes two integers and returns an integer
int main() {
int result = addNumbers(5, 3); // Calls the addNumbers
function
printf("Sum: %d", result);
return 0;
}
// Function definition (with body)
int addNumbers(int a, int b) {
return a + b; // Actual implementation of the function
}
Importance of Function Prototypes:
1. Type Checking: The compiler uses prototypes to
ensure correct data types are used in function calls,
preventing potential errors.
2. Separate Compilation: Prototypes allow functions to
be defined in separate files and compiled
independently, promoting modularity and code
organization.
3. Self-Documentation: Prototypes serve as concise
documentation, making code more readable and
understandable.
4. Function Overloading: Prototypes enable multiple
functions with the same name but different parameter
lists, enhancing code flexibility.
Key Points:
• Place prototypes before using a function in your code,
typically in header files.
• Parameter names in prototypes are optional, but
providing them improves readability.
• Prototypes are not mandatory for functions defined
before their use, but they are strongly recommended
for code clarity and maintainability.