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

Core Concepts in Data Management, Mining, and Analytics

Computer science124.09 KB

Object Identifier (OID) Explained

OID stands for Object Identifier, which is a unique identifier assigned to each object in an object-oriented database (OODB).

Function and Structure of OIDs

In an OODB, data is stored as objects that have properties (attributes) and behaviors (methods). Each object is assigned a unique OID that identifies it uniquely within the database. OIDs are used to reference objects and to establish relationships between them.

For example, if one object in a database needs to refer to another object, it can do so using the OID of the other object. This helps to establish relationships between objects and enables the creation of more complex data structures.

OID vs. Primary Key

OIDs in database management systems are similar...

Continue reading "Core Concepts in Data Management, Mining, and Analytics" »

Oracle PL/SQL and SQL XML Generation Techniques

Computer science4.85 KB

PL/SQL Components for Race Management

The following PL/SQL objects demonstrate core database programming concepts, including custom functions for calculation, procedures for data manipulation and ranking, and triggers for auditing.

1. Calculating Global Time: The tempo_global Function

This function calculates the total elapsed time for a specific pilot by summing the duration of all stages recorded in the TempoEtapas table. It includes robust error handling using SQLCODE.

CREATE FUNCTION tempo_global (ID_piloto IN NUMBER)
RETURN NUMBER
IS
    soma_tempo NUMBER;
    coderro NUMBER;
    CURSOR c1 IS
        SELECT tempo_inicio, tempo_fim
        FROM TempoEtapas
        WHERE Piloto_idPiloto = ID_piloto;

BEGIN
    soma_tempo := 0;
    FOR item IN
...
Continue reading "Oracle PL/SQL and SQL XML Generation Techniques" »

Essential Computer Terms and Definitions

Computer science3.75 KB

Essential Computer Hardware and Components

  • ROM: Primary memory that is used to read data.
  • USB: A slot in the motherboard where you can plug in input devices.
  • Headset: An output device used to listen and to speak.
  • Printer: A peripheral device used to convert digital documents into paper.
  • Tablet: A portable computer.
  • Keyboard: An input device used to type data into the PC.
  • Key: Every unit of a keyboard used for typing.
  • Mainframe: A professional, powerful computer used to offer a service.
  • CPU: A component of the motherboard that manages all the processes of the computer.
  • Scanner: An input peripheral device used to convert documents into digital format.
  • Magnetic Disk: Analogous secondary storage.
  • Megabyte: A measurement unit used in IT representing memory
...
Continue reading "Essential Computer Terms and Definitions" »

Debugging and Optimizing Essential Java Code Examples

Computer science10.4 KB

This document presents seven fundamental Java programming examples (pg1 through pg7) that demonstrate basic input/output, conditional logic, array handling, and algorithmic concepts. The original code contained numerous syntax errors, capitalization issues, and logical flaws. Below, we provide the corrected and optimized versions, ensuring proper Java conventions and functionality.

1. pg1: Conditional Arithmetic Checks

Purpose: Evaluating multiple arithmetic relationships between three input integers (a, b, c).

The original code had incorrect capitalization (Int, If, Else) and a logical flaw where the combined condition check was unreachable due to sequential else if statements. The corrected version addresses these issues.

import java.util.Scanner;
...
Continue reading "Debugging and Optimizing Essential Java Code Examples" »

Understanding Operating Systems: File, Task, and User Management

Computer science2.74 KB

File Management

File management is the system an operating system uses to organize and keep track of data. The operating system stores data in units called files, determines how files are stored, efficiently uses available storage space, creates a record of all file usage, and carries out every task related to files and folders.

File names typically have this structure:

filename.extension

Task and User Management

Task Management

Task management is the part of the operating system that controls the running of one or more programs on a computer simultaneously. Today's widely used operating systems support multitasking, allowing multiple tasks to run concurrently, taking turns using the computer's resources.

User Management

With user management, the operating...

Continue reading "Understanding Operating Systems: File, Task, and User Management" »

Key Features of Modern Personal Computers

Computer science1.87 KB

1. Speed

Computers process data at an extremely fast rate. In a few seconds, they can perform tasks that would take a human days or even years to complete. Computer speed is measured in MHz (Megahertz) or GHz (Gigahertz).

  • Microcomputers: Execute millions of instructions per second consistently without error.
  • Supercomputers: Operate at speeds measured in nanoseconds and picoseconds, performing tasks one thousand to one million times faster than microcomputers.

2. Accuracy

Computers are highly accurate, though performance depends on the instructions provided. Because computers only execute what they are programmed to do, faulty instructions lead to faulty results—a concept known as GIGO (Garbage In, Garbage Out).

While errors can occur, advanced...

Continue reading "Key Features of Modern Personal Computers" »

Computer Network Essentials: Types, Components, and Protocols

Computer science2.85 KB

Understanding Computer Networks

  • A computer network is the interconnection of multiple devices, generally termed as hosts, connected using multiple paths for the purpose of receiving data or media.
  • Connected devices share information and resources.
  • The channel or line is where this information is transmitted.

Computer Network Classifications

Networks can be classified in several ways:

  1. By Size: The most common classification.
  2. By Property
  3. By Connection Method
  4. By Topology

1. Network Classification by Size

  • LAN (Local Area Network): Maximum of a building. The most frequent type, common in most offices.
  • MAN (Metropolitan Area Network): Maximum of a city, connecting different buildings.
  • WAN (Wide Area Network): Connects devices from different cities or even countries.
...
Continue reading "Computer Network Essentials: Types, Components, and Protocols" »

Building Parsers and Interpreters with BNF

Computer science2.67 KB

Understanding Parsers and Abstract Syntax

A Parser is a program that translates terms in concrete syntax into abstract syntax.

  • In our language (PLAI, not Racket), we use {braces} instead of (parentheses) to distinguish concrete syntax from Scheme by looking at the delimiters.
  • The parser identifies the program structure and converts it to the appropriate abstract syntax. This requires a clear specification of the concrete syntax using Backus-Naur Form (BNF).

Arithmetic BNF Specification

<AE> ::= <num>
      | {+ <AE> <AE>}
      | {- <AE> <AE>}
  • The <AE> in BNF is a non-terminal, meaning it can be rewritten as one of the items on the right-hand side.
  • The ::= symbol means “can be rewritten as.”
  • Each | presents
...
Continue reading "Building Parsers and Interpreters with BNF" »

Data Manipulation and Visualization with R and the nycflights13 Dataset

Computer science3.64 KB

library(nycflights13)
library(tidyverse)

Data Manipulation with dplyr

Ordering Rows with arrange()

arrange(flights, year, month, day)
arrange(flights, desc(arr_delay))

Handling NAs

df <- tibble(x = c(5, 2, NA))
arrange(df, x)
arrange(df, desc(x))

Selecting Columns with select()

select(flights, year, month, day)
select(flights, year:day)
select(flights, -(year:day))
rename(flights, mes = month)
select(flights, time_hour, air_time, everything())

Creating New Variables with mutate()

flights_sml <- select(flights, year:day, ends_with("delay"), distance, air_time)
mutate(flights_sml, gain = arr_delay - dep_delay, speed = distance / air_time * 60)

Creating Functions with Vector Arguments

transmute(flights, dep_time, hour = dep_time %/% 100, minute = dep_time %
...
Continue reading "Data Manipulation and Visualization with R and the nycflights13 Dataset" »