






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!































Qualification BTEC Level 5 HND Diploma in Computing Unit number and title (^) Prog102: Procedural Programming Submission date 26/10/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name NGuyễn Văn Quang Student ID GCH Class GCH1105 Assessor name 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
Grading grid P1 P2 P3 M1 M2 D 1
Grade: Assessor Signature: Date: Lecturer Signature: Contents A. Introduction 6 I. Programing language 6
ii. Assembly Language Assembly language (ASM) is also a type of low-level programming language that is designed for specific processors. It represents the set of instructions in a symbolic and human-understandable form. It uses an assembler to convert the assembly language to machine language. The advantage of assembly language is that it requires less memory and less execution time to execute a program.
II. Procedural Programing (P1)
Procedural Programming may be the first programming paradigm that a new developer will learn. Fundamentally, the procedural code is the one that directly instructs a device on how to finish a task in logical steps. This paradigm uses a linear top-down approach and treats data and procedures as two different entities. Based on the concept of a procedure call, Procedural Programming divides the program into procedures, which are also known as routines or functions, simply containing a series of steps to be carried out. 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.
+ 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.
+ 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 it 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 security friendly. + 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.
III. Key Features of Procedural Programming (M1)
Most high level languages will make use of predefined functions. A predefined function is built into the software and does not need to be created by a programmer. Pre-defined functions often exist to carry out common tasks, such as:
A global variable is a variable which is declared outside every other function defined in the code. Due to this, global variables can be used in all functions, unlike a local variable.
Modularity is when two dissimilar systems have two different tasks at hand but are grouped together to conclude a larger task first. Every group of systems then would have its own tasks finished one after the other until all tasks are complete.
Parameter Passing is a mechanism used to pass parameters to functions, subroutines or procedures. Parameter Passing can be done through ‘pass by value’, ‘pass by reference’, ‘pass by result’, ‘pass by value-result’ and ‘pass by the name’.
B. ANALYZE THE SITUATION I. Variables and Data Types (P2)
A variable is the name of the memory area where the program can change data. This location is used to store the value of the variable. The value of variable C can be changed in the program. Here, the type must be a valid C data type that contains char, w_char, int, float, double, bool, or any other user-defined object.; The list of variables may consist of one or more identifier names separated by commas. Some valid statements are shown here.
Student has lowest grade Mingrade Float Student's grade is a real number from 0 to 10 Menu option n integer The options are numbered from 1 to 5 Note: n in the flowchart for menu operation is different from ones in others flowchart II. Conditional Statement (P2)
1. If
conditions. Conditional statements execute sequentially when there is no condition around the statements. If you put some condition for a block of statements, the execution flow may change based on the result evaluated by the condition. This process is called decision making in ‘C.’ The if statement evaluates the test expression inside the parenthesis ().
**_+ If the test expression is evaluated to true, statements inside the body of if are executed.
In this scenario, the programmer defines an integer variable named n. There, the n is considered only once and compared to the value of the case. If a block of statements follows a case that has a matching value, the statements within that block will be executed. In my report, I will use it to declare different options which users choose to report in the "Menu". It will have 4 options. Case 1 (^) Display information of student Case 2 Search information of student Case 3 Find min grade of student Case 4 (^) Find min grade of student Case 5 Exit III. Loop Statement (P2)
The for loop in C language is used to iterate the statements or a part of the program several times. It is frequently used to traverse the data structures like the array and linked list..
1 .Expression 2 is a conditional expression. It checks for a specific condition to be satisfied. If it is not, the loop is terminated.
The do...while loop is similar to the while loop with one important difference. The body of do...while loop is executed at least once. Only then, the test expression is evaluated. The syntax of the (^) do...while loop is:
The body of^ do...while^ loop is executed once. Only then, the^ testExpression^ is evaluated.
(^) This process goes on until testExpression becomes false.