Introduction to Procedural Programming: Understanding the Basics of Procedural Languages, Essays (high school) of Computer science

An overview of programming languages, focusing on procedural programming. It covers the concept of a programming language, the difference between low-level, high-level, and middle-level languages, and an introduction to the C programming language. The document also discusses the characteristics and features of procedural programming, including predefined functions and parameter passing.

Typology: Essays (high school)

2020/2021

Uploaded on 10/20/2021

minh-huy-huynh
minh-huy-huynh 🇻🇳

4.7

(58)

39 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Prog102: Procedural Programming
Submission date 23/10/2021
Date Received 1st
submission
Re-submission Date Date Received 2nd
submission
Student Name Huynh Minh Huy Student ID GCD210173
Class GCD1001 Assessor name Phan Thanh Tra
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 Huy
Grading grid
P1 P2 P3 M1 M2 D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Introduction to Procedural Programming: Understanding the Basics of Procedural Languages and more Essays (high school) Computer science in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog102: Procedural Programming Submission date 23/10/2021 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Huynh Minh Huy Student ID GCD Class GCD1001 Assessor name Phan Thanh Tra 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 Huy Grading grid P1 P2 P3 M1 M2 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

TABLE OF CONTENTS

  • CHAPTER 1: INTRODUCTION TO PROCEDURAL PROGRAMMING..................
      1. An overview of programming languagues...........................................................................................................
      • 1.1. Programming Language................................................................................................................................
      • 1.2. What is Language?........................................................................................................................................
      • 1.3. What is a Programming Language?...............................................................................................................
    • 1.4. Types of Programming languages.....................................................................................................................
      • a. Low – level Programming Language.................................................................................................................
      • b. High – level programming language.................................................................................................................
      • c. Middle – level programming language...........................................................................................................
      1. Introduction to C Language................................................................................................................................
      1. Procedural Programming...................................................................................................................................
      1. Discuss on characteristics and features of procedural programming................................................................
      • 4.1. Features of Procedural Programming.........................................................................................................
      • 4.2. Characteristics of procedural programming................................................................................................
  • CHAPTER 2:......................................................................................................................

1.4. Types of Programming languages. a. Low – level Programming Language. A low – level language is a programming language that is machine – dependent (0s and 1s). Because the processor runs low – level programs directly without the use of a compiler or interpreter, programs written in low – level languages can be executed quickly. The low – level language is further subdivided into two sections:  Machine Language : Low-level programming languages, such as machine language, are a sort of low-level programming language. It's also known as object code or machine code. Because machine language is generally displayed in binary or hexadecimal (base 16) form, it is easier to interpret. Because computers understand machine language programs directly, there is no need for a translator to convert the programs. Machine language has the advantage of allowing the programmer to execute programs much faster than high-level programming languages.  Assembly Language: Assembly Language (ASM) is also a low-level programming language that is tailored to individual processors. It is a symbolic and human- understandable representation of the collection of instructions. It converts assembly language to machine language using an assembler. Assembly language has the advantage of requiring less memory and execution time to run a program. b. High – level programming language. High – level programming language (HLL) is designed for developing user – friendly software programs and websites. This programming language requires a compiler or interpreter to translate the program into machine language (execute the program). The main advantage of a high – level language is that it is easy to read, write and maintain. High – level programming language includes Python, Java, JavaScript, PHP, C#. C++, Objective C, Cobol, Perl, Pascal, LISP, FORTRAN and Swift programming language.

A high – level language is further divided into three parts:  Procedural Oriented Programming Language: Procedural Oriented Programming (POP) language is derived from structured programming and based upon the procedure call concept. It divides a program into small procedures called routines or functions. Procedural Oriented programming language is used by a software programmer to create a program that can be accomplished by using a program editor like IDE, Adobe, Dreamweaver or Microsoft Visual Studio. Example: C, FORTRAN, Pascal, etc. Figure 2: C Figure 3: FORTRAN Figure 4: PASCAL

c. Middle – level programming language. A middle-level programming language is a cross between a lower-level and a higher-level programming language. It's also known as a pseudo-language and an intermediate programming language. The advantages of a middle-level programming language are that it supports high-level programming features, is a user-friendly language, and is closely connected to machine and human language.

2. Introduction to C Language. The C programming language is a procedural programming language. Dennis Ritchie created it for the first time in 1972. It was created primarily as a system programming language for developing operating systems. Low-level memory access, a minimal set of keywords, and a clean style are all properties of the C language that make it suited for system programming, such as operating system or compiler development. Many following languages have directly or indirectly inherited syntax and features from C. The C language is the foundation for several languages, including Java, PHP, JavaScript, and many others. C++ is a near-superset of the C language (just a few programs will compile in C, but not in C++) (GeeksforGeeks, 2021). Figure 8: Structure of C program (GeeksforGeeks, 2021)

3. Procedural Programming. Procedural Programming may be the first programming paradigm that a new developer will learn. Procedural code, in its most basic form, is the code that tells a device how to do a job in logical stages. This paradigm takes a top-down, linear approach to data and operations, and regards them as two distinct things. Procedural Programming splits a program into procedures, which are sometimes known as routines or functions and simply comprise a set of actions to be carried out, based on the notion of a procedure call. Simply put, Procedural Programming involves writing down a list of instructions to tell the computer what it should do step-by-step to finish the task at hand. (Bhatia, 2021) Figure 10: Procedural Programming.

Procedural Programming has its own set of advantages and disadvantages, some of which are listed here.  Advantages:  Procedural Programming is excellent for general-purpose programming.The coded simplicity along with ease of implementation of compilers and interpreters.A large variety of books and online course material available on tested algorithms, making it easier to learn along the way.The source code is portable, therefore, it can be used to target a different CPU as well.The code can be reused in different parts of the program, without the need to copy it.Through Procedural Programming technique, the memory requirement also slashes.The program flow can be tracked easily.  Disadvantages:  The program code is harder to write when Procedural Programming is employed.The Procedural code is often not reusable, which may pose the need to recreate the code if is needed to use in another application.Difficult to relate with real-world objects.The importance is given to the operation rather than the data, which might pose issues in some data-sensitive cases.The data is exposed to the whole program, making it not so much security friendly.

Figure 11: Predefined Function.

  • Local Variable: A local variable is a variable that is defined in the method's main structure and is only valid inside the scope of the method. The local variable can only be used in the method in which it is defined; if it is used outside of that function, the code will fail.
  • Global Variable: A global variable is one that is declared outside of every other function in the program. As a result, unlike local variables, global variables can be utilized in any function.
  • Modularity: Modularity is when two dissimilar systems have two different tasks at hand but are grouped together to conclude a larger task first. The duties of each set of systems would then be completed one by one until all of the tasks had been completed.
  • Parameter Passing: Parameter Passing is a mechanism used to pass parameters to functions, subroutines or procedures. 'Pass by value', 'pass by reference', 'pass by result', 'pass by value-result', and 'pass by the name' are all methods for passing parameters.

Figure 12: Parameter Passing. 4.2. Characteristics of procedural programming.  A large program is broken down into small manageable procedures or functions. This minimizes code duplication, making the code more readable and maintainable.  Different functions can share data via global variables. Because functions are entirely separated, we must declare data in the higher scope if we wish to share it.  Functions can change global data. Because global data is passed from function to function, global data in function chains may be changed throughout the transformation.  Top-down methodology. Procedural programming employs a top-down approach, with workflow moving from top to bottom. CHAPTER 2:.