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

C Development Tools and Functions: A Comprehensive Guide

Computer science2.85 KB

Which C development tool may add automatically malicious source code to the original application source code?

C Preprocessor

Which C software development tool may inadvertently add compiled object/binary code to the original compiled application object code?

Linker or Linkage Editor

If two programmers are developing two separate files a.c and b.c to be merged into one source code before compilation, and one declares in a.c global integer variable int j; how should the other programmer declare and use the same integer variable j in the source code b.c. Write a line of code that allows the second programmer to use in b.c declaration of variable j from the first file a.c?

extern int j;

What does ELF specify?

Executable file format, Executable file header,...

Continue reading "C Development Tools and Functions: A Comprehensive Guide" »

FornoDao Java Class: JDBC CRUD Operations for Oven Management

Computer science3.25 KB

FornoDao Java Class: JDBC CRUD Operations

The following FornoDao class is a Data Access Object (DAO) that performs CRUD operations on the FORNO table using JDBC.

public class FornoDao {

    private Connection connection;

    public FornoDao() {
        this.connection = new ConnectionFactory().getConnection();
    }

    public void remover(Forno f) {
        String sql = "DELETE FROM FORNO WHERE FOR_NUM=" + f.getNumero();

        try {
            Statement stm = this.connection.createStatement();
            stm.execute(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void inserir(Forno f) {
        String sql = "INSERT INTO FORNO(FOR_NUM, FOR_TEMP, FOR_LIGADO, FOR_VOLUME) ";
        sql
...
Continue reading "FornoDao Java Class: JDBC CRUD Operations for Oven Management" »

TypeScript va React Test Savollari: Tip Xatolari, Hooks va JSX Asoslari

Computer science8.74 KB

TypeScript va React bo'yicha test savollari

1. Quyidagi TypeScript kodida qaysi qatorda xatolik bor?

let username: string = "Samar";
username = 25; // 1-qator
let age: number | string = 20; // 2-qator
age = "yigirma"; // 3-qator
  • A) 1-qatorda, chunki string tipidagi o'zgaruvchiga number qiymat berilgan.
  • B) 2-qatorda, chunki union (|) ichida ikki xil tip kelishi mumkin emas.
  • C) 3-qatorda, chunki age boshida son edi, keyin matnga o'zgardi.

2. Agar interface ichidagi maydon faqat bir marta (obyekt yaratilayotganda) yozilib, keyin umuman o'zgartirilmasligi kerak bo'lsa, qaysi kalit so'z ishlatiladi?

  • A) static
  • B) readonly
  • C) const

3. Quyidagi ikki interfeys e'lon qilingandan so'ng, User obyektida qaysi maydonlar bo'lishi majburiy?

interface User { id: number;
...
Continue reading "TypeScript va React Test Savollari: Tip Xatolari, Hooks va JSX Asoslari" »

Java Socket Programming for Client-Server Communication

Computer science2.62 KB

Java Socket Implementation

Client-Server Socket Class (`Misocket`)

Constructor for Server (`Misocket(int port)`):

  • Initializes a `ServerSocket` with the specified port.
  • Waits for and accepts a client connection using `serverSocket.accept()`.
  • Obtains input and output streams from the accepted client socket.

Constructor for Client (`Misocket(String ip, int port)`):

  • Creates a `Socket` to connect to the specified IP address and port.
  • Obtains input and output streams for communication.

Core Functionality

Sending and Receiving Strings:

  • `dos.writeUTF(cadena); dos.flush();` to send a string.
  • `cadena = dis.readUTF(); return cadena;` to receive a string.

Sending and Receiving Integers:

  • `dos.writeInt(tam);` to send an integer.
  • `tam = dis.readInt(); return tam;` to receive
...
Continue reading "Java Socket Programming for Client-Server Communication" »

Agenda de Contactos en Java: Clase Agenda con Menú Interactivo

Computer science2.66 KB

Clase Agenda en Java

public class Agenda {
private int maximo;
private Contacto[] ag;
private int Nusados;

public Agenda(int maximo) {
this.maximo = maximo;
ag = new Contacto[maximo];
this.Nusados = 0;
}

public String añadir(Contacto c) {
String salida = "No se puede añadir";
if (this.Nusados < maximo) {
ag[this.Nusados] = c;
this.Nusados++;
salida = "Añadiendo contacto..... " + c.toString();
}
return salida;
}

public String dameContactos() {
String salida = "";
for (int i = 0; i < this.Nusados; i++) {
salida += i + ". " + ag[i].toString() + "\n";
}
return salida;
}

public boolean haySitio(
...
Continue reading "Agenda de Contactos en Java: Clase Agenda con Menú Interactivo" »

Mastering LVM: Dynamic Storage Management in Linux

Computer science3.44 KB

Logical Volume Management (LVM) in Linux Storage

F. The the vast realm of operating systems, Linux has emerged as a robust and versatile choice, powering everything from personal computers to enterprise-level servers. One of its standout features is Logical Volume Management (LVM), a powerful storage management system that offers enhanced flexibility, scalability, and reliability for handling storage devices in Linux environments. LVM revolutionizes how disk partitions and physical storage are managed, providing an abstract layer that simplifies storage administration and facilitates efficient utilization of available resources. By introducing logical volumes, volume groups, and physical volumes (PVs) (originally referred to as "physical books"...

Continue reading "Mastering LVM: Dynamic Storage Management in Linux" »

Database Essentials: Concepts, Architecture, and Management

Computer science4.01 KB

Core Database Concepts

Registration
The set of fields that describe an object.
Field
A feature of an object that stores a value.
Database
A collection of records or data that contain relevant information.

Database Applications

Databases are fundamental across various sectors, including:

  • Banks
  • Airlines
  • Universities
  • Credit Card Transactions
  • Telecommunications
  • Finance
  • Sales
  • Production
  • Human Resources

Levels of Data Abstraction

Physical Level
This is the lowest level of abstraction, describing how data is actually stored.
Conceptual Level
This is the next higher level of abstraction, describing what data is stored in the database and the relationships between data.
External Level (View Level)
This is the highest abstraction level, describing only a part of the database
...
Continue reading "Database Essentials: Concepts, Architecture, and Management" »

Core OS Concepts: Deadlocks, Memory, and Disk Storage

Computer science3.61 KB

1. Four Necessary Conditions for Deadlock

Definition: Deadlock is a situation in which two or more processes wait indefinitely for resources held by each other.

The four necessary conditions for deadlock are:

  1. Mutual Exclusion: A resource can be used by only one process at a time.
    Example: Only one process can use a printer at a time.
  2. Hold and Wait: A process holds one resource and waits for another resource.
    Example: A process holds a printer and waits for a scanner.
  3. No Preemption: A resource cannot be forcibly taken away from a process. It must be released voluntarily.
    Example: The OS cannot forcibly take a resource from a process in this condition.
  4. Circular Wait: A circular chain of processes exists in which each process waits for a resource held
...
Continue reading "Core OS Concepts: Deadlocks, Memory, and Disk Storage" »

Dynamic HTML Tables and CSS Grid Layout Techniques

Computer science791 bytes

Dynamic Fruit and Vegetable Table Selector

This interactive tool allows users to filter data by entering specific categories.

Enter 'fruit' or 'vegetable':

Fruit List

BananaMango
KiwiApple
OrangeGuava

Vegetable List

TomatoOnion
PotatoBeans
BeetrootMushroom

CSS DIV-Based Table Layout

A demonstration of creating a grid structure using DIV elements and CSS.

1
2
3
4
5
6
7
8
9

Understanding Software Engineering: Characteristics, Myths, and Paradigms

Computer science4.28 KB

Software Characteristics:
1.Software is a logical rather than a physical system element. 2.Software is developed or engineered rather than manufactured. 3.Software does not wear out. How do we measure software reliability? 4.Most software is customer-built rather than assembled from existing components.
  Software is often termed as a high-cost, low-quality product.

Software Crisis:

1.Software projects always run overtime and over budget. 2.Software is delivered with a high number of defects. 3.Software maintenance has been extremely difficult and awfully expensive. 4.It is difficult to keep pace with the growing demand for more software.

Software Myths:Management Myths:

1.Why should we change our approach to software development? We are doing
...
Continue reading "Understanding Software Engineering: Characteristics, Myths, and Paradigms" »