Docsity

Procedural Programming: Overview of Languages & Characteristics, Assignments of Computer Science

Toggle sidebar
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
30/10/2021
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
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b

Partial preview of the text

Download Procedural Programming: Overview of Languages & Characteristics and more Assignments 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 30/10/2021 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 2: IDENTIFICATION OF THE PROGRAM DATA, FILE AND UNIT STRUCTURE.

TABLE OF TABLES

Table 1: Data Types ..................................................................................................................................... 19 Table 2: Variable required in the program .................................................................................................. 20

CHAPTER 1: INTRODUCTION TO PROCEDURAL PROGRAMMING.

1. An overview of programming languagues. 1.1. Programming Language. As we all know, in order to communicate with another person, we must use a specific language; similarly, in order to communicate with computers, programmers must use a language known as a programming language. 1.2. What is Language? Language is a form of communication in which people exchange ideas and opinions. For instance, if we want to teach someone, we must use a language that both communicators understand. 1.3. What is a Programming Language? A programming language is a computer language that is used to communicate with computers by programmers (developers). It is a set of instructions written in any language (C, C++, Java, Python) to accomplish a specific task. A programming language is primarily used to create desktop applications, websites, and mobile apps. Figure 1 : Programming Languages.

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

Object – Oriented Programming Language: Object – Oriented Programming (OOP) language is based upon the objects. In this programming language, programs are divided into small parts called objects. It is used to implement real – wolrd entities like inheritance, polymorphism, abstraction, etc in the program to makes the program resusable, efficient and easy – to – use. The main advantage of object – oriented programming is that OOP is faster and easier to execute, maintain, modify, as well as debug. Example: C++, C#, Python, etc. Figure 5 : C++ Figure 6 : C# Figure 7 : PYTHON

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)

C is one of the oldest programming languages that cannot be replaced since it is at the heart of every machine. As a result, there are some benefits and drawbacks to using this programming language. Figure 9 : Advantages and Disadvantages of C 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.

4. Discuss on characteristics and features of procedural programming. 4.1. Features of Procedural Programming. - Predefined functions: A predefined function is a type of instruction that has a name attached to it. Predefined functions are usually included in higher-level programming languages, although they are obtained from a library or registry rather than a program. "printf(….)" is an example of a 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. Figure 11 : Predefined Function. Figure 12 : Local Variable

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. Figure 15 : Pass by value

5. Describe the problem that the situation presents. A math teacher wishes to keep track of his or her students' grades. To manage student grades and IDs, we must first enter them into the system so that it can keep track of data and continue to function. Without initial data, the application will not be able to function. After that, he must print all of the students' IDs as well as their grades. Because there is a huge quantity of data, displaying it all and finding the highest and lowest grades will cause the statements to be executed repeatedly from the beginning of the array to the end of the array, we must use a loop with the correct condition to allow the program to do it. Furthermore, the program's requirements include a large number of options to choose from, thus we should use the function to easily manage and update them. Finally, the highest and lowest grade must be printed.