Algorithms and Bubble Sort in Computer Programming, Exercises of Assembly Language Programming

The fundamental role of algorithms in computer science and mathematics, providing an example of the euclidean algorithm for finding the greatest common factor of two integers. It then focuses on a specific problem of arranging students by grade in ascending order, and presents the bubble sort algorithm as a solution. The input and output of the problem, how the problem is solved using a c# console application, and the key stages of the software development life cycle (sdlc). It also explains the process of compiling and running source code, including the conversion of high-level code into cil (common intermediate language) and the role of the common language runtime (clr) in executing the code. This comprehensive coverage of algorithms, programming concepts, and software development practices makes the document a valuable resource for students and professionals interested in computer science and programming.

Typology: Exercises

2021/2022

Uploaded on 08/25/2023

trung-djinh
trung-djinh 🇻🇳

9 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
31/07/2023
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Dinh Viet Trung
Student ID
GCH210582
Class
GCH1109RE
Assessor name
Pham Danh Tuyen
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Trung
Grading grid
P1
M1
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Algorithms and Bubble Sort in Computer Programming and more Exercises Assembly Language Programming in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date 31/07/2023 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Dinh Viet Trung Student ID GCH Class GCH1109RE Assessor name Pham Danh Tuyen Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Trung Grading grid P1 M1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

I. State a simple business problem to be solved

1. What is algorithm?

Algorithms are step-by-step procedures or instructions used to solve specific problems or perform tasks. In computer science and mathematics, algorithms play a fundamental role in designing efficient and effective solutions for various computational and real-world problems. They serve as a blueprint or a set of rules that guide the execution of a task to achieve a desired outcome. In mathematics and computer science, an algorithm is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing calculations and data processing. More advanced algorithms can use conditionals to divert the code execution through various routes (referred to as automated decision-making) and deduce valid inferences (referred to as automated reasoning), achieving automation eventually (base on information from Wikipedia). For example:

Figure 1: Algorithm flowchart example The Euclidean algorithm's flow chart for finding the greatest common factor (g.c.f.) of two integers, a and b, is shown in places A and B. The method moves via two loops of sequential subtraction: The algorithm defines B B A (which means the number b a replaces the previous b). If the test B A returns "yes" or "true" (more precisely, the number b in location B is larger than or equal to the number an in location A),

II. Analyze the problem and design the solutions by the use of suitable methods

1. Analyze the problem

 Input:  Number of students  Name and grade  Output:  Student list with Name and Grade  The following variables are utilized in the program:  Int n: number of students to insert  Double array grade: store grades of students  String array name: store student’s names  Structures:  While loop  For loop  If/else

2. Flowchart of the algorithm

Figure 3: Flowchart of the program III. Demonstrate the compilation and running of a program

Figure 6: Source code  The program will execute a for loop based on the number of students to be added, and will add student names/grades entered by the user to the two arrays generated above. Figure 7: Source code  The bubble sort method will be conducted by the software using two for loops. The IF structures are used to determine whether the grade in the next index is lower than the one with the current index value. If true, it will swap the values of two grades, and so on. I must exchange the name as well as the grade so that the student name and grade pair remain consistent. I utilize tempGrade and tempName variables to temporarily hold the data during the switching operation. Figure 8: Source code  It will simply display the list by running through the arrays with a for loop. Figure 9: Source code  Program running:

Figure 10 : Program running

3. What is Software Development Life Cycle and how the source code is

compiled and run

a. Software Development Life Cycle (SDLC)  SDLC, or Software Development Life Cycle, is a technique for producing software with the greatest quality and lowest cost in the shortest amount of time. SDLC provides a well-structured sequence of stages that enables an organization to swiftly deliver high-quality software that has been thoroughly tested and is suitable for production usage.

displays the overall form of the system, and then you can move on to creating low-fidelity wireframes. The design stage aids in the creation of the general architecture of the system as well as the selection of technologies and programming languages for project development. Furthermore, knowing how the system will seem and work assists you to define hardware and system requirements. In general, everything is spelled out in a particular document called the Design Specification Document (DSD).  Implementation: Following the approval of the product requirements and design, the lifecycle moves on to the following stage: implementation or creation of functional end. Based on previously generated documentation (SRS), we begin coding here. As a result, this SDLC level is the most time- consuming. If hardware is involved, this step also includes setting and tuning the equipment to meet the technical specifications. The client may already witness the product in action and evaluate its conformity to the original specification. Depending on the scale of the project and the availability of resources, developers might use a variety of techniques to implementation. Waterfall (project development approach) is an excellent choice for big business projects, whereas Agile methodologies are chosen for smaller ones where flexibility is paramount.  Quality Assurance: The goal of the quality assurance step (or testing phase) is to find and document defects introduced during the design stage. The bug report is used by developers to eliminate bugs. Later, a QA specialist evaluates the product not only to see if the problem has been resolved, but also to ensure that no new bugs have emerged during the process of eradicating the previously reported defect. At this stage, all sorts of functional tests are run to ensure that the product meets all of the basic technical and functional criteria. The bug-elimination process will continue until the product's functioning completely fulfills the original specification.  Deployment: The deployment step occurs once the system has been tested and determined to be ready for real-world operation. Because the complexity of deployment is dictated by the scale of the project activity, it can be implemented as a one-time release or as a step-by-step launch. In this example, everything starts with one module, and then the others are gradually added.  Support & Maintenance: When clients start using the final product in real life, several issues arise that must be addressed in order to keep the system running well. In addition, the system requires occasional technical assistance to remain relevant in terms of technology and contemporary standards.

b. How the source code is compiled and run Source code is typically compiled and run through a series of steps that transform human-readable code into machine-executable instructions. The process can vary depending on the programming language and the tools being used, but here's a general overview of the steps involved:  Compilation to CIL: When you write code in a.NET language like C#, the source code is first converted into CIL code by a.NET compiler (e.g., the C# compiler). This CIL code is a simplified version of your original source code.  Platform Independence: CIL is platform-agnostic, which means it does not favor any particular architecture or operating system. This enables the execution of.NET programs on any platform that has a compatible.NET runtime environment installed. The Common Language Runtime (CLR) is used to do this.  Intermediate Representation: CIL is a representation that sits between high-level source code and machine-specific instructions. It enables the compilation of various.NET languages into a common format that can be performed by the CLR.  Just-In-Time Compilation (JIT): The CIL code is not immediately executed by the CPU when a.NET program is run. Instead, it undergoes a procedure known as Just- In-Time compilation. The JIT compiler in the CLR translates CIL code into native machine code tailored to the underlying hardware architecture. This compilation occurs during runtime, which allows for optimization based on the actual execution environment.  Metadata and Type Information: CIL provides metadata that specifies the code's structure and types. This metadata is required for the CLR to manage memory, conduct type checking, and support features such as reflection and dynamic assembly loading.  Portability: Because CIL is platform-independent, developers may create programs that can operate on numerous systems without having to rewrite the code for each one. Developers must still verify that any platform-specific dependencies (such as external libraries) are present on each platform.  Debugging and Reflection: CIL keeps some human-readable metadata, which can help with debugging and analyzing the code. CIL code may be examined using tools such as ILDasm (IL Disassembler). .NET programs may use reflection to analyze and alter their own CIL code at runtime.