Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

Python Functions and Errors: Time, Triangle, Bonus, and Digits

Classified in Computers

Written on in English with a size of 4.09 KB

TIME DIFFERENCE

def time_difference(time1, time2):
time1=time_to_seconds(time1)
time2=time_to_seconds(time2)
diffinsecond=time2-time1
hours=diffinsecond//3600
minutes=(diffinsecond-(hours*3600))//60
seconds=diffinsecond-(hours*3600)-(minutes*60)
return(make_time_string(hours,minutes,seconds))

# Predefined helper functions. Do not edit them.
def time_to_seconds(time):

x = list(map(int, time.split(":"))
return x[0] * 3600 + x[1]*60 + x[2]

def make_time_string(hours, mins, seconds):
return "{:02d}:{:02d}:{:02d}".format(hours, mins, seconds)

TYPE OF TRIANGLE

def triangle(side1, side2, side3):
if side1+side2<>
return "Not a triangle"
elif side1==side2 and side2==side3:
return "Equilateral"
elif... Continue reading "Python Functions and Errors: Time, Triangle, Bonus, and Digits" »

HTML Input Types, Sensors, Random Numbers, and Loops in JavaScript

Classified in Computers

Written on in English with a size of 3.49 KB

Radio Buttons

Radio buttons allow you to choose only one option among multiple. If an option wasn't previously selected, it can be automatically changed. Radio buttons with the same name are grouped together, ensuring that only one option within that group can be selected at a time.

Gender: Male Female

Checkboxes

Checkboxes allow you to choose one or more options from a list. Unlike radio buttons, a name attribute is not required for grouping.

Activities: Yoga Boxing

To check if a checkbox is selected in JavaScript, you can use the following code within a button's function:

if (document.getElementById("checkbox_id").checked == true)

To reset a checkbox, use:

document.getElementById("checkbox_id").checked = false;

Sensors

Senses allow us to collect information... Continue reading "HTML Input Types, Sensors, Random Numbers, and Loops in JavaScript" »

Web Security: Confidentiality, Authentication, and Protection Measures

Classified in Computers

Written on in English with a size of 3.48 KB

Web Security

Confidentiality: only authorized users should have access to the data

Authentication: each user must be confirmed to be who they say they are through their digital identity

Authorization: access to the different services must be conditioned by the identity and permissions attributed to each user

Integrity: the data sent must be the same as those received, avoiding manipulation or corruption

Availability: quality or condition of the information to be available to those who must access it.


Security Threats: the security of a network is exposed

Logical Causes:

This is the software that can attack the computer: malware, spam, viruses, programming errors…

Human Causes:

These are users who can damage the system: inexperienced users, hackers,... Continue reading "Web Security: Confidentiality, Authentication, and Protection Measures" »

Aircraft systems

Posted by and classified in Computers

Written on in English with a size of 10.6 KB

New jobs are admitted into the system
-- long-term or high-level scheduling

Once in the system, processes go through a number of state changes
-- short-term or low-level or CPU scheduling

A process is a "running program" or "program in execution"

Processes have a variety of states:


   RUNNING           READY                 WAITING (on I/O)
    STATE            STATE                  STATE

   +-----+                               +-----------------------+
   |     |     +--------------------+    |                 P2 P8 |
   | CPU | <== |="" p3="" |="" p6="" |="" p5="" |="" ...="">==><== i/o="" subsystem="" p13="" |="" |="" p11="" |="" +--------------------+="" |="" |="" +-----+="" +-----------------------+="" (a="" cpu=""
... Continue reading "Aircraft systems" »

Sorting Algorithms and Hash Tables: Explained and Compared

Classified in Computers

Written on in English with a size of 3.31 KB

Sorting Algorithms and Their Bounds

Results like the Ω(nlgn) lower bound on all sorting via binary comparisons are difficult to establish. On the other hand, results like the O(n2) upper bound on INSERTION-SORT are easier to achieve. Explain adequately the difference in the “ease” of arriving at these results.

One result applies to all sorting algorithms that are based on binary comparisons (and so is harder to establish) while the other result is simply for one specific sorting algorithm in the same category. A more complete answer would involve an argument that rightly recognizes that the lower bound result is one that also applies to algorithms that exist and also those yet to be devised (yes, even those that may be written a hundred... Continue reading "Sorting Algorithms and Hash Tables: Explained and Compared" »

Understanding Databases: Concepts and Key Components

Posted by aakankshajayant and classified in Computers

Written on in English with a size of 4.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" »

Understanding Counting Principles, Knowledge Types, and Geometric Thinking

Classified in Computers

Written on in English with a size of 3.56 KB

The Counting Principles

Counting is the action of finding the number of elements in a finite set of objects. Here are the key principles:

  1. The Stable-Order Principle: To count effectively, the list of words used (like one, two, three) must be in a repeatable order.
  2. The One-to-One Principle: This involves assigning one, and only one, distinct counting word to each item being counted.
  3. The Cardinal Principle: When the one-to-one and stable-order principles are followed, the number name given to the final object in a collection represents the total number of items in that collection.
  4. The Order-Irrelevance Principle: This principle highlights that the order in which items are counted doesn't affect the total count.
  5. The Abstraction Principle: These counting
... Continue reading "Understanding Counting Principles, Knowledge Types, and Geometric Thinking" »

3D Cube Transformations in OpenGL: Scaling, Translation, and Rotation

Posted by aditya dani and classified in Computers

Written on in English with a size of 2.4 KB

Introduction

This program demonstrates how to draw a 3D cube in OpenGL and perform various transformations on it, including scaling, translation, and rotation about one axis.

Code

#include <GL/glut.h>

bool movingRight = false;
float xLocation = 0.0f;

void display() {
  glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
  glClear(GL_COLOR_BUFFER_BIT);
  glLoadIdentity();
  glTranslatef(0.0f, 0.0f, -5.0f);
  glTranslatef(xLocation, 0.0f, 0.0f);
  glutWireCube(2.0f);
  glutSwapBuffers();

  if (movingRight)
    xLocation -= 0.05f;
  else
    xLocation += 0.05f;

  if (xLocation < -3.0f)
    movingRight = false;
  else if (xLocation > 3.0f)
    movingRight = true;
}

void reshape(int width, int height) {
  glViewport(0, 0, (GLsizei)width, (GLsizei)
... Continue reading "3D Cube Transformations in OpenGL: Scaling, Translation, and Rotation" »

Oracle PL/SQL and SQL XML Generation Techniques

Classified in Computers

Written on in English with a size of 4.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" »

Refer to the exhibit. A network administrator has segmented the network into two VLANs and configured Router1 for inter-VLAN routing. A test of the network, however, shows that hosts on each VLAN can only access local resources and not resources on t

Classified in Computers

Written on in English with a size of 20.53 KB

  1.  A network technician is configuring port Security on a LAN switch interface. The security policy requires host MAC Addresses to be learned dynamically, stored in the address table, and Saved to the switch running configuration. Which command does the technician Need to add to the following configuration to implement this Policy? Switch(config)# interface fa0/1 
    Switch(config-if)# switchport mode access 
    Switch(config-if)# switchport port-security

·Switch(config-if)# switchport port-security mac-address sticky

  1. On which switch interface would an Administrator configure an IP address so that the switch can be managed Remotely?

·VLAN 1

  1. Refer to the exhibit. Match the packets with Their destination IP address to the exiting interface on the router.
... Continue reading "Refer to the exhibit. A network administrator has segmented the network into two VLANs and configured Router1 for inter-VLAN routing. A test of the network, however, shows that hosts on each VLAN can only access local resources and not resources on t" »