Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

Class 11 Computer Science: JavaScript and HTML5 Essentials

Computer science2.76 KB

Class 11 Computer Science: Exam-Ready JavaScript and HTML5

Here are concise, exam-ready answers for your Class 11 Computer Science Question Bank:

1. What is Client-Side Scripting?

Client-side scripting refers to programs executed on the user's browser (the client) rather than the server. JavaScript is the most common example. It is used to create interactive web pages, validate forms, and reduce server load.

2. How to Declare a Variable in JavaScript

Variables are containers for storing data. In JavaScript, they are declared using three keywords:

  • var: Used in older versions (function-scoped).
  • let: Used for block-scoped variables (recommended).
  • const: Used for variables whose values remain constant.

Example: let name = "Arsh";

3. JavaScript Data Types

JavaScript...

Continue reading "Class 11 Computer Science: JavaScript and HTML5 Essentials" »

JDBC Drivers, JSP Tags, and ResultSet Implementation

Computer science2.86 KB

JDBC Driver Types

Type 1: JDBC-ODBC Bridge

  • Converts JDBC calls to ODBC
  • ❌ Slow, platform dependent, and obsolete

Type 2: Native API Driver

  • Uses database-specific native libraries
  • ⚠️ Faster than Type 1 but platform dependent

Type 3: Network Protocol Driver

  • Uses middleware server to connect
  • 🌐 Platform independent but slower due to network

Type 4: Thin Driver

  • Directly connects to database using pure Java
  • ✅ Fast, platform independent, and most used

Tags in JSP

1. Directive Tags

  • Provide instructions to the JSP container
  • Syntax: <%@ ... %>
  • Example: page, include, taglib

2. Scripting Tags

  • Scriptlet Tag: Write Java code <% ... %>
  • Expression Tag: Display output <%= ... %>
  • Declaration Tag: Declare variables or methods <%! ... %>

3. Action

...
Continue reading "JDBC Drivers, JSP Tags, and ResultSet Implementation" »

Essential Java Programming Concepts and Design Patterns

Computer science237.87 KB

Java File Copy Program

This simple Java program demonstrates how to read data from one file and write it to another.

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileCopy {
    public static void main(String[] args) {
        String sourceFile = "input.txt";
        String destinationFile = "output.txt";
        try {
            FileReader fr = new FileReader(sourceFile);
            FileWriter fw = new FileWriter(destinationFile);
            int character;
            while ((character = fr.read()) != -1) {
                fw.write(character);
            }
            fr.close();
            fw.close();
            System.out.println("File copied successfully.");
        } catch (IOException
...
Continue reading "Essential Java Programming Concepts and Design Patterns" »

C Program for Cinema Hash File Management with Overflow Handling

Computer science6.67 KB

C Program for Hash-Based Cinema File Management

The following C program implements a hash file with buckets and an overflow area for managing cinema screening records.

Source Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define B 7
#define B_SIZE 5
#define F_NAME "bioskop.dat"
#define O_NAME "prekoracenje.dat"

typedef struct{int idp;char naz[65],ozs[4],dvp[20];int brk,tra;char akt;}Slog;
typedef struct{Slog slogovi[B_SIZE];}Baket;

int hash(int idp){return idp%B;}

File Initialization

void inicijalizuj(){
FILE *f=fopen(F_NAME,"wb"); Baket prazan; memset(&prazan,0,sizeof(Baket));
for(int i=0;i<B;i++) fwrite(&prazan,sizeof(Baket),1,f);
fclose(f); f=fopen(O_NAME,"wb"); if(f) fclose(f);
}

Forming the File

...
Continue reading "C Program for Cinema Hash File Management with Overflow Handling" »

Essential C Programming Examples and Algorithms

Computer science72.94 KB

wfSCE5je3rPDgAAAABJRU5ErkJggg==

Leap Year

#include <stdio.h>
int main() {
    int y;
    scanf("%d", &y);
    if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
        printf("Leap Year");
    else
        printf("Not Leap Year");
    return 0;
}

Simple Calculator Using Switch

#include <stdio.h>
int main() {
    char op;
    float a, b;
    scanf(" %c %f %f", &op, &a, &b);
    switch (op) {
        case '+': printf("%.2f", a + b); break;
        case '-': printf("%.2f", a - b); break;
        case '*': printf("%.2f", a * b); break;
        case '/':
            if (b != 0)
                printf("%.2f", a / b);
            else
                printf("Error");
            break;
        default: printf("Invalid Operator");
    }
    return
...
Continue reading "Essential C Programming Examples and Algorithms" »

Computer Architecture and Organization Fundamentals

Computer science94.38 KB

Computer Architecture vs. Computer Organization

Computer ArchitectureComputer Organization
Deals with functional behaviorDeals with structural relationships
Visible to programmer (instruction set, addressing modes)Invisible to programmer (control signals, memory technology)
Describes WHAT the system doesDescribes HOW it is implemented
Example: x86 architectureExample: Intel Core i7 vs. Pentium

IEEE 754 Floating Point Bias

  • Single Precision (32-bit): Bias = 127 (27 - 1)
  • Double Precision (64-bit): Bias = 1023 (210 - 1)

Why Bias is Used

Bias allows storing both positive and negative exponents using only unsigned integers. Instead of storing the actual exponent, we store (exponent + bias), which is always positive. This simplifies the comparison of floating-...

Continue reading "Computer Architecture and Organization Fundamentals" »

Data Structures and Algorithms Practice Problems

Computer science338.98 KB

Q1. Array Address Calculation (Row & Column Major)

Problem: An array ARR[-5...15, 10...20] stores elements in Row Major with each element requiring 2 bytes. Base address is 2500. Find the address of ARR[10][15].

Answer:

  • Row range: -5 to 15, so Lr = -5, Ur = 15
  • Column range: 10 to 20, so Lc = 10, Uc = 20
  • Element size (w) = 2 bytes
  • Base Address (BA) = 2500

Step 1: Calculate dimensions

  • Number of rows (M) = Ur - Lr + 1 = 15 - (-5) + 1 = 21
  • Number of columns (N) = Uc - Lc + 1 = 20 - 10 + 1 = 11

Step 2: Row Major Order Formula

Address(A[i][j]) = BA + [(i - Lr) × N + (j - Lc)] × w
Address(ARR[10][15]) = 2500 + [(10 - (-5)) × 11 + (15 - 10)] × 2
= 2500 + [15 × 11 + 5] × 2
= 2500 + [165 + 5] × 2
= 2500 + 170 × 2 = 2840

Step 3: Column Major Order Formula

Address(...

Continue reading "Data Structures and Algorithms Practice Problems" »

It used to define the member functions of a class outside

Computer science4.48 KB


Features of Java

Java is a popular, high-level programming language known for its simplicity, security, and portability. The major features are:

1. Simple

Java is easy to learn and understand. It removes complex features like pointers, multiple inheritance, and operator overloading found in C/C++.

2. Object-Oriented

Java follows the concepts of OOP such as classes, objects, inheritance, polymorphism, abstraction, and encapsulation, making programs modular and reusable.

3. Platform Independent

Java programs are compiled into bytecode, which can run on any device that has the Java Virtual Machine (JVM). This provides Write Once, Run Anywhere (WORA) capability.

4. Secure

Java provides built-in security through the bytecode verifier, class loader, and security...

Continue reading "It used to define the member functions of a class outside" »

Registro de Películas con Flask y JavaScript

Computer science2.92 KB

Integración de Frontend y Backend para Películas

A continuación, se presenta la implementación técnica para el registro y gestión de películas utilizando JavaScript en el cliente y Flask en el servidor.

Implementación del Cliente con JavaScript

El siguiente bloque de código gestiona la captura de datos del formulario y su envío mediante la Fetch API:

const API_URL = 'http://127.0.0.1:5000';

const formulario = document.getElementById("pelicula_Form");
const tituloInput = document.getElementById("titulo");
const directorInput = document.getElementById("director");
const anioInput = document.getElementById("anio");

formulario.addEventListener("submit", registrar_Pelicula);

async function registrar_Pelicula(event) {
    try {
        const
...
Continue reading "Registro de Películas con Flask y JavaScript" »

Cloud Machine Learning Workflow and Content Delivery Optimization

Computer science3.81 KB

Steps for Training a Machine Learning Project in the Cloud

Definition: Cloud ML Project Training

Training an ML Project in the Cloud means utilizing cloud-based resources and services to build, train, and optimize a Machine Learning model.

The Seven Key Steps in Cloud ML Training

  1. Data Collection: Gather and upload the dataset to cloud storage.
  2. Data Preprocessing: Clean and prepare data using cloud notebooks or specialized processing services.
  3. Model Selection: Choose the appropriate algorithm or utilize a pre-built model architecture.
  4. Training: Use scalable cloud compute resources (GPUs/TPUs) for intensive model training.
  5. Evaluation: Test model accuracy and performance using validation data.
  6. Hyperparameter Tuning: Optimize model parameters for better
...
Continue reading "Cloud Machine Learning Workflow and Content Delivery Optimization" »