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

Understanding CIDR, Subnetting, and Supernetting in IP Addressing

Computer science3.13 KB

Drawbacks of Classful Addressing

Subnets have a fixed number of host addresses, leading to many unused/wasted IP addresses.

Solutions for IP Address Shortages

Short-term: Classless addressing
Long-term: IPv6

CIDR (Classless Inter-Domain Routing)

CIDR uses a hierarchical addressing scheme based on VLSM (Variable Length Subnet Masking).

Advantages of CIDR

  • Replaces classful addressing with a more flexible and less wasteful classless scheme.
  • Enhances route aggregation.

How VLSM Works

VLSM further subnets existing subnets by taking bits from the host ID, creating a multi-level hierarchy with "sub-subnets."

Supernetting

Supernetting combines continuous network addresses into a new address defined by the subnet mask. Multiple networks are combined into a larger...

Continue reading "Understanding CIDR, Subnetting, and Supernetting in IP Addressing" »

C++ Standard Library Data Structures and Algorithms

Computer science146.78 KB

C-Style Arrays

In stack: int a[3] = {0, 1, 2};

In heap: int* b = new int[3];

Sorting

std::sort(myvector.begin(), myvector.end());

Example 2: std::sort(myvector.begin(), myvector.end(), myCompFunction);

mylist.sort() or mylist.sort(compare_nocase);

bool compare_nocase(const std::string& first, const std::string& second) { return first < second; }

Templated Classes

Include template <typename T> above the header.

Each function has a template declaration:

template <typename T>
class_name<T>::getmax () {
  // ...
}

typedef list_iterator iterator;

Strings

str.substr(3, 5) (starts at position 3, length 5)

str1.compare(str2) != 0

str.length()

Lists

iterator insert(iterator position, const value_type& val); (returns pair)

Maps

std::map&

...
Continue reading "C++ Standard Library Data Structures and Algorithms" »

SQL*Plus and Oracle Database: Test Questions and Answers

Computer science7.44 KB

SQL*Plus is the version of SQL used to access Oracle databases

1.True

2.False

SQL*Plus del command can delete all lines from the buffer at once

1.True

2.False

There is no difference between the CHAR and VARCHAR2 data types. They are just spelled differently

1.True

2.False

Which command(s) set the title of SQL*Plus report

  1. Set Headsep
  2. Column
  3. Set PageSize
  4. Set Line Size
  5. Edit
  6. Define_Editor
  7. Start
  8. Remark
  9. /* */
  10. Host
  11. Ttitle
  12. Btitile
  13. @
  14. Break On
  15. Compute Sum
  16. Set NewPage
  17. Set Pause
  18. Save
  19. Host
  20. Command is not in the list
  21. Command does not exist

Table in Oracle cannot be created if the primary key is not specified

1.True

2.False

Alternate key may contain NULL values

1.True

2.False

Table can have several alternate keys, but only one primary key and one foreign key

1.True

2.False

Which command(s) is/...

Continue reading "SQL*Plus and Oracle Database: Test Questions and Answers" »

SQL Database Schema & Query Solutions

Computer science4.85 KB

Forum Database Schema: Creation Scripts

Database Creation

CREATE DATABASE ForumDeDiscussoes;

USE ForumDeDiscussoes;

Usuario Table

CREATE TABLE Usuario (
  idUsuario INT AUTO_INCREMENT,
  nome VARCHAR(70),
  email VARCHAR(45),
  PRIMARY KEY (idUsuario)
);

Forum Table

CREATE TABLE Forum (
  idForum INT AUTO_INCREMENT,
  nome VARCHAR(45),
  PRIMARY KEY (idForum)
);

Topico Table

CREATE TABLE Topico (
  idTopico INT AUTO_INCREMENT,
  nome VARCHAR(45),
  idForum INT,
  PRIMARY KEY (idTopico),
  CONSTRAINT fkForum FOREIGN KEY (idForum) REFERENCES Forum (idForum)
);

Comentario Table

CREATE TABLE Comentario (
  idComentario INT AUTO_INCREMENT,
  Descricao VARCHAR(255),
  idTopico INT,
  PRIMARY KEY (idComentario),
  CONSTRAINT fkTopico FOREIGN KEY (idTopico)
...
Continue reading "SQL Database Schema & Query Solutions" »

Essential MIPS Assembly Programming Practice Problems

Computer science2.83 KB

1. MIPS Addition of Four Variables

Code in MIPS to add the 4 integer variables: a, b, c, d.

add $e, $a, $b
add $e, $e, $c
add $e, $e, $d

2. MIPS Implementation of f = (g + h) - (i + j)

Mapping f, g, h, i, j to $s0, $s1, $s2, $s3, $s4:

add $t0, $s1, $s2
add $t1, $s3, $s4
sub $s0, $t0, $t1

3. Why is a MIPS Register 32 Bits?

32 bits occur frequently and thus in MIPS, it has a special name: ‘word’. A size of 32 aligns well with the MIPS instruction format.

4. Understanding Big Endian in MIPS

‘MIPS is Big Endian’ means the most significant byte is stored at the least address of a word.

5. Purpose of lw and sw Instructions

These are MIPS data transfer instructions used to access specific memory locations:

  • lw (load word): Transfer data from memory to
...
Continue reading "Essential MIPS Assembly Programming Practice Problems" »

JavaScript Calculator

Computer science292 bytes

Instructions:

  1. Refer to the files using a relative path.
  2. Save all files, including the HTML file, before using this feature.

Value 1


Value 2


Add Minus Divide Multiply


Submit


Radio nav

Computer science10.2 KB

  1. Telephone communication

it has been the medium used as the first contact with a company. It is used to arrange meetings , interviews or to ask for information, so the impression of the first telephone call is very important

  1. Telephone means and equipment

Fixed individual devices

Private branch exchanges (PBX):  it connects calls between two destinations or ends

Mobile devices:

PDA (Personal Digital Assistant) it`s like a small computer (Internet and electronic mail)

Smartphone:  A PDA with video, camera, radio, MP3 player  or television

Services: Internet, e-mail, videoconference, camera, audio and  Video quality player, an agenda, GPS,....

3. Additional services offered by the telephone equipment

3.1 Common features(a,b,c,)

  1. Fixed telephony: -

Notice

...
Continue reading "Radio nav" »

MQTT vs CoAP: IoT Communication Protocols Explained

Computer science2.58 KB

Wide Area Networks

Applications utilize application-level protocols (such as MQTT, CoAP, HTTP, and WS) to communicate effectively across networks.

MQTT: Publish/Subscribe Messaging

MQTT is a lightweight messaging protocol based on TCP/IP. It utilizes Quality of Service (QoS) levels to manage delivery:

  • QoS 0 (At Most Once): Messages are sent with no guarantee of arrival.
  • QoS 1 (At Least Once): Subscribers acknowledge message reception. The broker stores the message and retries until an acknowledgment is received.
  • QoS 2 (Exactly Once): The most reliable delivery method. The broker ensures messages are delivered to subscribers without duplicates.

MQTT Security

MQTT does not provide native security. It can utilize TLS/SSL encryption for data in transit,...

Continue reading "MQTT vs CoAP: IoT Communication Protocols Explained" »

Understanding Databases: Concepts and Key Components

Computer science4.58 KB

What is a Database?

A database is an organized collection of data, visualized as a container of information. The data is typically organized to model relevant aspects of reality. A Database Management System (DBMS) is a software package with computer programs that controls the creation, maintenance, and use of a database. It allows organizations to conveniently develop databases for various applications.

A database is an integrated collection of data records, files, and other objects. A DBMS allows different user application programs to concurrently access the same database. Typically, databases available on database servers are accessed through command-line or graphical user interface tools, referred to as front-ends; database servers are referred...

Continue reading "Understanding Databases: Concepts and Key Components" »

CPU Architecture and Computer Memory Systems

Computer science3.16 KB

Intel Pentium Processors and CPU Sockets

Intel Pentium processor: The processor is placed and secured into a compatible CPU socket found on the motherboard. Processors produce heat, so they are covered with a heat sink to keep them cool and running smoothly.

The CPU chip is usually in the shape of a square or rectangle and has one notched corner to help place the chip properly into the CPU socket. On the bottom of the chip are hundreds of connector pins that plug into each of the corresponding holes in the socket. Intel and AMD have also experimented with slot processors that were much larger and slid into a slot on the motherboard. Also, over the years, there have been dozens of different types of sockets on motherboards. Each socket only supports...

Continue reading "CPU Architecture and Computer Memory Systems" »