Notes, summaries, assignments, exams, and exercises for Computer science for Primary education

Understanding TCP/IP and Web 2.0 for Online Safety

Computer science2.53 KB

To make this possible, it is necessary to "speak the same language," which is TCP/IP. TCP/IP is used to transfer files or data from one computer to another. Typically, the client is your browser (Firefox, Opera, Internet Explorer), and the server is a program running on a remote computer.


Protection From Hackers and Viruses

Hacking and System Security

Hacking means accessing a computer system and its files without permission. It is illegal, and once inside the system, the hacker might be able to view, copy, or delete important files or plant a virus. Organizations protect themselves using passwords, encrypting files, and using hacking-detection software.

Understanding Computer Viruses

A virus is a program deliberately written to affect operating

...
Continue reading "Understanding TCP/IP and Web 2.0 for Online Safety" »

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" »

Key C++ Programming Principles and Comparisons

Computer science2.99 KB

1) What is C++? Advantages of C++

C++ is an object-oriented programming language developed by Bjarne Stroustrup. It is an extension of the C language.

Advantages:

  • Supports Object-Oriented Programming.
  • Code reuse using inheritance.
  • Fast execution.
  • Data security through encapsulation.
  • Portable language.
  • Supports function and operator overloading.

2) Difference Between Procedural and Object-Oriented Programming

Procedural ProgrammingObject-Oriented Programming
Program divided into functionsProgram divided into objects
Top-down approachBottom-up approach
Less data securityMore data security
Example: CExample: C++

3) Six Advantages of OOP

  1. Data hiding provides security.
  2. Code reusability using inheritance.
  3. Easy program maintenance.
  4. Reduces program complexity.
  5. Easy debugging.
...
Continue reading "Key C++ Programming Principles and Comparisons" »

Backup, Cryptography and GnuPG: A Practical Security Reference

Computer science2.85 KB

Backup

Important directories: /etc, /home, /var, /usr, /local

Package and compress with tar. Files: home.tar

# tar -cvf home.tar /home

Compression:

# gzip -r /home/* (recursive compression)

Decompression:

# gunzip -r /home/* (recursive decompression)

Cryptography

In cryptography, digital signatures are a digital information authentication method, known as signature.

The art of cryptanalysis is the study of attempts to break ciphertext.

Key + algorithm + message = ciphertext

CID + Authentication + Irretrievability

Encryption: C = Ek(M). Decryption: M = Dk(C)

Steganography: secret communication by hiding the existence of the message.

Steganalysis: detection of steganographic content.

Examples of cryptographic protocols: SSL, SSH, IPSec, WEP, WPA

Symmetric algorithms:...

Continue reading "Backup, Cryptography and GnuPG: A Practical Security Reference" »

Key Concepts in IT: Client Facilities, XML, and Security

Computer science3.59 KB

Client Facilities

Client Facilities: Performance, ensure integrity, updates, risk confidential. Static pages, forms, active content, plugins, stand-alone applications.

XML

XML (Extensible Markup Language): Preferred form for B2B and internal documents with legal effect. Key benefits: non-proprietary, platform independent, HTTP compatibility, international support, extensible, self-defining, common tools, and transformation. Complementary techniques: UDDI (Universal Description, Discovery, and Integration), WSDL (Web Services Description Language) – web service design. Signatures have legal effect.

Components

Components: Good because turn-key systems tend to be too large and inflexible. Advantages: higher quality and design, maintenance shared,...

Continue reading "Key Concepts in IT: Client Facilities, XML, and Security" »

Java MySQL CRUD Operations Code Snippets

Computer science3.07 KB

Conexão

try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", "abc123");
} catch (ClassNotFoundException dri) {
    System.out.println("Erro ao carregar o driver" + dri.getMessage());
} catch (SQLException sql) {
    System.out.println("Erro ao conectar ao banco de dados" + sql.getMessage());
} catch (Exception e) {
    throw new RuntimeException(e);
}

Insert

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/", "root", "abc123");
String sql = "insert into dados.Pessoa (nome, idade, sexo) values (?, ?, ?)";
try {
    PreparedStatement stmt = con.prepareStatement(sql);
    Pessoa p = (Pessoa) o;
    stmt.setString(1, p.getNome());
    stmt.
...
Continue reading "Java MySQL CRUD Operations Code Snippets" »

C File Handling Techniques: Data Storage and Retrieval Examples

Computer science4.91 KB

C Example 1: Writing Structured Data to a File

This program demonstrates appending structured date data (assuming struct fecha is defined elsewhere) to a file named Dades.txt. It includes basic file opening and error checking.


#include <stdio.h>
#include <stdlib.h>

int main() 
{
    int temp = 1;
    int auxiliar = 0;
    int i = 0;
    FILE *v1;
    
    v1 = fopen("Dades.txt", "a");
    
    // Note: Variables 'origen' and 'destino' are undefined in this snippet.
    if (origen == NULL || destino == NULL) {
        printf("Problemas con los ficheros.\n");
        exit(1);
    }
    
    printf("Inserte el día, mes y año. El programa finalizará marcando 0 en el día:\n\n");
    
    while (temp != 0) {
        printf("Día:\
...
Continue reading "C File Handling Techniques: Data Storage and Retrieval Examples" »

Essential C++ Programming Examples and Database Concepts

Computer science78.88 KB

1. C++ Pointer Declaration and Initialization

Ans:

#include <iostream>
using namespace std;

int main() {
    int num = 10;
    int *ptr = &num;
    cout << "Value of num: " << num << endl;
    cout << "Address of num: " << &num << endl;
    cout << "Pointer ptr stores: " << ptr << endl;
    cout << "Value pointed by ptr: " << *ptr << endl;
    return 0;
}

2. C++ Program to Add Two 4x4 Matrices

Ans:

#include <iostream>
using namespace std;

int main() {
    int A[4][4], B[4][4], C[4][4];
    cout << "Enter elements of first 4x4 matrix:\n";
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 4; j++) {
            cin >> A[i][j];
...
Continue reading "Essential C++ Programming Examples and Database Concepts" »

Ec lab

Computer science3.19 KB

Postfix evaluation 

#include<stdio.H>
int stack[20];
int top = -1;

void push(int x)
{
    stack[++top] = x;
}

int pop()
{
    return stack[top--];
}

int main()
{
    char exp[20];
    char *e;
    int n1,n2,n3,num;
    printf("Enter the expression :: ");
    scanf("%s",exp);
    e = exp;
    while(*e != '\0')
    {
        if(isdigit(*e))
        {
            num = *e - 48;
            push(num);
        }
        else
        {
            n1 = pop();
            n2 = pop();
            switch(*e)
            {
            case '+':
            {
                n3 = n1 + n2;
                break;
            }
            case '-':
            {
 ...

Continue reading "Ec lab" »

It used to define the member functions of a class outside

Computer science3.19 KB

-Measure & Metric & Indicator

not provide enough information 

comparison of two or more measures

Compares a metric against a baseline


-To improve a process

Measure specific attributes 

of process

Develop meaningful metrics 

metrics provide indicators

Example Metrics derived:

Errors before software release, 

defects delivered to & 

reported by end-user

work products delivered

Human efforts expended

Calendar time expended

-Improving Software Quality 

& Organizational Performance

people.Product,technology


-Software measurement 

Direct Measures:Cost and effort

Line of Code & Execution Speed


Indirect Measures

Functionality,Quality

Complexity,Efficiency

Reliability,Maintainability


-1som:Derived by normalizing quality

LOC,cost,errors,defects

Effort...

Continue reading "It used to define the member functions of a class outside" »