Lecture 5 PL ICT
Lecture 5 PL ICT
Programming
Programs
• Programs are written in programming languages
-Programs are the set of instructions that tell computer what to do.
• A Programming Language is
– A special purpose and limited language
– A set of rules and symbols used to construct a
computer program
– A language used to interact with the computer
Program(example):
Computer Languages
– Machine Language
• Uses binary code
• Machine-dependent
• Not portable
• Assembly Language
– Uses mnemonics
– Machine-dependent
– Not usually portable
• High-Level Language (HLL)
– Uses English-like language
– Machine independent
– Portable (but must be compiled for different platforms)
– Examples: Pascal, C, C++, Java, Fortran, . . .
Machine Language
• The representation of a computer program which is
actually read and understood by the computer.
– A program in machine code consists of a sequence of machine
instructions.
• Instructions:
– Machine instructions are in binary code
– Instructions specify operations and memory cells involved in the
operation
Example: Operation Address
There are many high-level programming languages, each designed with different goals and
strengths.
Python
Use: Web development, data science, automation, machine learning.
Strengths: Easy to learn, large libraries, cross-platform.
JavaScript
Use: Web development (front-end and back-end), mobile app development.
Strengths: Runs on all browsers, large ecosystem, asynchronous programming.
Java
Use: Enterprise applications, Android development, web development.
Strengths: Platform-independent, strong OOP features, large community.
C++
Use: System software, game development.
high-level programming
languages
C#
Use: Windows apps, game development (Unity), web development.
Strengths: Strong Windows integration, modern syntax, great for game development.
PHP
Use: Web development, content management systems (WordPress, Joomla).
Strengths: Easy to learn, widely supported, large community.
R
Use: Data science, statistics, machine learning.
Strengths: Strong statistical libraries, excellent for data analysis.
Compilers & Programs
• Compiler
– A program that converts another program from
some source language (or high-level
programming language / HLL) to machine
language (object code).
– Some compilers output assembly language
which is then converted to machine language by
a separate assembler.
2. Interpretation (For Interpreted Languages)
Explanation: The closing parenthesis ) is missing, which causes the interpreter to raise a syntax error.
Cont..
• Runtime error:
– When there are no syntax errors, but the program
can’t complete execution
• Divide by zero
• Invalid input data