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

Sort by
Subject
Level

Database Management Systems and ERD Fundamentals

Posted by Anonymous and classified in Computers

Written on in with a size of 36.02 KB

Introduction to Database Management Systems

A database is a structured collection of data stored on a computer system. It is managed using a Database Management System (DBMS), which provides the necessary tools for data storage, retrieval, and modification.

Core Benefits of Using a DBMS

  • Reduced Data Redundancy: A DBMS helps minimize repeated data through organizational rules such as normalization.
  • Enhanced Data Accuracy: The system uses specific rules, such as referential integrity, to maintain data consistency.
  • Support for Multiple Users: Many people can access and use the database simultaneously without encountering operational problems.

Centralized vs. Distributed Databases

  • Centralized: All data is stored in a single, primary location. This setup
... Continue reading "Database Management Systems and ERD Fundamentals" »

Grammar Analysis and Context-Free Language Exercises

Posted by Anonymous and classified in Computers

Written on in with a size of 4.14 KB

Hexadecimal Integer Grammar Analysis

Consider the following grammar for hexadecimal integers:

  • <hex literal> ::= 0x<number>
  • <number> ::= <number><number> | <digit>
  • <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F

The string 0xF3 is an element of the language generated by this grammar.

Derivation Sequences and Parse Trees

1. How many distinct derivation sequences exist for this string?

There exist 6 distinct derivation sequences:

  • <hex literal> ⇒ 0x<number> ⇒ 0x<number><number> ⇒ 0x<digit><number> ⇒ 0x<digit><digit> ⇒ 0xF<digit> ⇒ 0xF3
  • <hex literal> ⇒ 0x<number> ⇒ 0x<number><number> ⇒ 0x<number&
... Continue reading "Grammar Analysis and Context-Free Language Exercises" »

Client-Side Web Application Development Examples

Classified in Computers

Written on in with a size of 8.49 KB

Client-Side Web Application Logic

Course Registration Script

This script handles the client-side logic for a course registration form. It fetches available courses, populates a selection dropdown, and processes form submissions to register new entries via an API.

DOM Element Selection and Initialization

The script begins by selecting necessary DOM elements for interaction and notification display.

const init = async function () {
  const selectEl = document.querySelector("select");
  const formEl = document.querySelector("form");
  const notifEl = document.querySelector(".success-notif");
  const errNotifEl = document.querySelector(".fail-notif");

Notification Dismissal Logic

Functionality to close success and error notification boxes is implemented

... Continue reading "Client-Side Web Application Development Examples" »

C++ Code Examples: Essential Algorithms & Programs

Classified in Computers

Written on in with a size of 5.54 KB

C++ Code Examples: Essential Algorithms & Programs

Here are some fundamental C++ code examples covering various algorithms and programming concepts:

Factorial Calculation

#include <iostream>
using namespace std;

long factorial(int x) {
 int i, f = 1;
 for (i = 1; i <= x; i++) {
 f = f * i;
 }
 return f;
}

int main() {
 int n;
 cout << "Enter the number: ";
 cin >> n;
 if (n < 0) {
 cout << "Factorial is not defined for negative numbers";
 } else {
 cout << "Factorial = " << factorial(n);
 }
 return 0;
}

String Length Finder

#include <iostream>
using namespace std;

int main() {
 int length = 0, i;
 char s[20];
 cout << "Enter the string: ";
 cin.getline(s, 20);
 for (i = 0; s[i] != '\0'
... Continue reading "C++ Code Examples: Essential Algorithms & Programs" »

Database Fundamentals: Normalization, Storage, and SQL Queries

Classified in Computers

Written on in with a size of 4.08 KB

This document summarizes key concepts and solutions from previous database exam questions.


Relational Schema with Functional Dependencies

  • Schema: R(A, B, C, D, E, F)
  • Dependencies: C → F, E → A, EC → D, A → B
  1. Candidate Keys: CE
  2. Prime Attributes: C, E
  3. Second Normal Form (2NF):
    • No, because of partial dependencies:
      • C → F (partial dependency)
      • E → A, B (partial dependency)

EMP_DEPT Table Analysis

  1. Functional Dependencies:
    • Ssn → Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn
    • Dnumber → Dname, Dmgr_ssn
    • Dmgr_ssn → Dnumber, Dname
    • Dname → Dnumber, Dmgr_ssn
  2. First Normal Form (1NF):
    • Split names into first_name and last_name.
  3. Second Normal Form (2NF):
    • Already in 2NF because there are no partial dependencies.

EMP_PROJ Table Normalization

  1. Functional Dependencies:
... Continue reading "Database Fundamentals: Normalization, Storage, and SQL Queries" »

React Hooks & Redux: Essential Concepts for Developers

Posted by Anonymous and classified in Computers

Written on in with a size of 10.31 KB

React Hooks and Essential Libraries

useState Hook

Purpose

Purpose: Adds state to functional components.

Import

import { useState } from 'react';

Syntax

const [state, setState] = useState(initialValue);

Update Methods

  • setState(newValue);
  • setState(prevState => ...); (for updates based on previous state)

Example

import React, { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}

useEffect Hook

Purpose

Purpose: Performs side effects such as data fetching, subscriptions, or direct DOM manipulations.

Import

import { useEffect } from 'react';

Syntax

useEffect(
... Continue reading "React Hooks & Redux: Essential Concepts for Developers" »

Find the Largest Number and Calculate Factorial in C++

Classified in Computers

Written on in with a size of 2.11 KB

Input three numbers and find the largest. Enter a number and display the day name of the week.
#include
#include
using namespace std;
using namespace std;
int main() {
int num1, num2, num3;
int day;
cout << "Enter three numbers: ";
cout << "Enter a number (From 1 to 7): ";
cin >> num1 >> num2 >> num3;
cin >> day;
if (num1 > num2 && num1 > num3) {
cout << "Largest number is " << num1;
} else if (num2 > num3) {
cout << "Largest number is " << num2;
} else {
cout << "Largest number is " << num3;
}
switch (day) {
case 1: cout << "Sunday"; break;
case 2: cout << "Monday"; break;
... Continue reading "Find the Largest Number and Calculate Factorial in C++" »

Practical Machine Learning Labs in TensorFlow and PyTorch

Posted by Anonymous and classified in Computers

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

Python Django Project Setup and Database Integration

Classified in Computers

Written on in with a size of 4.14 KB

Python Django Project Setup

Follow these steps to initialize and configure your Python Django environment.

Initial Environment Navigation

  • Step 1: Open the Command Prompt and use cd.. to navigate back.
  • Step 2: Use cd.. again to reach the desired root.
  • Step 3: Navigate to your Python directory: cd Raj_Python.
  • Step 4: Enter your project folder: cd mscit_dproject.

Creating the Project and Application

  • Step 5: Create the project: django-admin startproject [Project Name].
  • Step 6: Navigate into the project folder: cd [Project Name].
  • Step 7: Create a new application: python manage.py startapp [App Name].
  • Step 8: Open the project in VS Code and configure settings.py.

Configuring settings.py

In settings.py, import the OS module and define your template directory:

import

... Continue reading "Python Django Project Setup and Database Integration" »

Bootstrap Components: Navigation Tabs, Tables, and Forms

Classified in Computers

Written on in with a size of 2.78 KB

Corrected Exam

<!DOCTYPE html>

Images and Table with Nav Tabs

Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus deserunt natus est et, incidunt id quasi ex veniam tenetur quibusdam optio dolor rem dicta officia voluptate nemo rerum quod amet.

Data Table

#NameAgeCountry
1Alice25USA
2Bob30UK
3Charlie28Canada

Alert Notification

Hello! This is an alert that can be closed by clicking on the "X" button.

<!DOCTYPE html>

Document

Form Section

Text Input
Select Option Choose... Option 1 Option 2 Option 3 Option 4
Accept Terms

Send

Grid

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Assumenda autem culpa dolorum dolorem voluptatum quisquam ipsam quia quae libero rerum aut pariatur saepe quaerat doloribus... Continue reading "Bootstrap Components: Navigation Tabs, Tables, and Forms" »