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

Notes.docx

The document outlines the problem-solving process, including defining, analyzing, and planning solutions, as well as selecting the best solution. It also defines algorithms and flowcharts, detailing their components and importance in programming. Additionally, it covers programming languages, including syntax and semantics, and provides insights into data types, variable declaration, and input/output functions in C programming.

Uploaded by

anzeeshayahya80
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)
4 views

Notes.docx

The document outlines the problem-solving process, including defining, analyzing, and planning solutions, as well as selecting the best solution. It also defines algorithms and flowcharts, detailing their components and importance in programming. Additionally, it covers programming languages, including syntax and semantics, and provides insights into data types, variable declaration, and input/output functions in C programming.

Uploaded by

anzeeshayahya80
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/ 38

Algorithm and Flowchart

7.1 Understanding the Problem


7.1.1 describe the following steps of problem solving process:
Steps of the Problem-Solving Process
a. Define the Problem
●​ Description: Clearly identify and understand the problem by stating what needs to be
solved. This involves recognizing the root cause rather than just the symptoms.
●​ Purpose: To ensure a shared understanding of the issue among all stakeholders and to
avoid working on incorrect or incomplete problems.
●​ Example: If a car won't start, defining the problem could be: "The engine does not
turn over when the ignition key is turned."
b. Analyze the Problem
●​ Description: Break down the problem into smaller, manageable parts to understand
its components and contributing factors. This includes gathering data, identifying
constraints, and determining the impact of the problem.
●​ Purpose: To understand the scope of the issue and what factors influence it.
●​ Example: For the car problem, check the battery, fuel level, and ignition system to
pinpoint possible causes.
c. Plan the Solution of the Problem
●​ Description: Develop a structured approach to solving the problem. This involves
outlining the steps or methods to resolve the issue effectively. The plan may include
algorithms, flowcharts, or a list of sequential tasks.
●​ Purpose: To create a clear roadmap for problem resolution.
●​ Example: Plan to first check the battery's voltage, then test the starter motor, and
finally examine the ignition switch.
d. Find Candidate Solutions to the Problem
●​ Description: Brainstorm and generate multiple possible solutions to the problem.
Evaluate each option based on feasibility, cost, time, and available resources.
●​ Purpose: To consider diverse approaches, which increases the likelihood of finding a
successful resolution.
●​ Example: For the car problem, potential solutions might include charging the battery,
replacing the starter motor, or jump-starting the vehicle.
e. Select the Best Solution
●​ Description: Compare the candidate solutions based on defined criteria, such as
effectiveness, efficiency, cost, and ease of implementation. Choose the option that
best meets the requirements.
●​ Purpose: To ensure the selected solution is optimal and practical.
●​ Example: If the battery is dead, replacing or jump-starting the battery might be the
best solution based on ease and cost.

7.2 Algorithm
7.2.1 define an algorithm
Define an Algorithm
An algorithm is a step-by-step sequence of instructions designed to perform a specific task
or solve a problem. It provides a clear and systematic approach that can be implemented
using a programming language or manually.

7.2.2 describe the following four essential parts of an algorithm:


a. inputs
b. processing
c. decision
d. outputs
Essential Parts of an Algorithm
1.​ Inputs:
o​ Definition: Data provided to the algorithm to work with. Inputs are the
starting point for processing.
o​ Example: Numbers to calculate the sum.
2.​ Processing:
o​ Definition: The operations or steps performed on the inputs to transform them
into meaningful outputs.
o​ Example: Adding two numbers, sorting a list, or performing a calculation.
3.​ Decision:
o​ Definition: Logical conditions or comparisons used to make choices within
the algorithm. Decisions guide the algorithm's flow.
o​ Example: If a number is greater than another, proceed with specific steps.
4.​ Outputs:
o​ Definition: The results or final outcomes produced by the algorithm after
processing the inputs.
o​ Example: Displaying the sum of two numbers or the sorted list.
7.3 Flowchart
7.3.1 define a program flowchart
Define a Program Flowchart
A program flowchart is a graphical representation of the logical sequence of steps in a
process or algorithm. It uses standard symbols to depict operations, decisions, and the flow of
control, making it easier to understand and communicate the process.

7.3.2 describe the importance of a program flowchart for solving a problem


Importance of a Program Flowchart for Solving a Problem
1.​ Clarity: Provides a clear and visual representation of the steps involved in solving a
problem.
2.​ Debugging Aid: Makes it easier to identify logical errors or inefficiencies in a
process.
3.​ Communication Tool: Helps explain the logic to others, such as team members or
stakeholders.
4.​ Organized Thinking: Encourages structured thinking and breaks down complex
problems into manageable steps.
5.​ Documentation: Acts as a reference for program maintenance or updates.

7.3.3 identify the flowchart symbols for the following:


a. input
b. process
c. decision making
d. outputs
e. terminator/ terminal point
f. connectors
Flowchart Symbols

Flow Chart Shapes


Geometrical Name Purpose
Symbol Name

Input Parallelogram Represents input data.

Denotes a step or action to be


Process Rectangle
performed.

Represents a decision point,


Decision Making Diamond
such as "Yes" or "No".

Output Parallelogram Represents output data.

Marks the start or end of a


Terminator/Terminal Oval
process.

Indicates a jump to another


On Page Connector Circle part of the flowchart on the
same page.

It allows the flow to continue


Off Page Connector Pentagon
on a different page.

7.3.5 complete the trace table for a given flowchart.


Complete the Trace Table for a Given Flowchart
Example Trace Table:​
For a flowchart that calculates the sum of numbers from 1 to n, trace the variable changes:

Step Count Sum Condition Action

Start - 0 - Initialize Sum = 0

1 1 1 Count ≤ n Add Count to Sum


Step Count Sum Condition Action

2 2 3 Count ≤ n Add Count to Sum

3 3 6 Count ≤ n Add Count to Sum

End - - Condition False Terminate


Programming in C Language
8.1 Introduction to Programming Languages
8.1.1 define a computer program
Define a Computer Program
A computer program is a set of instructions written in a specific programming language to
perform a particular task or solve a problem. It is executed by a computer's processor to
manipulate data and produce desired outputs.

8.1.2 differentiate between program syntax and program semantic


Differentiate Between Program Syntax and Program Semantics
●​ Syntax: Refers to the set of rules and structure for writing valid code in a
programming language. It ensures that code is correctly formatted and understandable
by the compiler or interpreter.
o​ Example: A missing semicolon in C++ is a syntax error.
●​ Semantics: Refers to the meaning of the code or what the program is intended to do.
Even if the syntax is correct, a program can have semantic errors if it produces
unintended results.
o​ Example: Writing a loop that runs infinitely is a semantic issue.

8.1.3 differentiate among the following levels of programming languages:


a. low level languages
Machine Language:
●​ Consists of binary code (0s and 1s) that the computer's hardware directly understands.
●​ Difficult for humans to read and write.
●​ Example: 10101010 11001100
Assembly Language:
●​ Uses symbolic representations (mnemonics) for machine code instructions.
●​ Easier to read than machine language but still hardware-dependent.
●​ Example: MOV AX, BX
b. high level languages
Procedural Language:
●​ Focuses on procedures or routines to perform tasks.
●​ Code is written as a series of instructions executed in order.
●​ Example: C, Fortran.
Structured Language:
●​ A subset of procedural languages emphasizing modular design, control structures
(loops, conditionals), and clarity.
●​ Example: Pascal, structured C.

Object-Oriented Language (OOP):


o​ Based on the concept of objects, which encapsulate data and methods.
o​ Promotes code reusability and modularity.
o​ Example: Java, Python.
8.1.4 discuss the characteristics of a high level language
Characteristics of High-Level Languages
●​ Human-Readable Syntax: Uses natural language elements, making it easier to learn
and write.
●​ Portability: Can be executed on different platforms with minimal changes.
●​ Abstraction: Hides hardware complexities from the programmer.
●​ Extensive Libraries: Offers pre-written code for common tasks.
●​ Error Checking: Provides built-in tools for debugging and error handling.
8.1.5 differentiate among assembler, compiler and an interpreter.
Differentiation Among Assembler, Compiler, and Interpreter

Feature Assembler Compiler Interpreter

Converts assembly Converts high-level code Converts high-level code


Definition code into machine into machine code all at into machine code
code. once. line-by-line.

Input
Assembly language High-level language High-level language
Language
Feature Assembler Compiler Interpreter

Output Machine code Executable file Immediate execution

Fast translation, but Slower execution as


Translation is slow;
Speed assembly code writing translation happens
execution is fast.
is slow. simultaneously.

Example Python Interpreter,


NASM, MASM GCC, Turbo C++
Tools JavaScript Engine

8.3 Programming Basics


8.3.1 define header files
Define Header Files
Header files in C are files with a .h extension that contain declarations of functions, macros,
and variables. They are included in a program using preprocessor directives (#include) to
enable code reuse and improve organization. Common examples include:
●​ #include <stdio.h>: Provides functions for input/output operations.
●​ #include <math.h>: Contains mathematical functions like sqrt and pow.
●​ #include <string.h>: Contains string manipulation functions.
8.3.2 describe the structure of a C program consisting of:
Structure of a C Program
a. Pre-processor Directives​
Pre-processor directives are instructions that the compiler processes before compiling the
code. They include:
#include: Adds the content of a specified header file to the program.
Example: #include <stdio.h> includes the standard input/output header.
b. Main Function (main())​
The main() function is the entry point of a C program. It contains the code that executes when
the program runs.
Syntax:

c. Body of main()​
The body is enclosed within curly braces { } and contains the program’s logic, including
variable declarations, function calls, loops, and other statements.
d. Global and Local Variables
●​ Global Variables: Declared outside all functions and accessible throughout the
program.
●​ Local Variables: Declared within a specific function or block and accessible only
within that scope.

8.3.3 describe the purpose of comments in a C program


Purpose of Comments in a C Program
Comments are non-executable statements used to explain code, making it easier to
understand and maintain.
Types of Comments:
1.​ Single-line comments: Begin with // and extend to the end of the line.
o​ Example: // This is a single-line comment
2.​ Multi-line comments: Enclosed within /* and */ and can span multiple lines.
o​ Example:

Purposes:
1.​ Enhance code readability.
2.​ Document complex logic for future reference.
3.​ Provide context for variable or function usage.
4.​ Temporarily disable code for debugging.
8.4 Constants and Variables Differentiate Between a Constant and a Variable in C
8.4.1 differentiate between a constant and a variable in C programming language

Aspect Constant Variable

A value that cannot be changed A storage location whose value can be


Definition
during program execution. altered during program execution.

Declared using the const keyword


Declaration Declared with a data type and a name.
or #define.

const float PI = 3.14; or #define


Example int age = 25;
MAX 100

8.4.2 list the rules for specifying variable names


Rules for Specifying Variable Names
1.​ Must start with a letter or an underscore (_).
2.​ Can contain letters, digits, and underscores but cannot include spaces or special
characters.
3.​ Cannot be a keyword or reserved word.
4.​ Variable names are case-sensitive.
5.​ Should be descriptive and meaningful.
Examples:
Valid: age, total_sum, _value1
Invalid: 1number, total-sum, float
8.4.3 define the following data types offered by C programming
language and the number of bytes taken by each data type:
a. integer data type
b. floating-point data type
c. character data type;
Data Types in C Programming

Data Type Description Size (Bytes) Example

Integer (int) Stores whole numbers 2 or 4 int number = 10;

Floating-point (float) Stores decimal values 4 float pi = 3.14;

Character (char) Stores a single character 1 char letter = 'A';


8.4.4 write the C language code to declare and initialise variables and constant
qualifiers having data types mentioned in SLO 8.4.3
Declare and Initialize Variables and Constants
Code Example:

8.4.5 write a C program to perform implicit and explicit typecasting.


Program to Perform Implicit and Explicit Typecasting
Implicit Typecasting: The compiler automatically converts one data type to another.​
Explicit Typecasting: The programmer manually converts a data type using the cast operator
(type).
Code Example:
Output:

Fundamentals of Input and Output Handling in C Programming

9.1 Input and Output Functions in C Programming


9.1.1 apply output functions putchar( ), puts( ) and printf( ) to display the output
1. putchar()
The putchar() function is used to output a single character to the screen.
●​ Syntax:

Parameters:​
It takes one argument, which is the character you want to print (the argument is usually
passed as an integer, which is the ASCII value of the character).
Return Value:​
It returns the character that was printed as an unsigned char cast to an int.
Example:

2. puts()
The puts() function is used to print a string (a sequence of characters) to the screen, followed
by a newline character (\n).
●​ Syntax:

Parameters:​
It takes a single argument: a pointer to a null-terminated string (a string ending with '\0').
Return Value:​
It returns a non-negative number if the string is successfully printed
Example:

3. printf()
The printf() function is a more versatile function used for formatted output. You can print a
combination of strings, characters, integers, floating-point numbers, and more, by specifying
format specifiers.
Syntax:

Parameters:​
The first argument is a format string that may contain format specifiers, which are
placeholders for variables that are printed. The remaining arguments are the values to be
printed.
Return Value:​
It returns the number of characters printed, or a negative number if an error occurs.
Example:

Key Differences:
●​ putchar(): Used for printing a single character.
●​ puts(): Used for printing a string with a newline.
●​ printf(): Used for formatted output, allowing you to print different types of data with
specific formats.
9.1.2 write a C program containing the following data types and format specifiers:
a. decimal
b. integer
c. float (decimal notation)
d. float (exponential notation)
e. char
f. long int
g. string

Using Data Types and Format Specifiers

9.1.3 write a C program that uses input functions scanf( ), getch( ), getche( ), getchar( )
and gets( ) function;
1.​ getch()
●​ Purpose: Reads a single character from the keyboard without displaying it on the
screen (no echo).
●​ Header File: <conio.h> (may not be available on all systems).
●​ Usage: char ch = getch();
●​ Example:
●​ Key Notes:
o​ Useful in scenarios where you need hidden input (e.g., passwords).
o​ Does not require pressing Enter to complete input.
2.​ getche()
●​ Purpose: Reads a single character from the keyboard and displays it on the screen
(echoes input).
●​ Header File: <conio.h> (may not be available on all systems).
●​ Usage: char ch = getche();
●​ Example:

Key Notes:
●​ Similar to getch(), but shows the character on the screen.
●​ Input does not require pressing Enter.

3.​ getchar()
●​ Purpose: Reads a single character from the standard input and returns it.
●​ Usage: char ch = getchar();
●​ Example:
●​ Key Notes:
o​ Input is displayed on the screen.
o​ Requires pressing Enter to complete input.
gets()
●​ Purpose: Reads a string (including spaces) from the standard input.
●​ Usage: gets(string);
●​ Example:

Key Notes:
●​ Reads a line of text until a newline (\n) is encountered.

9.1.4 define an escape sequence

Escape
Name Description
Sequence

\a Alarm or Beep It is used to generate a bell sound in the C program.

\b Backspace It is used to move the cursor one place backward.

\n New Line It moves the cursor to the start of the next line.

\r Carriage Return It moves the cursor to the start of the current line.

It inserts some whitespace to the left of the cursor and moves the
\t Horizontal Tab
cursor accordingly.

\\ Backlash Use to insert backslash character.

\’ Single Quote It is used to display a single quotation mark.

\” Double Quote It is used to display double quotation marks.


\? Question Mark It is used to display a question mark.

9.1.5 write a C program using the following escape sequences:

9.2 Operators in C Language


9.2.1 write a C program involving use of arithmetic operators, e.g. addition, subtraction,
multiplication, division and remainder
#include <stdio.h>

int main() {
int a = 10, b = 5;
int sum, diff, prod, quotient, remainder;

// Arithmetic Operations
sum = a + b;
diff = a - b;
prod = a * b;
quotient = a / b;
remainder = a % b;

// Display Results
printf("Sum: %d\n", sum);
printf("Difference: %d\n", diff);
printf("Product: %d\n", prod);
printf("Quotient: %d\n", quotient);
printf("Remainder: %d\n", remainder);

return 0;
}
9.2.2 convert given arithmetic expression into C language code
Given Arithmetic Expression:
( (a + b) * (c - d) ) / e

9.2.3 use the arithmetic operators of C language to solve an arithmetic problem


Problem:​
Calculate the total cost total = (unit_price * quantity) + tax, where:
●​ unit_price = 15
●​ quantity = 5
●​ tax = 2
9.2.4 use the following assignment operators in a C program:
a. assignment operator (=)
b. compound assignment operator (+ =, - =, * =, / =, % =)

#include <stdio.h>

int main() {
int a = 10, b = 20;

// Assignment Operator
a = b; // a gets the value of b
printf("a = %d\n", a);

// Compound Assignment Operators


a += b; // a = a + b
printf("a += b: %d\n", a);

a -= b; // a = a - b
printf("a -= b: %d\n", a);

a *= b; // a = a * b
printf("a *= b: %d\n", a);

a /= b; // a = a / b
printf("a /= b: %d\n", a);

a %= b; // a = a % b
printf("a %%= b: %d\n", a);

return 0;
}
9.2.5 use the increment (++) and decrement ( --) operators in a C program
#include <stdio.h>

int main() {
int a = 5;

// Increment operator
printf("a before increment: %d\n", a);
a++; // Post-increment
printf("a after increment: %d\n", a);

// Decrement operator
printf("a before decrement: %d\n", a);
a--; // Post-decrement
printf("a after decrement: %d\n", a);

return 0;
}
9.2.6 use the following relational operators in a C program:
a. less than (<)
b. greater than ( > )
c. less than or equal to (<=)
d. greater than or equal to ( >= )
e. equal to (= =)
f. not equal to (! =)

#include <stdio.h>

int main() {
int x = 10, y = 20;

printf("x < y: %d\n", x < y);


printf("x > y: %d\n", x > y);
printf("x <= y: %d\n", x <= y);
printf("x >= y: %d\n", x >= y);
printf("x == y: %d\n", x == y);
printf("x != y: %d\n", x != y);

return 0;
}
9.2.7 use the following logical operators in a C program:
a. AND (&&)
b. OR (||)
c. NOT (!)

#include <stdio.h>

int main() {
int a = 5, b = 10;

// AND operator
printf("a > 3 && b < 15: %d\n", a > 3 && b < 15);

// OR operator
printf("a > 3 || b > 15: %d\n", a > 3 || b > 15);

// NOT operator
printf("!(a > 3): %d\n", !(a > 3));

return 0;
}

9.2.8 differentiate between the assignment operator (=) and equal to operator (= =)
●​ Assignment Operator (=) is used to assign a value to a variable.
o​ Example: x = 5;
●​ Equal To Operator (==) is used to compare two values.
o​ Example: x == 5; (checks if x is equal to 5)

9.2.9 differentiate between the unary and binary operators


●​ Unary Operator: Operates on a single operand.
o​ Example: ++a, --a, !a
●​ Binary Operator: Operates on two operands.
o​ Example: a + b, a > b

9.2.10 use the conditional (ternary) operator in a C program


9.2.11 Apply the order of precedence of operators to evaluate an expression.
Operators in C have a specific order of precedence that determines the sequence in which
they are evaluated. For example:
●​ First: Parentheses ()
●​ Second: Unary operators (e.g., ++, --, !)
●​ Third: Multiplication, division, and modulo * / %
●​ Fourth: Addition and subtraction + -
●​ Fifth: Relational operators (<, >, <=, >=, ==, !=)
●​ Sixth: Logical operators (&&, ||)
Control Structure
10.1.1 define a control statement.
Define a Control Statement
A control statement is a programming construct that determines the flow of execution of
instructions in a program. It allows for decision-making, looping, or branching based on
specified conditions.
10.1.2 define a conditional statement.
Define a Conditional Statement
A conditional statement is a type of control statement used to execute a block of code only
when a specific condition is true. It enables decision-making in a program.
10.1.3 write the structure of if statement.
Structure of if Statement
10.1.4 write C programs for the problems mentioned in 7.2.3 involving the use of if
statement.

10.1.5 write the structure of if-else statement.


10.1.6 write C programs for the problems mentioned in 7.2.3 involving the use of if-else

statement.

10.1.7 write the structure of if-else-if statement.

10.1.8 write C programs for the problems mentioned in 7.2.3 involving the use of if-else
if statement.
10.1.9 write the structure of switch statement.

10.1.10 describe advantages and disadvantages of switch statement.


Advantages and Disadvantages of switch Statement

Advantages Disadvantages

Easy to read and understand for Limited to checking equality of constants (does not
multiple conditions. handle ranges or logical operators).

Faster than multiple if-else-if Difficult to modify or extend compared to if-else


statements for large cases. structures for complex conditions.

Organizes code for conditions Cannot handle complex expressions or evaluate


involving fixed values. runtime values directly.
10.1.11 write C programs for the problems mentioned in 7.2.3 involving the use of
switch statement.
#include <stdio.h>

int main() {
int choice;
printf("Choose an option (1-3): ");
scanf("%d", &choice);

switch (choice) {
case 1:
printf("You chose option 1.\n");
break;
case 2:
printf("You chose option 2.\n");
break;
case 3:
printf("You chose option 3.\n");
break;
default:
printf("Invalid option.\n");
}

return 0;
}
Computer Logic and Gates
12.1 Data Representation
12.1.1 show the binary data representation using binary pulses i.e. 0/low/ off and 1/
high/ on.
Binary Data Representation
●​ Computers represent data using binary pulses, which are sequences of 0s and 1s.
o​ 0 (Low/Off): Represents the absence of a signal or a low voltage state.
o​ 1 (High/On): Represents the presence of a signal or a high voltage state.
●​ Example:
o​ A binary sequence, such as 1010, represents alternating on and off states. This
is essential for data storage, processing, and transmission.

12.2 Logic Gates


12.2.1 define digital logic and logic gates
Define Digital Logic and Logic Gates
●​ Digital Logic: A branch of electronics that deals with circuits operating
on binary signals (0 and 1).
●​ Logic Gates: Fundamental building blocks of digital circuits that perform
basic logical operations on binary inputs.

12.2.2 differentiate between sequential and combinational logic circuits.

Sequential vs. Combinational Logic Circuits


Sequential Logic Circuits Combinational Logic Circuits
Output depends on current inputs and Output depends only on the current
past inputs (state). inputs.
Require memory elements (e.g.,
Do not require memory elements.
flip-flops).
Used in counters, registers, and finite Used in arithmetic circuits,
state machines. multiplexers, and decoders.

12.2.3 define a truth table.


Define Truth Table
●​ A truth table is a tabular representation that shows all possible input
combinations and their corresponding outputs for a logic circuit or gate.

12.2.4 explain the following logic gates in terms of number of inputs


and outputs using truth tables:
a. AND
b. OR
c. NOT
d. NAND
e. NOR
f. Exclusive OR (XOR)
g. Exclusive NOR (XNOR)
Logic Gates and Truth Tables
1.​ AND Gate
o​ Inputs: 2 or more
o​ Output: 1 if all inputs are 1; otherwise, 0.
o​ Truth Table:
A B Output (A AND B)
0 0 0
0 1 0
1 0 0
1 1 1
2.​ OR Gate
o​ Inputs: 2 or more
o​ Output: 1 if at least one input is 1; otherwise, 0.
o​ Truth Table:
A B Output (A OR B)
0 0 0
0 1 1
1 0 1
1 1 1
3.​ NOT Gate
o​ Inputs: 1
o​ Output: Inverts the input (0 becomes 1, and 1 becomes 0).
o​ Truth Table:
A Output (NOT A)
0 1
1 0
4.​ NAND Gate
o​ Inputs: 2 or more
o​ Output: Inverted result of AND gate.
o​ Truth Table:
A B Output (A NAND B)
0 0 1
0 1 1
A B Output (A NAND B)
1 0 1
1 1 0
5.​ NOR Gate
o​ Inputs: 2 or more
o​ Output: Inverted result of OR gate.
o​ Truth Table:
A B Output (A NOR B)
0 0 1
0 1 0
1 0 0
1 1 0
6.​ Exclusive OR (XOR) Gate
o​ Inputs: 2
o​ Output: 1 if inputs are different; otherwise, 0.
o​ Truth Table:
A B Output (A XOR B)
0 0 0
0 1 1
1 0 1
1 1 0
7.​ Exclusive NOR (XNOR) Gate
o​ Inputs: 2
o​ Output: 1 if inputs are the same; otherwise, 0.
o​ Truth Table:
A B Output (A XNOR B)
0 0 1
0 1 0
1 0 0
1 1

12.2.5 identify logic gates from the truth table.

Identify Logic Gates from Truth Table


●​ Analyze the input-output combinations in a truth table to deduce the type
of gate (e.g., if the output matches the AND gate, it is an AND gate).
12.2.6 construct truth table for logic circuits.
Construct Truth Table for Logic Circuits
●​ Combine the gates in the circuit step-by-step, calculating the output for
each stage based on inputs.

12.2.7 construct logic circuit to solve a given real life problem.


xample: A security system that requires two inputs (e.g., a password and a
fingerprint) to unlock a door can be represented by an AND gate.

12.3 Karnaugh Map (K-Map)

12.3.1 Simplify two-variable and three variable Boolean functions using


Karnaugh map.
Simplify Boolean Functions Using K-Map
1.​ Two-variable K-Map:
o​ Simplifies Boolean expressions with two variables.
o​ Example: For a truth table with inputs A and B and output X,
group adjacent 1s to minimize the expression.
2.​ Three-variable K-Map:
o​ Simplifies Boolean expressions with three variables.
o​ Example: For inputs A, B, and C with output X, group adjacent 1s
in a 3×2 K-map.

Computer Security and Ethics


14.3 Authentication Mechanisms
14.1 Introduction to Computer Security
14.1.1 explain the importance of computer security
Computer security is crucial to protect systems, data, andProtecting Sensitive Information:
Prevents unauthorized access to personal, financial, and business data.
●​ Maintaining System Integrity: Ensures that software, hardware, and networks
function correctly without interference.
●​ Preventing Financial Loss: Protects against theft or manipulation of funds through
secure systems.
●​ Ensuring Privacy: Safeguards users' confidential information from being accessed or
exploited.
●​ Mitigating Cyber Threats: Blocks malware, viruses, ransomware, and phishing
attacks.
●​ Building Trust: Assures users and organizations that their data and operations are
safe.
14.1.2 explain cybercrime, hacking and cracking
Cybercrime:​
Illegal activities performed using computers or networks, including stealing sensitive
information, spreading malware, or committing fraud. Examples include identity theft,
phishing, and ransomware attacks.
Hacking:​
The process of gaining unauthorized access to computers or networks, often to explore
vulnerabilities, retrieve information, or cause harm. Not all hacking is malicious.
Cracking:​
A specific form of hacking where the intent is explicitly malicious, such as breaking into
systems to steal data, damage systems, or bypass software protections.

14.1.3 differentiate among the types of hackers, i.e. script kiddie, white
hat hackers, black hat hackers, grey hat hacker, green hat, hackers, red hat hackers, blue hat
hackers
Differentiate Among Types of Hackers

Type of
Description Intent
Hacker

Inexperienced individuals who use Malicious or disruptive. Often


Script
pre-written scripts or tools to exploit without deep understanding of their
Kiddie
systems. actions.
Type of
Description Intent
Hacker

Ethical hackers who use their skills to


White Hat Beneficial. They help organizations
improve security by identifying
Hacker secure their systems.
vulnerabilities.

Malicious hackers who exploit Harmful. Their intent is to cause


Black Hat
vulnerabilities for personal or financial damage, steal data, or disrupt
Hacker
gain. operations.

Operates between ethical and unethical Neutral. They may report


Grey Hat
practices, often exploring systems without vulnerabilities or use the data for
Hacker
permission but not for harm. non-malicious purposes.

Varied. They can lean toward either


Green Hat Novice hackers eager to learn advanced
ethical or malicious actions as they
Hacker hacking techniques.
gain expertise.

Vigilante hackers who aggressively Aggressive but protective. Their


Red Hat
counter-attack black hat hackers, sometimes goal is to eliminate malicious
Hacker
causing harm to attackers. hackers.

External individuals hired by organizations


Blue Hat Beneficial. They act as testers to
to test system vulnerabilities before
Hacker strengthen security defenses.
deployment.

14.1.4 differentiate among the types of malware, i.e. virus, worm, adware, spyware, Trojan
horses

Type of
Description How It Spreads Effects/Intent
Malware

A malicious program that


Requires user action, Damages files, corrupts
attaches itself to legitimate
Virus such as opening an data, and slows down
files or programs and
infected file or program. system performance.
spreads when executed.

Self-replicating malware Exploits vulnerabilities Consumes bandwidth,


that spreads through in network protocols or overloads systems, and
Worm
networks without requiring software to spread can cause large-scale
user action. automatically. disruptions.

Adware Software designed to Bundled with legitimate Annoys users with ads,
display advertisements, software or installed tracks browsing activity,
Type of
Description How It Spreads Effects/Intent
Malware

often in a disruptive unintentionally by the and can redirect users to


manner. user. malicious websites.

Covert software that Installed through Steals sensitive


collects user data and malicious websites, information, such as
Spyware
transmits it to a third party phishing emails, or passwords, financial data,
without consent. bundled software. or browsing habits.

Malicious programs Users download and


Provides unauthorized
Trojan disguised as legitimate execute the program,
access, installs other
Horses software to trick users into believing it is harmless
malware, or steals data.
installing them. or useful.

14.3.1 differentiate between authentication and authorisation


Differentiate Between Authentication and Authorization

Aspect Authentication Authorization

The process of granting or denying access to


The process of verifying a
Definition resources based on the user's identity and
user's identity.
permissions.

Purpose To confirm "Who are you?" To confirm "What are you allowed to do?"

Logging into a system using a Accessing a restricted file or area based on


Example
username and password. assigned permissions.

Happens first in the security


Sequence Happens after authentication.
process.

Differentiate Between Two-Factor Authentication (2FA) and Multifactor Authentication


(MFA)

Aspect Authentication Authorization

The process of granting or denying access to


The process of verifying a
Definition resources based on the user's identity and
user's identity.
permissions.

Purpose To confirm "Who are you?" To confirm "What are you allowed to do?"

Logging into a system using a Accessing a restricted file or area based on


Example
username and password. assigned permissions.
Aspect Authentication Authorization

Happens first in the security


Sequence Happens after authentication.
process.

14.2 Computer Viruses 14.2.1 discuss the ways in which a malware can spread via:
a. infected flash drives/ CD’s
b. pirated software
c. local area network
d. internet
e. e-mail attachments
14.2.1 Ways Malware Can Spread

Method Description Example

Malware can be transferred when an Autorun malware on flash drives


a. Infected Flash
infected USB or CD is inserted into a or CDs that executes
Drives/CDs
computer system. automatically when inserted.

Malware is often embedded in cracked Keyloggers or ransomware


b. Pirated
or pirated software downloaded from bundled with illegal copies of
Software
untrusted sources. popular software.

Malware can spread across connected


c. Local Area Worms or Trojans moving
systems in a LAN via shared drives or
Network (LAN) through shared folders.
file-sharing protocols.

Malware can be downloaded from Drive-by downloads or browser


d. Internet malicious websites, pop-ups, or hijackers from visiting
deceptive links. compromised websites.

Malware can be embedded in


Trojan programs or ransomware
e. E-mail attachments or links in phishing
delivered via fake invoice PDFs
Attachments emails, often disguised as legitimate
or ZIP files.
files.

14.2.2 identify common symptoms of an attack by a malware on a computer system


Unusual System Behavior:
●​ System crashes or frequent errors.
●​ Slow performance or unresponsive programs.
Pop-ups and Unwanted Ads:
●​ Frequent or unexpected pop-ups, even when no browser is open.
Unauthorized Activities:
●​ Files or programs opening, closing, or installing themselves without user input.
●​ Emails sent from your account without your knowledge.
Missing or Corrupted Files:
●​ Important files are missing, inaccessible, or replaced with strange content.
Altered System Settings:
●​ Homepage, browser settings, or file associations changing without permission.
Security Tools Disabled:
●​ Antivirus or firewall deactivated without user action.

14.2.3 Identify the precautions to safeguard computer systems against the ways through
which malware can spread mentioned in SLO14.2.1
Precautions to Safeguard Computer Systems

Method Precautions

- Always scan external devices before use with updated antivirus


a. Flash Drives/CDs
software.

- Disable autorun functionality in the operating system.

b. Pirated Software - Avoid downloading or installing pirated or cracked software.

- Use licensed and verified software from official sources.

c. Local Area Network - Restrict access to shared folders and enforce network security
(LAN) policies.

- Regularly scan and monitor network traffic for suspicious


activities.

d. Internet - Use secure browsers and enable pop-up blockers.

- Avoid clicking on unknown links and verify website


authenticity.

e. E-mail Attachments - Do not open unsolicited or suspicious email attachments.

- Verify sender identity and scan all attachments with antivirus


software before opening.

14.3.2 differentiate between Two Factor Authentication (2FA) and Multifactor Authentication
(MFA)
Aspect Two-Factor Authentication (2FA) Multifactor Authentication (MFA)

Requires exactly two layers of Requires more than two layers of


Definition authentication (e.g., a password and a authentication (e.g., password, biometric
mobile OTP). scan, and a security token).

Provides a moderate level of security by Provides a higher level of security with


Security adding a single additional layer to the multiple, independent authentication
authentication process. factors.

Logging in with a password, a


Logging in with a password and
Example fingerprint scan, and a token-based
receiving an OTP via SMS.
security code.

14.3.3 describe the following authentication methodologies:


a. username and password
b. Personal Identification Number (PIN)
c. access cards
d. biometrics
Authentication Methodologies
a. Username and Password
●​ Definition: A traditional method where users provide a unique username and a secret
password.
●​ Advantages:
o​ Simple and easy to implement.
o​ Cost-effective.
●​ Disadvantages:
o​ Vulnerable to attacks like phishing, brute force, or credential theft.
o​ Passwords can be forgotten or reused across multiple platforms.
b. Personal Identification Number (PIN)
●​ Definition: A numeric code that users input to authenticate themselves.
●​ Advantages:
o​ Quick and easy to use.
o​ Effective for devices like ATMs or mobile phones.
●​ Disadvantages:
o​ Limited security due to fewer combinations (usually 4–6 digits).
o​ Susceptible to being guessed or observed during entry.
c. Access Cards
●​ Definition: Physical cards equipped with magnetic strips, barcodes, or RFID
technology used to authenticate users.
●​ Advantages:
o​ Convenient and quick for entry in physical spaces.
o​ Can be integrated with other authentication methods.
●​ Disadvantages:
o​ Can be lost, stolen, or duplicated.
o​ Requires additional hardware for scanning.
d. Biometrics
●​ Definition: Authentication based on unique biological characteristics, such as
fingerprints, facial recognition, or iris scans.
●​ Advantages:
o​ Highly secure as biometric traits are difficult to replicate.
o​ Eliminates the need for remembering passwords or carrying physical tokens.
●​ Disadvantages:
o​ Can be expensive to implement.
o​ May face issues with accuracy or user acceptance due to privacy concerns.

You might also like