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

Database Fundamentals: SQL Queries and Relational Concepts

Computer science99.31 KB

Core Database Concepts and Relational Algebra

Question 1: Cartesian Product Size

Question 1: S is a relation instance. If S has 6 tuples, how many tuples are there in the result of the following SQL query?

SELECT * FROM S S1, S S2;

Answer: 36 (Calculated as 6 * 6, representing the Cartesian product of S with itself.)

Question 2: Maximum Tuples and Primary Keys

Question 2: Let R(A, B, C, D) be a relation, where (A, B, C) is the Primary Key (PK) of R, and attribute D cannot be NULL. Assume A's domain has 5 different values, B's domain has 2, C has 4, and D has 3. What is the maximum number of tuples that can be in an instance of R?

Answer: 40 (Calculated as 5 * 2 * 4. The maximum number of tuples is determined by the product of the domain sizes of the...

Continue reading "Database Fundamentals: SQL Queries and Relational Concepts" »

Understanding the Internet, Web Browsers, and HTML

Computer science1.29 MB

1. What is the Internet?

The Internet is a global communication system connecting millions of computers across the world. It uses the TCP/IP protocol to exchange data, allowing users to access information, communicate, and perform various online activities.

Definition: The Internet is a worldwide network of interconnected computer networks that enables the sharing of information and resources.
History: The Internet originated from ARPANET, developed in 1969 in the USA.

2. Internet Applications

Applications refer to the various ways we utilize the Internet in our daily lives. Key examples include:

  • Communication: Facilitates easy, affordable, and fast interaction.
    • Examples: Sending emails, instant messaging (e.g., WhatsApp), and video calls (e.g., Zoom,
...
Continue reading "Understanding the Internet, Web Browsers, and HTML" »

Relational Database Design and Normalization Essentials

Computer science4.82 KB

Database Management Systems and SDLC

Chapter 1: Introduction to Databases

  • Data: Raw facts like numbers, names, and pictures.
  • TFPS (Traditional File Processing System): The biggest problem was when data changes in one file, it could cause inconsistencies.
  • Cons of TFPS: Data redundancy, limited sharing, long development times, and high maintenance.
  • DBMS (Database Management System): Software used to manage databases.
  • SDLC (Systems Development Life Cycle): Plan, analysis, design, implementation, and maintenance.
  • Prototype: Build a prototype, implement, and improve it over time.

Entity-Relationship (ER) Modeling Concepts

Chapter 2: Database Design and ER Diagrams

  • Entity: A noun, such as a person, place, or thing.
  • Attributes: Descriptions or properties of
...
Continue reading "Relational Database Design and Normalization Essentials" »

Essential Network Packet Filtering Syntax Reference

Computer science12.41 KB

Basic Protocol Filters

Use these filters to quickly isolate traffic based on common protocols:

  • arp (Address Resolution Protocol)
  • dns (Domain Name System)
  • http (Hypertext Transfer Protocol)
  • https (HTTP Secure)
  • icmp (Internet Control Message Protocol)
  • ip (Internet Protocol)
  • ipv6 (Internet Protocol Version 6)
  • ntp (Network Time Protocol)
  • smtp (Simple Mail Transfer Protocol)
  • ftp (File Transfer Protocol)
  • ssh (Secure Shell)
  • tls (Transport Layer Security)
  • udp (User Datagram Protocol)
  • tcp (Transmission Control Protocol)
  • dhcp (Dynamic Host Configuration Protocol)
  • bootp (Bootstrap Protocol)
  • radius (Remote Authentication Dial-In User Service)
  • snmp (Simple Network Management Protocol)
  • kerberos
  • smb (Server Message Block)
  • nbns (NetBIOS Name Service)
  • nbss (NetBIOS Session Service)
...
Continue reading "Essential Network Packet Filtering Syntax Reference" »

Implementing REINFORCE Policy Gradient for CartPole-v1

Computer science3.14 KB

############################### lAB 9 ####################3
import gymnasium as gym
import numpy as np
import tensorflow as tf

# Create the environment
env = gym.Make("CartPole-v1")

# Define a simple neural network model for the policy
model = tf.Keras.Sequential([
    tf.Keras.Layers.Dense(16, activation='relu', input_shape=(env.Observation_space.Shape[0],)),
    tf.Keras.Layers.Dense(env.Action_space.N, activation='softmax')
])

# Define the optimizer
optimizer = tf.Keras.Optimizers.Adam(learning_rate=0.01)

# Function to choose an action based on the current policy
def choose_action(state):
    """
    Chooses an action based on the probabilities output by the policy model.
    Args:
        state (np.Array): The current observation/state from...

Continue reading "Implementing REINFORCE Policy Gradient for CartPole-v1" »

Practical Machine Learning Labs in TensorFlow and PyTorch

Computer science14.76 KB

Lab 1: Basic TensorFlow Computation Graph

This example demonstrates how to define and execute a simple computation graph in TensorFlow using the @tf.function decorator, which converts a Python function into a high-performance TensorFlow graph.

import tensorflow as tf

# Define a simple computation graph
@tf.function  # Converts Python function into a TensorFlow graph
def my_graph(x, y):
  return x * y + 5  # Simple equation: (x * y) + 5

# Create TensorFlow constants (nodes)
x = tf.constant(3.0)
y = tf.constant(4.0)

# Run the computation graph
result = my_graph(x, y)

# Print the result
# Convert tensor to a NumPy array to see the value
print(f"Result of (x * y) + 5: {result.numpy()}")

Lab 2: Simple Linear Regression with Keras

Here, we build,...

Continue reading "Practical Machine Learning Labs in TensorFlow and PyTorch" »

C Programming Concepts: Arrays, Functions, Structures, and Stacks

Computer science300.77 KB

1. Arrays: Definition, Types, and Implementation

An array is a collection of elements of the same data type stored in contiguous memory locations. It is used to store multiple values in a single variable and can be accessed using index numbers. The indexing in an array starts from 0. Arrays help manage and process data efficiently, especially when dealing with large volumes of similar data.

Types of Arrays Based on Dimensions

  • One-Dimensional Array: It stores data in a linear list format.
  • Multi-Dimensional Array: It stores data in matrix form (like 2D, 3D arrays), which is useful in applications like image processing and tables.

Types of Arrays Based on Memory Allocation

  1. Static Array:

    The size of the array is fixed at compile-time. Memory is allocated

...
Continue reading "C Programming Concepts: Arrays, Functions, Structures, and Stacks" »

Business Information Systems and Computer Applications Study

Computer science25.92 KB

Information Systems and Business Importance

Q1. Explain the various information systems. Briefly explain the importance of Information System for business. (20 Marks)

Information Systems (IS) are structured combinations of people, hardware, software, networks, and data resources that collect, transform, and disseminate information in an organization. These systems help businesses in decision-making, coordination, control, analysis, and visualization of information.

Types of Information Systems

  • Transaction Processing System (TPS): TPS is used to record day-to-day transactions like sales, receipts, cash deposits, payroll, etc. It is crucial for the functioning of operational-level employees. For example, a billing system at a retail store is a TPS.
...
Continue reading "Business Information Systems and Computer Applications Study" »

Core Data Transmission and Processing Concepts

Computer science2.75 KB

Packet Switching Fundamentals

Packet switching is a method used in computer networks to transmit data efficiently by breaking it into smaller units called packets. Each packet travels independently across the network and may take different routes to reach the destination. Once all packets arrive, they’re reassembled into the original message.

How Packet Switching Works

  1. Segmentation: The original message is divided into packets.
  2. Header Information: Each packet receives a header with source, destination, and sequencing information.
  3. Independent Routing: Packets are sent through the network, possibly via different paths.
  4. Reassembly: At the destination, packets are reordered and combined to form the original message.

Advantages of Packet Switching

  • Efficient
...
Continue reading "Core Data Transmission and Processing Concepts" »

Graph Theory Fundamentals

Computer science3.51 KB

  • Graph (G): A pair (V, E) where V is a set of vertices and E is a set of edges connecting pairs of vertices.
  • Types of Graphs:
    • Simple Graph: No loops or multiple edges.
    • Multigraph: Multiple edges allowed.
    • Directed Graph (Digraph): Edges have directions.
    • Weighted Graph: Edges have weights.

Understanding Subgraphs

  • Subgraph: A graph H is a subgraph of G if V(H) ⊆ V(G) and E(H) ⊆ E(G).
  • Induced Subgraph: Formed by a subset of vertices and all edges between them in G.

Fundamental Graph Properties

  • Order: Number of vertices (|V|).
  • Size: Number of edges (|E|).
  • Degree: Number of edges incident to a vertex.

Common Graph Examples

  • Complete Graph (Kn): Every pair of vertices is connected.
  • Cycle Graph (Cn): Forms a closed loop.
  • Path Graph (Pn): A sequence of vertices connected
...
Continue reading "Graph Theory Fundamentals" »