Notes, summaries, assignments, exams, and exercises for Computer science for Baccalaureate

C Programming Basics: Examples and Explanations

Computer science2.72 KB

C Programming Basics

Printing a Message

int main() { print("Hello!!!"); }

Variables and Mathematical Calculations

int main() // Main function

{

int a = 25; // Initialize a variable to 25

int b = 17; // Initialize b variable to 17

int c = a + b; // Initialize c variable to a + b

print("c = %d ", c); // Display decimal value of c

}

Floating-Point Math

int main() // Main function

{

float r = 1.0; // Set radius to 1.0

float c = 2.0 * PI * r; // Calculate circumference

print("circumference = %f \n", c); // Display circumference

}

Arrays

int main() // Main function

{

int p[] = {1, 2, 3, 5, 7, 11}; // Initialize the array

print("p[0] = %d\n", p[0]); // Display what p[0] stores

print("p[3] = %d\n", p[3]); // Display what p[3] stores

p[3] = 101; // Assignment

}

...
Continue reading "C Programming Basics: Examples and Explanations" »

Collaborative Study Guide: CSE 12 Complexity, Generics, Data Structures & Algorithms

Computer science64.95 KB

COLLABORATIVE SOLUTIONS FOR PRACTICE PROBLEMS

CSE 12

God help us all

ALL MIGHTY CS LORDS GIVE US MERCY


  • Use the google comment system to ask questions or leave comments on any answer

  • How to use comments: https://support.Google.Com/docs/answer/65129?Hl=en

  • When you write an answer, add the question along with the answer

  • Add an explanation for your answer

  • Always doubt everyone else’s answers until you confirm for yourself they’re correct

____________________________________________________________________________

Complexity Problems



  1. Consider a small array a and large array b. Accessing the first element of a takes more/less/the same amount of time as accessing the first element of b.


A. The same amount of time

B. Less time  

C. More time

Should be the same...

Continue reading "Collaborative Study Guide: CSE 12 Complexity, Generics, Data Structures & Algorithms" »

Understanding SDLC Models and System Analysis Techniques

Computer science94.48 KB

Define SDLC models? What are the most known SDLC model?

An SDLC model defines implementation of an approach to the project. It defines the various processes, and phases that would be carried out throughout the project to produce the desired output. There are a variety of SDLC models that exist catering to different needs and characteristics of a project. Some are of iterative nature (Prototyping), whereas some are sequential (waterfall).

Some of the well-known SDLC models are:
Waterfall model, Software prototyping, Rapid application development,

Extreme programming, and End user development. 

List Advantages of using system analysis and design techniques in approaching computerized info system?

  • Identifies and solves the right problems
  • Implement
...
Continue reading "Understanding SDLC Models and System Analysis Techniques" »

Essential C Programming: Arrays, printf, and scanf

Computer science3.23 KB

Understanding Arrays in Programming

An array is a fundamental data structure in computer programming used to store a collection of elements of the same data type. These elements are stored in contiguous memory locations, meaning they are placed right next to each other in memory. Each element in an array is accessed by its index, which represents its position in the array.

Core Concepts of Arrays

Arrays are widely used because they offer efficient access to elements, as accessing an element by index is a constant-time operation (O(1)). Additionally, arrays allow for storing multiple elements of the same type under a single variable name, making it easier to manage and manipulate collections of data.

C Programming: Array Declaration & Initialization

Declaring

...
Continue reading "Essential C Programming: Arrays, printf, and scanf" »

Internal Transport and Storage Systems in Warehouses

Computer science3.96 KB

Internal transport

Refers to the physical movement of products inside loading/unloading areas, docks, order preparation zones, truck load and any other eventual activity that implies products movements inside the warehouse.

Horizontal transport:

On this type of transport merchandise do not need to be raised to locate in a determined place. (Pallet truck, roller conveyor, conveyor belt system, auto guide transport system).

Vertical transport:

This transport not just allows the product to be transported from one place to another, but also to be raised to locate in a specific place. (Conventional forklift, retractable forklift, trilateral forklift).

Conventional forklift/truck lift (“Toros”)

Could be fixed mast or counterbalance, they need from 3...

Continue reading "Internal Transport and Storage Systems in Warehouses" »

Computer Security Principles and Cryptographic Systems

Computer science29.69 KB

Foundations of Computer Security

The CIA Triad and Security Design Principles

  • Confidentiality: Ensures data is accessible only to authorized entities. It prevents unauthorized disclosure of sensitive information using encryption, access controls, and data masking.
  • Integrity: Guarantees that data remains accurate, complete, and uncorrupted by unauthorized modification or deletion. Maintained using hash functions, checksums, and digital signatures.
  • Availability: Ensures systems, networks, and data remain operational and accessible to authorized users when needed. Protected via hardware redundancy, backups, and DDoS mitigation.
  • Key Design Principles:
    • Least Privilege: Give entities only the minimum permissions necessary to perform their functions.
    • Fail-
...
Continue reading "Computer Security Principles and Cryptographic Systems" »

Understanding Internet Architecture and Network Protocols

Computer science5.8 KB

Internet Fundamentals: A Network of Networks

The Internet is often described as a "network of networks," comprising interconnected Internet Service Providers (ISPs).

Key Components of the Internet

  • Hosts: End Systems for Applications

    Hosts are the end systems (clients & servers) that run applications. They connect at the edge of the Internet.

  • Packet Switches: Forwarding Data

    Packet switches forward data in chunks called packets. These include:

    • Routers: Forward data between different networks.
    • Switches: Operate within the core of the Internet, not at the edge.
  • Communication Links: The Data Pathways

    Communication links connect routers and can be made of:

    • Fiber optic cables
    • Copper wires
    • Radio waves
    • Satellite connections

    The transmission rate of a link is

...
Continue reading "Understanding Internet Architecture and Network Protocols" »

Software Engineering Concepts: A Comprehensive Guide

Computer science7.04 KB

Module 9: Firebase Application

Realtime Database

A cloud-hosted database. Data is stored as JSON and synchronized in real-time to every connected client. Provides easy-to-use services for authentication (email/password, 3rd-party providers like Google/Facebook).

Cloud Firestore

A flexible and scalable database for mobile, web, and development. It offers synchronization, offline support, and ACID transactions.

Cloud Functions

...

Hosting

CSS/JavaScript

Cloud Storage

Provides robust, secure file uploads and downloads for Firebase apps.

Module 10: UML Diagrams

Structural Diagrams

  • Class Diagram: Shows class hierarchy, fields/attributes, and relevant methods.

How to Read

  • Visibility:
    • +: Public
    • -: Private
    • #: Protected (accessed only by child classes)
  • Relationships:
...
Continue reading "Software Engineering Concepts: A Comprehensive Guide" »

Inheritance and Method Overriding in Java: A Comprehensive Guide

Computer science2.3 KB

Inheritance in Java

Inheritance in Java is a mechanism where one object acquires all the properties and behaviors of another object. Inheritance represents the IS-A relationship, also known as a parent-child relationship.

Using inheritance, you can create a general class that defines common traits for a set of related items. This class can then be inherited by other classes, each adding its unique elements.

The keyword extends defines a new class from an existing class. The existing class is called the parent/base/superclass, and the new class is called the child/derived/subclass.

Here's a breakdown:

  • Child classes inherit all members of their parent class.
  • Child classes cannot access the private members of the parent class directly.
  • To access private
...
Continue reading "Inheritance and Method Overriding in Java: A Comprehensive Guide" »

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

Computer science2.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" »