Podcast
Questions and Answers
Which of these is a characteristic of 2GL?
Which of these is a characteristic of 2GL?
What is the role of an assembler?
What is the role of an assembler?
Which of the following is NOT a characteristic of high-level programming languages?
Which of the following is NOT a characteristic of high-level programming languages?
What is the main advantage of high-level programming languages compared to assembly language?
What is the main advantage of high-level programming languages compared to assembly language?
Signup and view all the answers
Which generation of programming language is considered problem-oriented?
Which generation of programming language is considered problem-oriented?
Signup and view all the answers
Which of the following is NOT a characteristic of 1GL?
Which of the following is NOT a characteristic of 1GL?
Signup and view all the answers
What is the primary advantage of using 1GL over 2GL?
What is the primary advantage of using 1GL over 2GL?
Signup and view all the answers
Which of the following is considered a low-level programming language?
Which of the following is considered a low-level programming language?
Signup and view all the answers
What makes high-level programming languages machine independent?
What makes high-level programming languages machine independent?
Signup and view all the answers
What is the main difference between 1GL and 2GL?
What is the main difference between 1GL and 2GL?
Signup and view all the answers
Flashcards
Assembly Language
Assembly Language
A low-level programming language that uses symbolic instructions directly related to machine code.
Characteristics of 2GL
Characteristics of 2GL
Assembly language is machine dependent, efficient, easier to write than machine language, but harder to understand than high-level languages.
High-Level Programming Language
High-Level Programming Language
A programming language that is machine independent, uses abstraction with variables, functions, and is readable by humans.
Categories of High-Level Languages
Categories of High-Level Languages
Signup and view all the flashcards
Problem-Oriented Languages
Problem-Oriented Languages
Signup and view all the flashcards
Programming Language Categories
Programming Language Categories
Signup and view all the flashcards
Low Level Languages
Low Level Languages
Signup and view all the flashcards
Machine Language (1GL)
Machine Language (1GL)
Signup and view all the flashcards
Assembly Language (2GL)
Assembly Language (2GL)
Signup and view all the flashcards
High Level Languages
High Level Languages
Signup and view all the flashcards
Study Notes
Introduction to Programming Language
- Programming languages act as a vocabulary and set of grammatical rules to instruct computers for specific tasks
- Different programming languages each possess a unique set of keywords (words understood by the language) and a specific syntax (grammar) to structure program instructions
Syntax
- Syntax refers to the spelling and grammar in a programming language
- Each programming language defines its own syntactical rules to determine the acceptable combination of words the computer understands
- Text-based languages utilize sequences of characters
- Visual languages rely on the spatial arrangement and connections of symbols
Example of a program code (small basic)
- TextWindow.Writeline("enter the Temperature in fahrenheit ")
- fahr = TextWindow.ReadNumber()
- celsius = (5 * (fahr - 32) / 9)
- TextWindow.WriteLine("This Temperature in celcius is " + celsius +" degrees")
- This code example demonstrates a small basic program for converting the temperature from Fahrenheit to Celsius
Levels of programming languages
- Programming languages are categorized into machine language (1GL), assembly language (2GL), third-generation language (3GL), fourth-generation language (4GL), and natural language
- Machine and assembly languages are low-level languages
- Third-, fourth-, and natural languages are high-level languages
Machine language - First Generation Language (1GL)
- Machine language utilizes 1s and 0s (binary code) understandable by computers
- The main drawback of using direct machine code is the high possibility of mistakes and difficulty in identifying errors
Characteristics of 1GL
- Fast execution due to the direct understanding by the computer hardware
- Difficult to interpret, requiring a reference manual
- Error-prone in terms of sequence and value assignments in the code
- Machine dependent
- Complexity of programs increases the difficulty of coding
Assembly language - Second Generation Language (2GL)
- Mnemonic codes (abbreviated English words) or short codes are used in assembly language, these codes indicate their functions
- Codes represent operations, memory addresses, and storage registers within the computer
Example of assembly language
- LDA A, 20 : loads accumulator A with the value 20
- ADD A, 10 : adds 10 to the value in accumulator A
- STO B, A : stores the value in accumulator A into register B
- NOP: no operation
Characteristics of 2GL
- Machine-dependent
- Faster and more efficient than 1GL
- Requires translation into machine code using assemblers
- Easier to code than 1GL but still challenging to understand
High-level programming languages
- High-level programming languages are machine-independent, utilizing variables, objects, Boolean expressions, and similar constructs like functions, loops, arrays
- These languages are categorized into: third-generation languages (3GL), fourth-generation languages (4GL), object-oriented programming languages (OOP), fifth-generation languages (5GL), and scripting languages
Characteristics of high-level languages
- Machine-independent
- User-friendly and easy to learn
- Easy debugging for programs
- Higher programmer creativity and productivity
- Slower execution speed compared to low-level languages
- Requires translation to machine code by compilers/interpreters
Major high-level programming languages
- FORTRAN, COBOL, RPG, BASIC, Pascal, C, Ada, JavaScript, Python
Language Translators
- System programs that convert assembly/high-level languages to machine languages
- Crucial for computers to understand programming instructions
Source code
- Program codes of high-level/assembly languages created by programmers in specialized editor tools
- Source code requires converting into machine-readable form (object code)
Object code
- Program code in machine-readable form (translated source code)
Assemblers and Compilers and Interpreters
- Programs that translate high-level languages into machine code
- Compilers translate the complete source code into machine code once to run the program
- Interpreters translate and execute one statement in the source code at a time before moving to the next statement
Interpreters
- Interpreters translate each source code statement individually and execute each instruction in turn
- Slower execution compared to compilers due to single-statement processing
Assemblers
- Translate assembly language into machine code
- Recognize symbolic names for operations in assembly language and replace them with corresponding machine code
Defining the problem
- Problem definitions should be unambiguous, clear, and have one specific meaning
- Examples of good problems:
- Calculating the price of an item after a 10% discount
- Converting Celsius temperature to Fahrenheit
- Computing the average rainfall for May in a certain area
Input and storage instructions
- Instructions used by the computer to accept data
- Words like 'Enter', 'Input', and 'Read' denote the data requirements for the computer
Processing instructions
- Instructions manipulating input data using mathematical operations (addition, subtraction, multiplication, division), loops, selection, and comparison
- Often include commands and constructs (e.g., IF-THEN)
Python Programming Language
- An open-source, high-level, interpreted, dynamic programming language
- Relatively easy to learn and use
- Extensive libraries are beneficial
- Flexible, usable as add-ons for highly customizable programs
- Cross-platform compatible
- High software quality
- Strongly and dynamically typed data types
- Embedded easily into applications
Python Integrated Development Environment (IDE)
- A set of software tools for program development
- Provides essential tools for software development
- Includes code editing, syntax highlighting, autocompletion, debugging, and code formatting
- IDEs can improve program development speed
Types of Integrated Development Environment (IDE)
- IDLE
- PyCharm
- Jupyter Notebook
- Spyder
- Sublime Text
Python Programming Language (IDLE)
- an integrated development and learning environment for Python
- Includes an editor for creating and modifying programs
- Contains a translator for executing programs
- Provides debugging features
- Python can execute in interactive mode using the Python shell
- Convenient for single-statement execution, code creation, modification, and execution
PyCharm
- Popular Python Integrated Development Environment
- Used well by professional developers for large projects
- Offers various features such as efficient debugging, profiling, remote development, testing
- Support for JavaScript, CSS, TypeScript, databases, libraries, and version control
Jupyter Notebook
- Python Integrated Development Environment suitable for data input/manipulation (data science)
- User friendly, interactive, allows code sharing, and visualization
- Not utilized as a code editor but helpful for educational tools or presentations, with support for numerical calculations, machine learning, and data visualization
Spyder
- Open-source IDE primarily for scientific development
- Lightweight Python IDE integrated with Anaconda distribution, popular in data science and machine learning
- Provides access to databases like PostgreSQL, Oracle, MySQL, SQL Server
Sublime Text
- Generic text editor written in C++ and Python
- Supports 44 programming languages, including Python
- Basic Python support, extendible with plugins
- Features an intuitive, minimal interface design focusing on text display without clutter
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your knowledge on the characteristics and advantages of different programming languages, from first to second generation. This quiz will challenge your understanding of low-level versus high-level programming languages and their unique features.