0% found this document useful (0 votes)
17 views

Computer and Programming Concepts

Uploaded by

bunajohn08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Computer and Programming Concepts

Uploaded by

bunajohn08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Computer and

Programming Concepts

September 24, 2024


Overview of Computer
Hardware and Software
What is a COMPUTER?
• It is an electronic device that processes data according to a
set of instructions (programs).
• It performs tasks like calculation , data storage, and
information retrieval, making it capable of solving complex
problems or automating processes.
• Computers consist of two main components:
• Hardware
• Software
Hardware
• Hardware refers to the physical components of a computer
system that you can touch and see.
• It works alongside software to perform various tasks and
operations.
• The main hardware components are the processor (CPU),
memory (RAM), storage devices (hard drive or SSD), input
devices (keyboard, mouse), and output devices (monitor,
printer).
Hardware Components
Central Processing Unit (CPU)
• Often called the brain of the computer, the CPU executes
instruction from programs and performs calculations.
• CPUs are measured in terms of speed (gigahertz (GHz)) and
cores (the number of processing units within a CPU).
• Modern CPUs often have multiple cores to allow for
multitasking.
Examples: Intel Core, AMD Ryzen
Hardware Components
Memory (RAM – Random Access Memory)
• RAM is temporary storage that the CPU uses to store and
access data quickly while performing tasks.
• It stores data that is actively being used or processes by the
system. Once the power is off, data in RAM is lost.
• The more RAM a computer has, the better it can handle
multiple tasks at once.
• Recommended RAM for basic computing (web browsing,
office work, and media consumption is at least 8GB of RAM.
Hardware Components
Storage Devices
• Computers have long-term storage to hold data permanently,
even when the power is off.
• Hard Disk Drive (HDD) uses spinning disks to store data
magnetically. It is less expensive but slower compared to newer
technologies.
• Solid-State Drive (SSD) is faster and more reliable because it
uses flash memory with no moving parts. It is commonly used in
modern computers.
• Hybrid Drives which combines the large storage capacity of
HDDs with the speed of SSDs.
Hardware Components
Input Devices
• Devices like keyboard, mouse, trackpad, touchscreen, and
scanner allow users to input data and interact with the
computer.
• Specialized input devices can include drawing tablets or voice
recognition systems.
Hardware Components
Output Devices
• Monitors (displays), printers, and speaker are common output
devices.
• They convert the computer’s processed data into a form that user
can see, hear, or feel.
• Monitors come in various sizes and resolutions, with modern
displays often using technologies like LCD (Liquid Crystal
Display), LED (Light Emitting Diode), OLED (Organic Light
Emitting Diode) for sharp image quality.
Software
• It is a collection of instructions or programs that tell a computer how to
perform specific tasks.
• Unlike hardware, which is the physical component of a computer,
software is intangible and consists of code that executes processes to
manage and manipulate hardware.
• Software allows users to interact with a computer, perform
calculations, process data or run applications.
• It bridges the gap between the user and the hardware, allowing
computers to perform useful functions.
• Software is broadly classified into two main categories:
• Application Software
• System Software
Software
Application Software
• It is designed to perform specific tasks or provide entertainment.
• This type of software is installed by user according to their needs and
runs on top of the system software.
• Productivity Software, Multimedia Software, Web Browsers,
Communications Software, Gaming Software, and Business
Software.
Software
System Software
• It is the core software that manages and operates computer hardware.
• It provides a platform for application software to run and ensures that
the hardware and software work together efficiently.
• Operating System (OS) is the primary piece of system software that
manages all other software and hardware on a computer.
• It controls the basic functions like memory management, file systems,
hardware communication, and task scheduling.
• Examples are Windows, macOS, Linux.
Windows
• Windows (developed by the software company Microsoft) is a paid
operating system but can run on many types of machines.
• Microsoft does also make some hardware, but they focus on software
development.
• They design and adapt the software to run on many different kinds of
machines – everything from laptops to tablets to cash registers to
ATMs to voting machines.
• Windows is the world’s most commonly used OS because it can reliably
run on so many different kinds of hardware.
macOS
• macOS is free to use but only runs on Mac computers.
• Apple (which makes macOS for desktops/laptops and iOS for mobile
devices) is a hardware company.
• It doesn’t sell macOS because it’s free to download.
• However, Apple does sell MacBooks, iPhones, iMacs, and iPads.
• The company makes it money selling this hardware, not the software.
• Because the operating system software doesn’t make Apple any
money, Apple works very hard to make sure its software can only run
on its hardware.
• So you have to pay for the hardware to use the software.
macOS
• Because Apple’s software only runs on its devices, Apple has a
complete control of absolutely every aspect of its computers.
• Apple makes the CPUs, the computers, and the OS – basically,
everything but the screen and the RAM.
• You may hear people in the industry say Apple is very vertically
integrated.
• Vertical integration refers to this type of complete control that
companies like Apple can have over every aspect of their products.
LINUX
• Linux is a free, open-source system, meaning that anyone can see all of
the underlying code and change and modify it however they want to.
• The huge difference between Linux and Windows or macOS/iOS is that
there isn’t a company trying to profit off of it; it’s made by coders all
over the world.
• Here are some common devices that use Linux: Chromebooks run on
Chrome OS, which is a Linux distribution, Android devices also run
Linux, Smart TVs, Printers, Cars such as Tesla, Ford, Jaguar Land
Rover, Nissan, Toyota, and more.
LINUX
• A typical laptop or desktop user might choose to load Linux as their
operating system if they are looking to save money or want more
flexibility in choice of software than a Windows or Mac device gives.
• Linux offers a variety of distribution of its OS that vary in how much
user knowledge and interaction are required to work with them.
• Essentially, if you want to have the freedom to poke around and
modify your operating system, Linux may be the way to go.
• As we can see, input, output, storage, and processing work together to
perform the functions we expect of modern computing devices.
• This is the way computers process information.
PROGRAM LOGIC
FORMULATION
PROGRAM LOGIC FORMULATION
• Program Logic Formulation is the process of designing and structuring the
logic of a computer program to solve a specific problem.
• It involves breaking down the problem into smaller, manageable components
and devising a series of logical steps (instructions) that guide the program
from start to finish.
• This process ensures that the program achieves the desired outcomes
efficiently and accurately.
• Effective program formation is crucial for writing correct, maintainable, and
optimized software.
• It involves clear thinking, a good understanding of algorithms, and the ability
to express solutions in a structured manner.
Key Elements of Program Logic Formulation
1. Problem Definition
2. Algorithm Design
3. Flowcharting
4. Pseudocode Writing
5. Testing and Debugging
Key Elements of Program Logic Formulation
Problem Definition
• The first step in program logic formulation is understanding and defining the
problem. It involves:
• Clarifying the requirements: What is the program supposed to
accomplish? What inputs will be provided? What outputs are expected?
• Identifying constraints: What limitation exist in terms of time, memory,
or other resources?
• Outlining Objectives: What is the best possible solution? Should the
solution prioritize speed, accuracy, or efficiency?
• A well-defined problem statement helps avoid ambiguities and ensures the
logic is tailored to the specific problem.
Key Elements of Program Logic Formulation
Algorithm Design
• An algorithm is a step-by-step procedure or set of rules for solving a problem.
• In program logic formulation, designing the algorithm is crucial because it serves as
the blueprint for the program’s logic. Key characteristics of a good algorithm
include:
• Input: The algorithm takes inputs (if required).
• Output: The algorithm produces outputs that solve the problem.
• Definiteness: Each step of the algorithm should be clear and unambiguous.
• Effectiveness: The steps must be feasible and executable with the available
resources.
• Fitness: The algorithm should have a clear end, terminating after a finite
number of steps.
Key Elements of Program Logic Formulation
Algorithm Design
Example of an Algorithm
Let’s say we want to design an algorithm to find the largest number in a list.
1. Start.
2. Assume the first number is the largest.
3. Compare this number with the next number in the list.
4. If the next number is larger, update the largest number.
5. Repeat steps 3 and 4 until all numbers are checked.
6. Output the largest number.
7. End.
Key Elements of Program Logic Formulation
Flowcharting
• A flowchart is a graphical representation of the logical steps in a program or
process.
• It uses standard symbols to represent different types of actions or decisions,
making it easy to visualize the flow of program’s logic.
• Flowcharts are useful for identifying the structure of the logic, potential
errors, and the overall flow before actually coding.
BASIC SYMBOLS USED IN FLOWCHART

Termina Process Decision


Input/Output
l

Arrows/Flow Connector
Lines
TERMINAL SYMBOL
• Indicates the starting or ending of the program.
• A flowchart can ONLY have ONE STARTING POINT, but it may have MANY
possible STOPPING POINTS.
INPUT / OUTPUT SYMBOL
• This parallelogram is used for INPUT and OUTPUT instructions.
• Input means to enter data into a computer or to use the computer to read
available data from storage drives.
• Output means to display the result of compilation or condition of the given
solution.
PROCESS SYMBOL
• This rectangle is used for any data processing operations for which
requirements of the problem are usually done here.
• Indicates any type of internal operations like initialization, calculations, etc.
DECISION SYMBOL
• This diamond-shaped symbol contains a condition.
• Used for asking questions that can have either TRUE (Yes) or FALSE (No) as
an answer.
CONNECTOR SYMBOL
• It is used as continuation symbol of a flowchart in the page.
• It is also used to indicate the point of entry and point of exit of repetition.
ARROWS / FLOW LINES
• Arrows are used to direct the flow of the flowchart.
• It shows the flow of the solution.
FLOWCHART DEVELOPMENT
• The step that comprise a flowchart must be organize in an orderly,
understandable and clear manner so that the program that implements
this flowchart is similarly in an orderly, understandable, and clear manner.
• It is called Structured Flowchart.
• Structured flowcharts are designed using the three basic control structures:
1. Sequential
2. Selection
3. Repetition
SEQUENTAL STRUCTURE
• Steps are performed in a strictly sequential manner.
• Each step being executed exactly once.
• It is the simplest method of control.
• It is easy to develop and understand.
SELECTION STRUCTURE
• One of several alternative actions is selected and executed.
• It involves the use of decision based on the given condition.
• It uses decision block or the diamond shaped block.
• Alternative action will be represented by a processing block.
REPETITION STRUCTURE
• One or more steps performed repeatedly (looping).
FLOWCHART RULES
• Flowchart is generally drawn from top to bottom.
• All boxes of flowchart must be connected with arrow lines.
• All flowchart starts with a terminal or process symbol.
• Decision symbol have 2 exit points, one for Yes (True) and another
for No (False).
Key Elements of Program Logic Formulation
Pseudocode Writing
• Pseudocode is an informal human-readable way of describing the steps of a
program.
• It is used to outline a program’s logic before writing actual code.
• Pseudocode uses simple language and avoids specific syntax, making it accessible
for both programmers and non-programmers.
Benefits of Pseudocode:
• Simplicity: It focuses on the logic rather than the syntax of a specific programming
language.
• Clarity: It can be used to explain program logic to stakeholders who may not know
programming languages.
• Versatility: It can be easily converted to code in any programming language.
Key Elements of Program Logic Formulation
Pseudocode Writing
Example of Pseudocode:
• Here’s pseudocode for finding the largest number in a list:
Key Elements of Program Logic Formulation
Testing and Debugging
• Once the program logic is formulated and the code is written, it needs to be
tested and debugged.
• Testing ensures the program work as expected, while debugging involves
identifying and fixing errors in the logic or code.
• Unit Testing: Testing individual parts (function, modules) of the program to
ensure they work as intended.
• Integration Testing: Testing how different parts of the program work together.
• User Acceptance Testing (UAT): Ensuring the program meets the user’s
requirements.
Key Elements of Program Logic Formulation
Testing and Debugging
• Debugging involves using techniques like:
• Print statements: Adding statement to print out variable values and flow steps.
• Debugging tools: Using tools to step through code, check memory usage, and
identify logic flaws.
• Error logs: Reviewing logs generated during program execution to locate errors.
Important Concepts in Program Logic Formulation
• Sequential Logic: Steps are executed one after another in a defined
sequence.
• Conditional Logic: Certain steps are executed based on conditions (e.g.
if-else statements).
• Looping/Iteration: Repeating a set of steps multiple times (e.g. while loops,
for loops).
• Modular Design: Breaking the program into smaller, reusable units or
modules (function, procedures) that solve specific parts of the problem.
• Recursion: A method where a function calls itself to solve a problem in a
smaller scope, often used for problems that can be divided into
sub-problems.
Techniques for Improving Program Logic
1. Top-Down Design (Stepwise Refinement)
• Break the problem into smaller parts, solve each part independently, and then
combine them to form the overall solution.
• Start with high-level solution and gradually refine it into more detailed steps.
2. Dry Run
• Manually simulate the execution of the logic by stepping through the code or
pseudocode and tracking variable on paper.
• Helps identify errors early before testing.
3. Optimization
• After formulating the initial logic, revisit program to optimize it for efficiency
(speed, memory usage).
• Consider simplifying loops, reducing redundant operations, or improving
algorithmic complexity.
Algorithm that shows the
printing of the SUM
Overview of
Programming and
Software Development
What is Programming?
• Programming involves creating a set of instructions for a
computer to follow in order to perform tasks or solve
problems.
• It is used to automate processes, solve complex problems,
and create software applications.
Software Development Life Cycle (SDLC)
Phases of SDLC
• Requirement Analysis : Identifying what needs to be built.
• Design : Planning how the solution will be structured.
• Implementation : Writing the actual code.
• Testing : Ensuring the code works as expected.
• Deployment : Releasing the software for use.
• Maintenance : Updating and fixing the software as needed.
Introduction to C Language
• Developed in the early 1970s by Dennis Ritchie at Bell labs.
Features:
• Low-Level Access : Allows direct interaction with memory
and hardware.
• Portability : Can be compiled on various platforms.
• Efficiency : Provides high performance and fine control over
system resources.
Why Learn C?
• C serves as the basis for many other languages such as C++,
Java, etc.
• In terms of performance C is efficient and powerful, suitable
for systems programming.
• It is used in a wide range of applications from system
software to game development.
Introduction to the Programming
Environment
• Dev-C++ is an integrated development environment (IDE)
primarily used for C and C++ programming.
• It includes the MinGW (Minimalist GNU for Windows)
compiler, which allows developers to compile and run C/C++
code in Windows environment.
• It can be suitable option due to its simplicity and ease of use.
Writing and Running C Programs
Hello World Program

• #include <stdio.h>: Includes the standard library for input and output functions.
• int main(): The main function where the program execution begins.
• printf(“Hello, World!\n”);: Outputs the string “Hello, World!” to the console.
• return 0;: Indicates successful completion of the program.
Debugging Common Issues
Syntax Errors: Errors in the code such as missing semicolons
or incorrect syntax.
Logica Errors: Issues with the program logic or incorrect
results.
Runtime Errors: Errors that occur during execution, such as
division by zero.
Tips for Writing Good Code
Commenting: Use comments to describe code functionality.
Indentation: Ensure consistent indentation for readability.
Variable Names: Choose descriptive names for variables.
Supplementary
Material
RAM VS ROM
SECONDARY MEMORY
Thank you and
STAY SAFE!
Do you have any questions?

You might also like