Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

C Programming Test 6 Theory of Programming

The document outlines various programming paradigms, detailing their advantages, disadvantages, and use cases. It also explains the three main steps in the compilation process and characteristics to consider when choosing a programming language for mobile applications. Additionally, it provides strategies for making programs easier to update for future programmers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

C Programming Test 6 Theory of Programming

The document outlines various programming paradigms, detailing their advantages, disadvantages, and use cases. It also explains the three main steps in the compilation process and characteristics to consider when choosing a programming language for mobile applications. Additionally, it provides strategies for making programs easier to update for future programmers.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Programming Test 6

Theory of programming

1. Fill out the following table as they pertain to programming paradigms

Paradigm Advantage Disadvantage Use Case


Simple to Difficult to use when A simple payroll
Procedural/Imperative
understand and use solving complex system that
Programming
It is easy to execute problems and calculates salaries
by compilers and identifying errors and generates
interpreters payslips.

Encapsulation ensures Consumes more A home automation


Object-Oriented
a level of security for memory and CPU system with
Programming
the data and objects resources. Also, has a interconnected
made in a particular steeper learning curve devices (alarms,
program can be reused because you have to lights, cameras).
in other programs. set up classes of data.
Functional Uses a modular Some problems cannot A machine learning
Programming approach, where large be solved in a purely model that uses
problems are functional manner. functional data
subdivided. Functions Errors are hard to find processing.
are reusable and can in a very large program.
be stored in libraries.
Readable and concise Often less flexible for
Declarative A webpage layout
because it focuses on complex tasks.
Programming defined with HTML
the "what" rather than Limited control over
and CSS to
the "how". execution and
describe structure
debugging can be
and styling.
challenging.

(16 marks)

2. List and explain the 3 main steps in the compilation process from clicking compile to running an
executable program.
(6 marks)
3. Sam wants to build a mobile application. Name 2 characteristics he should look for in a
programming language. Give a reason for your answer.
(4 marks)
4. Explain 2 ways a program can be made easier for a future programmer to update.
(4 marks)

2. (Total 30 marks)
a. Lexical Analysis - The source code is broken down into tokens (keywords, variables, operators) and
scanned. Syntax Analysis - The tokens are broken down into a parse tree
b. Semantic Analysis (Parsing) – is the process where the compiler checks if the tokens follow the grammar
rules (syntax) and if it makes logical sense.
c. Code Generation - The compiler translates the code into machine code (binary) and links libraries to
produce an executable program.
3.Cross-platform programming-A language like Flutter (Dart) or React Native (JavaScript) that allows apps to
run on both Android and iOS without rewriting the code. It reduces development time and effort compared to
writing separate Android (Java/Kotlin) and iOS (Swift) apps.
-High level of performance and efficiency- Languages like Swift (for iOS) and Kotlin (for Android) are
optimized for mobile devices and ensures a high level of performance. Mobile devices have limited resources
(CPU, battery) so efficient code would improve the app's speed and battery life.
4. Using proper documentation by writing clear comments and providing README files to assist future
programmers in understanding the code and making updates.
-Writing modular and well-structured code by breaking the code into separate functions which makes updates
easier.

You might also like