XmonoCodes • Learn / Build / Grow

CREATIVITY
MEETS CODE.

Practical knowledge for students, developers and curious builders — from programming and web development to projects, notes and real-world problem solving.

  • “Learn something useful every day.”
  • “Build ideas into real projects.”
  • “Understand the why, not just the how.”
  • “Keep experimenting. Keep improving.”

Latest from XmonoCodes

Explore tutorials, notes, projects, syllabus material and practical coding content.

Wednesday, October 16, 2024

DSA assignment

 Define Data structure and also write down the difference between primitive and non-primitive data structure.

What is an algorithm? Distinguish between a program and an algorithm.

Implement an array in C, supporting insertion at the

beginning

at the specific position

Define the complexity of an algorithm. Also explain time and space complexity in detail.

Write a program in C to implement Bubble sort in a one-dimensional array.

Explain the Asymptotic Notation.

What do you mean by best, worst and average case analysis of an algorithm?

Codes for lab

 Bubble sort..


// C program for implementation of Bubble sort

#include <stdio.h>


void swap(int* arr, int i, int j) {

    int temp = arr[i];

    arr[i] = arr[j];

    arr[j] = temp;

}


void bubbleSort(int arr[], int n) {

    for (int i = 0; i < n - 1; i++) {

      

        // Last i elements are already in place, so the loop

        // will only num n - i - 1 times

        for (int j = 0; j < n - i - 1; j++) {

            if (arr[j] > arr[j + 1])

                swap(arr, j, j + 1);

        }

    }

}


int main() {

    int arr[] = { 6, 0, 3, 5 };

    int n = sizeof(arr) / sizeof(arr[0]);


    // Calling bubble sort on array arr

    bubbleSort(arr, n);


    for (int i = 0; i < n; i++)

        printf("%d

 ", arr[i]);


    return 0;

}






Insertion short 


// C++ program for implementation of Insertion Sort

#include <iostream>

using namespace std;


/* Function to sort array using insertion sort */

void insertionSort(int arr[], int n)

{

    for (int i = 1; i < n; ++i) {

        int key = arr[i];

        int j = i - 1;


        /* Move elements of arr[0..i-1], that are

           greater than key, to one position ahead

           of their current position */

        while (j >= 0 && arr[j] > key) {

            arr[j + 1] = arr[j];

            j = j - 1;

        }

        arr[j + 1] = key;

    }

}


/* A utility function to print array of size n */

void printArray(int arr[], int n)

{

    for (int i = 0; i < n; ++i)

        cout << arr[i] << " ";

    cout << endl;

}


// Driver method

int main()

{

    int arr[] = { 12, 11, 13, 5, 6 };

    int n = sizeof(arr) / sizeof(arr[0]);


    insertionSort(arr, n);

    printArray(arr, n);


    return 0;

}





Selection short


// C++ program to implement Selection Sort

#include <bits/stdc++.h>

using namespace std;


void selectionSort(vector<int> &arr) {

    int n = arr.size();


    for (int i = 0; i < n - 1; ++i) {


        // Assume the current position holds

        // the minimum element

        int min_idx = i;


        // Iterate through the unsorted portion

        // to find the actual minimum

        for (int j = i + 1; j < n; ++j) {

            if (arr[j] < arr[min_idx]) {


                // Update min_idx if a smaller

                // element is found

                min_idx = j; 

            }

        }


        // Move minimum element to its

        // correct position

        swap(arr[i], arr[min_idx]);

    }

}


void printArray(vector<int> &arr) {

    for (int &val : arr) {

        cout << val << " ";

    }

    cout << endl;

}


int main() {

    vector<int> arr = {64, 25, 12, 22, 11};


    cout << "Original array: ";

    printArray(arr); 


    selectionSort(arr);


    cout << "Sorted ar

ray: ";

    printArray(arr);


    return 0;

}




Inserting a particular element at a particular position in an array.

#include <iostream>

using namespace std;


int main() {

    int size, element, position;


    // Enter the size of the array

    cout << "Enter the size of the array: ";

    cin >> size;


    int arr[size + 1]; // Array with an extra space for the new element


    // Input the elements of the array

    cout << "Enter the elements of the array:\n";

    for(int i = 0; i < size; i++) {

        cin >> arr[i];

    }


    // Enter the element to be inserted and the position

    cout << "Enter the element to be inserted: ";

    cin >> element;

    cout << "Enter the position to insert the element (0-based index): ";

    cin >> position;


    // Check if the position is valid

    if(position < 0 || position > size) {

        cout << "Invalid position!" << endl;

        return 1;

    }


    // Shift elements to the right

    for(int i = size; i > position; i--) {

        arr[i] = arr[i - 1];

    }


    // Insert the element at the given position

    arr[position] = element;


    // Display the updated array

    cout << "Array after insertion:\n";

    for(int i = 0; i <= size; i++) {

        cout << arr[i] << " ";


    }

    cout << endl;


    return 0;

}





Deletion at a particular position in an array.


#include <iostream>

using namespace std;


int main() {

    int size, position;


    // Enter the size of the array

    cout << "Enter the size of the array: ";

    cin >> size;


    int arr[size]; // Array with the specified size


    // Input the elements of the array

    cout << "Enter the elements of the array:\n";

    for(int i = 0; i < size; i++) {

        cin >> arr[i];

    }


    // Enter the position to delete the element

    cout << "Enter the position to delete the element (0-based index): ";

    cin >> position;


    // Check if the position is valid

    if(position < 0 || position >= size) {

        cout << "Invalid position!" << endl;

        return 1;

    }


    // Shift elements to the left from the position specified

    for(int i = position; i < size - 1; i++) {

        arr[i] = arr[i + 1];

    }


    // Display the updated array

    cout << "Array after deletion:\n";

    for(int i = 0; i < size - 1; i++) {

        cout << arr[i] << " ";

   

 }

    cout << endl;


    return 0;

}



Sunday, October 13, 2024

BCS302: Computer Organization & Architecture

                BCS302: Computer Organization & Architecture


___________________________________________________________________________________

UNIT 1:


Introduction: 

Functional units of digital system and their interconnections, 

buses, 

bus architecture, 

types of buses 

and bus arbitration. 

Register, 

bus and memory transfer. 

Processor organization, 

general registers organization, 

stack organization 

and addressing modes


___________________________________________________________________________________


                                                                  UNIT 2:


Arithmetic and logic unit: 

Look ahead carries adders. 

Multiplication: 

Signed operand multiplication, 

Booths algorithm and array multiplier. 

Division and logic operations. 

Floating point arithmetic operation, 

Arithmetic & logic unit design. 

IEEE Standard for Floating Point Numbers


___________________________________________________________________________________


                                                                  UNIT 3:


Control Unit: 

Instruction types, 

formats, 

instruction cycles 

and sub cycles (fetch and execute etc), 

micro operations, 

execution of a complete instruction. 

Program Control, 

Reduced Instruction Set Computer, 

Pipelining. 

Hardwire and micro programmed control: 

micro programme sequencing, 

concept of horizontal and 

vertical microprogramming


___________________________________________________________________________________


                                                                  UNIT 4:


Memory: 

Basic concept and hierarchy, 

semiconductor RAM memories, 

2D & 2 1/2D memory organization. 

ROM memories. 


Cache memories: 

concept and design issues & performance, 

address mapping 

and replacement Auxiliary memories: 

magnetic disk, 

magnetic tape and optical disks 


Virtual memory: concept implementation.


___________________________________________________________________________________


                                                                  UNIT 5:


Input / Output: 

Peripheral devices, 

I/O interface, 

I/O ports, 


Interrupts: 

interrupt hardware, 

types of interrupts and exceptions. 


Modes of Data Transfer: 

Programmed I/O, 

interrupt initiated I/O and Direct Memory Access., 

I/O channels and processors. 


Serial Communication: 

Synchronous & asynchronous communication, 

standard communication interfaces. 



-------------------------------------------------------------------------------------------------------------------


BOE310: Digital Electronics

  BOE310: Digital Electronics


___________________________________________________________________________________

UNIT 1:


Digital System And Binary Numbers: 

Number System and its arithmetic Signed binary numbers, 

Logic simplification and combinational logic design: 

Binary codes, 

code conversion, 

review of Boolean algebra and Demorgans theorem, 

SOP & POS forms, 

Canonical forms, 

Karnaugh maps method up to five variable, 

Don't care conditions, 

POS simplification, 

NAND and NOR implementation, 

Quine McClusky method (Tabular method).


-------------------------------------------------------------------------------------------------------------------

UNIT 2:


Combinational Logic: 

MSI devices like Magnitude comparator, 

Multiplexers, Demultiplexers, 

Decoders, 

Encoders.  

Multiplexed display, 

half and full adders, 

subtractors, 

serial and parallel adders, 

BCD adder


-------------------------------------------------------------------------------------------------------------------

UNIT 3:


Sequential Logic And Its Applications: 

Storage elements: 

latches & flip flops, 

Characteristic Equations of Flip Flops, 

Flip Flop Conversion, 

Shift Registers, 

Ripple Counters, 

Synchronous Counters, 

Other Counters: 

Johnson & Ring Counter.


-------------------------------------------------------------------------------------------------------------------

UNIT 4:


Synchronous & Asynchronous Sequential Circuits: 

Analysis of clocked sequential circuits with state machine designing, 

State reduction and assignments, 

Design procedure. 

Analysis procedure of Asynchronous sequential circuits, 

circuit with latches, 

Design procedure, 

Reduction of state and flow table, 

Race-free state assignment, 

Hazards.


-------------------------------------------------------------------------------------------------------------------

UNIT 5:


Memory & Programmable Logic Devices: 

Digital Logic Families: 

DTL, 

DCTL, 

TTL, 

ECL & CMOS etc., 

Fan Out, 

Fan in, 

Noise Margin; 

RAM, 

ROM, 

PLA, 

PAL; 

Circuits of Logic Families, 

Interfacing of Digital Logic Families, 

Circuit Implementation using ROM, PLA and PAL


BCC301: Cyber Security

 BCC301: Cyber Security


___________________________________________________________________________________

UNIT 1:



Introduction to Cyber Crime:

Cybercrime Definition 

Origins of the word Cybercrime and Information Security, 

Who are Cybercriminals? 

Classifications of Cybercrimes, 

A Global Perspective on Cybercrimes, 



Cybercrime Era

Survival Mantra for the Netizens. 



Cyber offenses: 

How Criminals Plan the Attacks, 

Social Engineering, 

Cyber stalking, 

Cybercafe and Cybercrimes, 



Botnets: 

The Fuel for Cybercrime, 

Attack Vector. 


___________________________________________________________________________________



                                                                   UNIT 2:



to be continued...

BCS301: Data Structure

 BCS301: Data Structure


___________________________________________________________________________________

UNIT 1:


Introduction: 

Basic Terminology, 

Elementary Data Organization, 

Built in Data Types in C. 

Algorithm, 

Efficiency of an Algorithm, 

Time and Space Complexity, 



Asymptotic notations: 

Big Oh, Big Theta and Big Omega, 

Time-Space trade-off. 

Abstract Data Types (ADT) 



 Arrays: 

Definition, 

Single and Multidimensional Arrays, 



Representation of Arrays: 

Row Major Order, and Column Major Order, 

Derivation of Index Formulae for 1-D,2-D,3-D and n-D Array Application of arrays, 

Sparse Matrices and their representations. 



Linked lists: 

Array Implementation and 

Pointer Implementation of Singly Linked Lists, 

Doubly Linked List, 

Circularly Linked List, 

Operations on a Linked List. 

Insertion, 

Deletion, 

Traversal, 

Polynomial Representation 

and Addition Subtraction & 

Multiplications of Single variable 

& Two variables Polynomial.  


___________________________________________________________________________________



                                                                   UNIT 2:



to be continued...

Second year syllabus

 Second year syllabus


BCS301: Data Structure View

BCC301: Cyber Security View

BOE310: Digital Electronics View

BCS303: Discrete Structures & Theory of Logic 

BCS302: Computer Organization and Architecture View

BVE301: Universal Human Value and Professional Ethics 

Monday, October 7, 2024

Assignment 2 web design

 1.Create a simple HTML table to display a schedule for a week. Include columns

for Day, Time, and Activity.

2. Design a simple personal web page that includes your name, a brief bio, and

links to your favorite websites. Use appropriate HTML tags to structure your

content.

3. Design a table using various attributes such as colspan, rowspan, and border.

Explain how each attribute modifies the table layout.

4. Create a marquee that displays a scrolling list of links. Make sure each link

navigates to a different webpage when clicked.

5. Experiment with the <marquee> tag by applying different styles (e.g., font

size, background color, padding) to the scrolling text. Discuss how these styles

enhance readability.

6. Design a webpage with a nested marquee (a marquee inside another

marquee). Discuss potential use cases for this design.

Assignment Web design.


Create a simple HTML document that includes a title, a heading, and a 

paragraph about your favorite hobby. Ensure you follow the correct HTML 

document structure.


 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>My Favorite Hobby</title>

</head>

<body>

    <h1>Photography</h1>

    <p>Photography allows me to capture moments and see the world from different perspectives. I love experimenting with different angles, lighting, and techniques to bring out the beauty in everyday scenes. It’s a creative outlet that brings me joy and helps me appreciate the little details around me.</p>

</bod

y>

</html>



Create a webpage that includes at least five paragraphs. Each paragraph

should discuss a different aspect of a single topic (e.g., your favorite season).


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>My Favorite Season: Autumn</title>

</head>

<body>

    <h1>Why I Love Autumn</h1>

    

    <p><strong>The Colors of Fall:</strong> One of the most breathtaking aspects of autumn is the transformation of leaves. The vibrant reds, oranges, and yellows bring the landscape to life, creating a warm and inviting atmosphere.</p>


    <p><strong>Cooler Weather:</strong> After the hot summer days, autumn brings a refreshing change with cooler temperatures. It’s the perfect weather for cozy sweaters, warm drinks, and outdoor walks without the intense heat.</p>

    

    <p><strong>Seasonal Foods:</strong> Autumn is synonymous with harvest season. I love enjoying fresh apples, pumpkins, and other seasonal produce. Plus, who can resist a slice of pumpkin pie or a cup of hot apple cider?</p>


    <p><strong>Festivals and Holidays:</strong> Autumn is filled with festive activities. From Halloween to Thanksgiving, there’s always something to look forward to. I enjoy decorating, spending time with family, and celebrating the traditions that make these holidays special.</p>


    <p><strong>The Cozy Atmosphere:</strong> Autumn brings a sense of comfort and coziness. Whether it's curling up with a good book, lighting a scented candle, or enjoying the warmth of a fire, this season creates the perfect setting for relaxation.</p>

 

   

</body>

</html>


Construct a webpage that uses nested headings to outline a topic (e.g.,

"Healthy Eating"). Use <h2> for main sections and <h3> for subsections.


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Healthy Eating Guide</title>

</head>

<body>

    <h1>Healthy Eating Guide</h1>

    

    <h2>Importance of a Balanced Diet</h2>

    <p>A balanced diet provides the nutrients your body needs to function correctly. It can help you maintain a healthy weight, reduce the risk of chronic diseases, and promote overall well-being.</p>

    

    <h2>Essential Nutrients</h2>

    

    <h3>Carbohydrates</h3>

    <p>Carbohydrates are the body’s main source of energy. They should come primarily from whole grains, fruits, and vegetables rather than refined sugars and processed foods.</p>

    

    <h3>Proteins</h3>

    <p>Proteins are essential for building and repairing tissues. Good sources include lean meats, dairy products, legumes, and nuts.</p>

    

    <h3>Fats</h3>

    <p>Fats are a necessary part of a healthy diet, especially unsaturated fats from sources like olive oil, avocados, and fish. However, it's important to limit saturated and trans fats.</p>

    

    <h2>Healthy Eating Tips</h2>

    

    <h3>Portion Control</h3>

    <p>Eating appropriate portion sizes can help you avoid overeating and manage your weight. Try to use smaller plates, and be mindful of your hunger and fullness cues.</p>

    

    <h3>Stay Hydrated</h3>

    <p>Drinking enough water is vital for overall health. It aids in digestion, keeps your skin healthy, and helps regulate body temperature.</p>

    

    <h2>Meal Planning and Preparation</h2>

    

    <h3>Planning Balanced Meals</h3>

    <p>Planning your meals ahead of time can help you make healthier choices and avoid last-minute fast food. Aim to include a variety of food groups in each meal.</p>

    

    <h3>Healthy Snacks</h3>

    <p>Opt for nutritious snacks such as fruits, nuts, or yogurt. These can help keep your energy levels steady throughout the day.</p>

    

</body>

</html>


Write an HTML page that includes an unordered list of five of your favorite

movies and an ordered list of three reasons why you like each movie.


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>My Favorite Movies</title>

</head>

<body>

    <h1>My Favorite Movies</h1>

    

    <ul>

        <li>

            <strong>Inception</strong>

            <ol>

                <li>Intriguing plot with complex layers of dreams.</li>

                <li>Excellent cast led by Leonardo DiCaprio.</li>

                <li>Stunning visuals and impressive special effects.</li>

            </ol>

        </li>

        

        <li>

            <strong>The Shawshank Redemption</strong>

            <ol>

                <li>Inspiring story about hope and friendship.</li>

                <li>Brilliant performances by Morgan Freeman and Tim Robbins.</li>

                <li>Thought-provoking themes and memorable quotes.</li>

            </ol>

        </li>

        

        <li>

            <strong>The Dark Knight</strong>

            <ol>

                <li>Heath Ledger’s iconic performance as the Joker.</li>

                <li>Gripping storyline with deep moral dilemmas.</li>

                <li>Outstanding action sequences and cinematography.</li>

            </ol>

        </li>

        

        <li>

            <strong>Interstellar</strong>

            <ol>

                <li>Fascinating exploration of space and time.</li>

                <li>Emotional story about love and sacrifice.</li>

                <li>Impressive visual effects and Hans Zimmer’s powerful soundtrack.</li>

            </ol>

        </li>

        

        <li>

            <strong>Forrest Gump</strong>

            <ol>

                <li>Heartwarming story with a unique perspective on life.</li>

                <li>Tom Hanks’ unforgettable portrayal of Forrest.</li>

                <li>Captures major historical events in a touching way.</li>

         

   </ol>

        </li>

    </ul>

    

</body>

</html>


Write an HTML document that features an ordered list of your top five favorite

books. For each book, provide a brief summary in a nested paragraph below

the list item.


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>My Favorite Books</title>

</head>

<body>

    <h1>My Top 5 Favorite Books</h1>

    

    <ol>

        <li>

            <strong>To Kill a Mockingbird</strong>

            <p>This classic novel by Harper Lee explores themes of racial injustice and moral growth in the American South. It follows young Scout Finch as she learns about empathy, courage, and human decency through her father, Atticus Finch, who defends a Black man unjustly accused of a crime.</p>

        </li>

        

        <li>

            <strong>1984</strong>

            <p>Written by George Orwell, this dystopian novel delves into a totalitarian society where the government watches every move. The story follows Winston Smith as he navigates life under an oppressive regime, exploring themes of freedom, individuality, and truth.</p>

        </li>

        

        <li>

            <strong>Pride and Prejudice</strong>

            <p>Jane Austen’s classic novel is a witty and insightful commentary on society, class, and relationships in 19th-century England. It tells the story of Elizabeth Bennet and her evolving relationship with the enigmatic Mr. Darcy, highlighting themes of love, pride, and social expectations.</p>

        </li>

        

        <li>

            <strong>The Great Gatsby</strong>

            <p>F. Scott Fitzgerald’s novel paints a vivid picture of the Jazz Age and the American Dream through the eyes of Nick Carraway. The story follows Jay Gatsby, a mysterious millionaire, as he pursues wealth and romance in a world filled with extravagance and moral decay.</p>

        </li>

        

        <li>

            <strong>Harry Potter and the Philosopher's Stone</strong>

            <p>This beloved fantasy novel by J.K. Rowling introduces readers to the magical world of Hogwarts. It follows young Harry Potter as he discovers he’s a wizard, makes new friends, and begins an epic journey to confront dark forces that threaten the wizarding world.</p>

        </li>

    </ol>

    

</body>

</html>


Write HTML code for following list-

1. Coffee

2. Tea

a. Black tea

b. Green tea

3. Milk


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Beverage List</title>

</head>

<body>

    <h1>Beverages</h1>

    

    <ol>

        <li>Coffee</li>

        <li>Tea

            <ol type="a">

                <li>Black tea</li>

                <li>Green tea</li>

            </ol>

        </li>

        <li>Milk</li>

    </ol>


    

</body>

</html>