Notes, summaries, assignments, exams, and problems for Computer science

Gender Disparities in Mortality Rates and Immune System Function

Computer science2.03 KB

EXT2018.OA´WOMEN REALLY´

1.a-P1: A recent study found that women tend to live longer than men. b-P3: The academics also discovered that women have a stronger immune system.

  • a-harsh
  • b-hardship
  • c-underpinnings
  • d-outlive

4.p1: Danish researchers analyzed 19th-century data. p2: Research showed that women outlive men. p3: Males have a higher mortality rate even if...

ORD2018.OB·`Shop hires...`

1.a-P2: But it is important for businesses to understand their customers. b-P4: We thought it was an emotional and exciting experience.

  • a-actually
  • b-aware
  • c-stressful
  • d-understanding

4.p1: At the shop, Fabio performed. p2: When Fabio, the staff. p3: The staff had become...

ORD2017.OB`The victorian...`

1.a-P2: People would gather to observe. b-P3: The tableaus were a frozen...

Continue reading "Gender Disparities in Mortality Rates and Immune System Function" »

Understanding Computer Output Devices and Printing Technology

Computer science3.64 KB

Output Devices

Dot Matrix Printers

Dot matrix printers are known for their ability to handle continuous forms and harsh environments.

Advantages

  • Can print long jobs.
  • Inexpensive to maintain.
  • Can work in dirty atmospheres.
  • Can print different characters.

Disadvantages

  • Expensive to purchase.
  • Noisy operation.
  • Poor quality printing.

Inkjet Printers

Inkjet printers are made up of a print head, ink cartridge, motor, and paper feed mechanism.

General Printer Operation

The following steps describe how a typical printer processes a job:

  1. Data is sent to the printer driver via USB.
  2. The data is converted into a form the printer understands.
  3. The system checks whether the job is able to be printed.
  4. The printer receives data in the printer buffer (temporary memory), allowing
...
Continue reading "Understanding Computer Output Devices and Printing Technology" »

Essential Tech Terms Defined

Computer science4.8 KB

  • Accuracy

    Tells us how correct a GPS measurement is.
  • Array

    A group of disk drives that are connected and used as a single unit.
  • Assembler

    A program that translates low-level programming language into machine code.
  • Attachment

    A file sent as part of an email.
  • Avatar

    An image in a computer game that represents a person.
  • Barcode

    An arrangement of lines and spaces that represent data.
  • Bit

    The smallest unit of computer data.
  • Bitrate

    A measurement of the amount of data that is processed.
  • Broadband

    A system that allows computers to transfer large amounts of information.
  • Calibration

    The act of adjusting printers and scanners to display colors correctly.
  • Capacity

    The amount of space an MP3 player has to store files.
  • Catalog

    An inventory of books in a library.
  • Cell phone

    A wireless
...
Continue reading "Essential Tech Terms Defined" »

MPEG Audio Compression: Understanding the Fundamentals

Computer science2.71 KB

Introduction

The principle of MPEG audio compression is quantization. However, the values being quantized are not the audio samples themselves, but rather numbers (called signals) taken from the frequency domain of the sound.

Encoding Process

  1. Bit Allocation: The encoder knows the compression ratio (or bit rate), allowing it to determine how many bits to allocate to the quantized signals. The adaptive bit allocation algorithm uses the bitrate and frequency spectrum of recent audio samples to minimize audible quantization noise (the difference between the original and quantized signal).
  2. Discrete Fourier Transform: Psychoacoustic models, which determine the quantization coarseness, rely on sound frequency. Since the input is audio samples, the first
...
Continue reading "MPEG Audio Compression: Understanding the Fundamentals" »

Common C++ Programming Errors and Memory Pitfalls

Computer science6.93 KB

L-Values, R-Values, and Stack Variables

An l-value can be modified, while an r-value cannot be accessed again. Additionally, a stack variable is destroyed when it is popped from the stack.

Container Errors and Undefined Behavior

std::list Indexing Error

Code:

list<int> li;
li.push_front(5);
cout << li[1] << endl;

Error: The subscript operator or function is not defined for this type. std::list does not have a [] operator because it does not support random access.

std::vector Out-of-Bounds Access

Code:

vector<string> v;
string h = "hello";
v[0] = h;
cout << v[0] << endl;

Error: Indexing out of the bounds of the container. Since the vector is empty, this behavior is undefined.

Pointer and Reference Pitfalls

Uninitialized

...
Continue reading "Common C++ Programming Errors and Memory Pitfalls" »

Essential Java Design Patterns: Implementation Examples

Computer science2.99 KB

Memento Pattern

The Memento pattern allows you to capture and externalize an object's internal state so that the object can be restored to this state later.

public class MementoDemo {
    public static void main(String[] args) {
        Caretaker caretaker = new Caretaker();
        Originator originator = new Originator();
        originator.setState("State1");
        caretaker.addMemento(originator.save());
        originator.restore(caretaker.getMemento());
    }
}

Composite Pattern

The Composite pattern is used to compose objects into tree structures to represent part-whole hierarchies.

public class CompositeDemo {
    public static void main(String[] args) {
        Box root = initialize();
        int[] levels = new int[args.length];
...
Continue reading "Essential Java Design Patterns: Implementation Examples" »

UrarenKalitatea: Pascal Source Code for Water Quality

Computer science5.27 KB

UrarenKalitatea Pascal Source Code

The following is a complete Pascal program designed to manage and calculate water quality measurements and indices.

PROGRAM UrarenKalitatea ;

USES
  Crt, SysUtils ;

CONST
  MAX_NEURKETAK = 1000 ;

TYPE
  tsKateLabur = STRING [10] ;
  tsKateLuze = STRING [150] ;
  tarOinarrizkoParametroak = ARRAY [1..9] OF Real ;
  trdNeurketa = RECORD
    sBehatokia,
    sData: tsKateLabur ;
    rKIO: Real ;
    iKI: Integer ;
    arParametroak : tarOinarrizkoParametroak ;
  END ;
  tardNeurketenZerrenda = ARRAY [1..MAX_NEURKETAK] OF trdNeurketa ;
  tfrdNeurketenFitxategia = FILE OF trdNeurketa ;

FUNCTION fncAukeraIrakurri : Char ;
VAR
  cAukera : Char ;
BEGIN
  Writeln('1. Neurketen fitxategiaren edukia erakutsi') ;
  Writeln(
...
Continue reading "UrarenKalitatea: Pascal Source Code for Water Quality" »

Understanding Semantics and Characteristics of Programming Languages

Computer science2.46 KB

Semantics in Programming

Semantics indicate the meaning of the code, specifically:

  • What the code will actually do
  • Can we effectively define this in a formal way?

In essence, semantics refers to the meaning of a statement.

Characteristics of Effective Programming Languages

  1. Clarity, Simplicity, and Unity

    A programming language should be clear and simple, enabling users to understand it easily. Unity contributes to understandability.

  2. Orthogonality

    This term refers to the ability to combine various features of a language in all possible combinations, with each combination being meaningful. For example, if a language provides an expression that can produce a value and a conditional statement that evaluates an expression to yield a true or false result, these

...
Continue reading "Understanding Semantics and Characteristics of Programming Languages" »

Object-Oriented Data Encapsulation & Types

Computer science2.63 KB

Chapter 1: Foundations of Object-Oriented Programming

Data Encapsulation with Classes

The starting point of object-oriented programming is to provide a more faithful implementation of the notion of “type” in programming. The programming languages we are familiar with come with standard built-in types that we can assign to variables and values:

Built-in Programming Types

  • In C, we can use int, float, double, char, etc.
  • In Haskell, similarly, we can use Int, Float, Char, Bool, etc.

In addition, programming languages provide a way to assign a single name to a collection of values of the same type. The nature of this collection is determined by the underlying architecture assumed by the programming language.

Collections and Data Structures

Arrays in
...
Continue reading "Object-Oriented Data Encapsulation & Types" »