Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

Java Stream Classes and ArrayList Methods

Posted by Anonymous and classified in Computers

Written on in English with a size of 2.78 KB

What is a Stream and its Classes in Java?

Introduction
A Stream is a sequence of data that flows between a program and an input/output device. Streams are used to perform input and output operations in Java. Java provides stream classes in the java.io package for reading and writing data. Streams simplify file handling and data communication.

Types of Streams

1. Input Stream

Used to read data from a source such as a file, keyboard, or network. Data flows from the source to the program.

2. Output Stream

Used to write data to a destination such as a file, screen, or network. Data flows from the program to the destination.

Various Stream Classes in Java

1. FileInputStream

Used to read data from a file. It reads data in byte format and is suitable for reading... Continue reading "Java Stream Classes and ArrayList Methods" »

IoT Protocols, Communication Models, & Deployment Strategies

Classified in Computers

Written on in English with a size of 1.64 MB

IoT Protocols

Link Layer Protocols

  • 802.3 Ethernet Standards

    A collection of wired Ethernet standards that provide data rates from 10 Mb/s to 40 gigabits per second. The shared medium in Ethernet can be a coaxial cable, twisted-pair wire, or optical fiber. This shared medium carries communication for all devices on the network.

  • 802.11 Wi-Fi Standards

    A collection of wireless Local Area Network (WLAN) communication standards.

Network/Internet Layer

  • Responsible for sending IP datagrams from the source network to the destination network.
  • Handles host addressing and packet routing based on IPv4 or IPv6.
  • Datagrams contain a source and destination address, which are used to route them from the source to the destination across multiple networks.
  • IPv4 uses 32-
... Continue reading "IoT Protocols, Communication Models, & Deployment Strategies" »

Blockchain Cryptography: ECC, Hashing, and Consensus

Posted by Anonymous and classified in Computers

Written on in English with a size of 19.16 KB

Elliptic Curve Cryptography (ECC) in Blockchain

Elliptic Curve Cryptography (ECC) is a public-key cryptography technique based on the mathematics of elliptic curves over finite fields. It is widely used in blockchain systems such as Bitcoin and Ethereum for generating secure public-private key pairs and digital signatures. The main advantage of ECC is that it provides high security with smaller key sizes, making it faster and more efficient.

The Mathematical Equation of ECC

The general equation of an elliptic curve is:

y2 = x3 + ax + b

  • a and b are constants that define the shape of the curve.
  • The curve is defined over a finite field Fₚ (where p is a prime number) for cryptographic applications.
  • To be a valid elliptic curve, it must satisfy the condition:
... Continue reading "Blockchain Cryptography: ECC, Hashing, and Consensus" »

Operating System Memory Management and Deadlock Prevention

Posted by Anonymous and classified in Computers

Written on in English with a size of 6.41 KB

Operating System Memory Management Fundamentals

The Operating System (OS) is responsible for crucial memory decisions: determining which programs reside in memory, where they are placed, how memory is protected, and what actions to take when memory resources are exhausted.

Parkinson's Law Applied to Computing

Parkinson’s Law states that programs expand to fill the memory available to hold them.

Models for Organizing Memory

Three primary models exist for structuring memory:

  • Model A (User on Top, RAM on Bottom):
    • Pros: Fast execution.
    • Cons: No protection (e.g., used in MS-DOS).
  • Model B (ROM on Top, User on Bottom):
    • Pros: OS protected.
    • Cons: Slow and not flexible.
  • Model C (Drivers at Top, User in Middle, RAM at Bottom):
    • Pros: Fast and secure.
    • Cons: Complex
... Continue reading "Operating System Memory Management and Deadlock Prevention" »

Memory Management and File System Architecture

Posted by Anonymous and classified in Computers

Written on in English with a size of 12.9 KB

1. Demand Paging

In a standard virtual memory system, the operating system does not load an entire program into physical memory (RAM) at once. Instead, it uses Demand Paging—a strategy where pages are loaded into memory only when they are needed (on demand).

How It Works: The Page Fault Mechanism

  1. CPU Reference: The CPU tries to access a specific virtual address.
  2. Page Table Check: The Hardware (MMU) checks the page table entry for that page. Each entry has a Valid/Invalid (V/I) Bit:
    • Valid (1): The page is already in RAM. The address is translated, and execution continues.
    • Invalid (0): The page is currently on the disk (hard drive/SSD). This triggers a Page Fault interrupt.
  3. OS Trap: The operating system takes control to handle the page fault.
  4. Disk
... Continue reading "Memory Management and File System Architecture" »

Software Engineering Principles and System Design

Classified in Computers

Written on in English with a size of 301.21 KB

Software Engineering and Processes

Agile Manifesto

  • Individuals/Interactions over Processes
  • Working software over documentation
  • Collaboration over negotiation
  • Responding to change over following a plan

Requirements Engineering

Descriptions of the services that a system should provide and the constraints on its operation.

Functional

What the system should do.

Non-functional

Not directly concerned with the specific services delivered by the system to its users.

Quality Attributes

A scenario describing quality attributes typically involves these elements:

  1. Source: Origin of the stimulus.
  2. Stimulus: The event arriving.
  3. Artifact: Where the event arrives.
  4. Environment: Conditions in which the scenario takes place.
  5. Response: The result of the event.
  6. Response Measure: Must
... Continue reading "Software Engineering Principles and System Design" »

JavaScript Regular Expressions and Type Conversion

Posted by Anonymous and classified in Computers

Written on in English with a size of 7.08 KB

Introduction to Regular Expressions

A Regular Expression (often abbreviated as RegExp or regex) is a sequence of characters that forms a search pattern. This pattern can be used for text search, text replace, and data validation operations.

In JavaScript, regular expressions are objects. You can create a RegExp object in two ways:

  • Using a RegExp Literal (Recommended): The pattern is enclosed between forward slashes.
    const regex = /pattern/modifiers;
  • Using the RegExp Constructor:
    const regex = new RegExp('pattern', 'modifiers');
    

RegExp Modifiers and Flags

Modifiers change how a regular expression searches text. They are appended to the end of the regex literal (e.g., /abc/g) or passed as the second argument to the constructor.

ModifierDescription
iCase-
... Continue reading "JavaScript Regular Expressions and Type Conversion" »

Operating System Concepts: Hardware Interaction and Scheduling

Posted by Anonymous and classified in Computers

Written on in English with a size of 1.45 MB

Operating System Fundamentals

The Operating System (OS) serves several critical roles:

  • It acts as a resource manager, controlling access to the hardware.
  • It provides an abstraction layer, allowing user processes to call functions that access hardware via system calls.

User Mode vs. Supervisor Mode (Kernel Mode)

The CPU enforces separation between user processes and the OS kernel:

  • User Mode: Prohibits privileged instructions.
  • Kernel Mode (Supervisor Mode): Allows access to all hardware and privileged operations.

Program Status Word (PSW)

The PSW is a special register holding vital information, such as:

  • Access privilege mode.
  • Runtime execution conditions (e.g., condition codes).
  • Program Counter (PC) and Stack Pointer (SP).

Simplified Interrupt Handling Flow

  1. A
... Continue reading "Operating System Concepts: Hardware Interaction and Scheduling" »

Processor and Memory Interface: CPU Datapath, Registers & ALU

Posted by Anonymous and classified in Computers

Written on in English with a size of 967.85 KB

Processor & Memory Interface

Processor & Memory Interface: The maximum size of the memory that can be used in any computer is determined by the addressing scheme. For example, a computer that generates 16-bit addresses is capable of addressing up to 216 = 65,536 (≈ 64K) memory locations. Machines whose instructions generate 32-bit addresses can utilize a memory that contains up to 232 = 4,294,967,296 (≈ 4G) locations, whereas machines with 64-bit addresses can access up to 264 ≈ 1.84 × 1019 locations. The number of locations represents the size of the address space of the computer.

The connection between the processor and its memory consists of address, data, and control lines. The processor uses the address lines to specify the... Continue reading "Processor and Memory Interface: CPU Datapath, Registers & ALU" »

Java Programming: Classes, Objects, and Key Concepts

Classified in Computers

Written on in English with a size of 5.28 KB

Classes (الصفوف)

  • A class consists of variables (fields) and methods.
  • Variables are data members of a class.
  • Methods are functions that define the class's behavior.

Variables (المتغيرات)

  • Declared with a data type and a name.
  • Can be public or private.
  • Examples: int age, String name.

Methods (الأساليب)

  • Functions that perform specific tasks.
  • Can have parameters and return values.
  • Types:
    • Void methods: Don't return a value.
    • Return type methods: Return a value.
    • Static methods: Can be called without creating an object.
    • Instance methods: Require an object to be called.
    • Abstract methods: Declared without a body; used in abstract classes.
    • Overloaded methods: Multiple methods with the same name but different parameters.

Constructors (البناؤون)

... Continue reading "Java Programming: Classes, Objects, and Key Concepts" »