Introduction to Computer Languages

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the primary role of a computer language?

  • To replace the need for human communication.
  • To encrypt data for secure transmission.
  • To translate human thoughts directly into actions.
  • To serve as an interface for communication between humans and computers. (correct)

Machine language is considered machine-independent because it can be run on any computer without modification.

False (B)

What is the role of an assembler in the context of assembly language?

An assembler translates assembly language code into machine language.

In programming, a translator that converts the entire source code into object code at once is called a ______.

<p>compiler</p> Signup and view all the answers

Match each language generation with its description:

<p>Machine Language = Uses binary digits and is directly understood by the computer. Assembly Language = Uses mnemonics and requires an assembler. High-Level Language = Uses English-like language and requires a compiler or interpreter.</p> Signup and view all the answers

Which of the following is a characteristic of machine language?

<p>It is directly understood by a computer's hardware. (A)</p> Signup and view all the answers

High-level languages are machine-dependent, meaning they can only be used on specific types of computers.

<p>False (B)</p> Signup and view all the answers

What is the primary advantage of using assembly language over machine language?

<p>Assembly language uses mnemonics, making it easier to read and write compared to binary code.</p> Signup and view all the answers

A program written in a high-level language is called ______ code before it is translated into machine language.

<p>source</p> Signup and view all the answers

Match each programming language with its generation:

<p>BASIC = Third Generation Language (3GL) MATLAB = Fourth Generation Language (4GL) Mercury = Fifth Generation Language (5GL)</p> Signup and view all the answers

What distinguishes fourth-generation languages (4GLs) from third-generation languages (3GLs)?

<p>4GLs specify what to accomplish without detailing how, unlike 3GLs. (A)</p> Signup and view all the answers

Fifth-generation languages (5GLs) are primarily used in business applications due to their simplicity and ease of use.

<p>False (B)</p> Signup and view all the answers

What is the main advantage of high-level languages regarding portability?

<p>High-level languages are machine-independent, allowing them to run on different computers with appropriate translators.</p> Signup and view all the answers

The program converted into machine language after compilation is known as ______ code.

<p>object</p> Signup and view all the answers

Match the programming paradigm with its approach:

<p>Procedure-Oriented Programming (POP) = Top-down approach, emphasizing procedures and functions. Object-Oriented Programming (OOP) = Bottom-up approach, emphasizing data and objects.</p> Signup and view all the answers

Which of the following is a key principle of Procedure-Oriented Programming (POP)?

<p>Division of a large program into smaller functions or methods. (A)</p> Signup and view all the answers

Object-Oriented Programming (OOP) emphasizes the operation more than the data, thus enhancing data security.

<p>False (B)</p> Signup and view all the answers

What are the four pillars of Object-Oriented Programming?

<p>Data Abstraction, Inheritance, Polymorphism, and Encapsulation</p> Signup and view all the answers

In Object-Oriented Programming, a blueprint for creating objects is called a ______.

<p>class</p> Signup and view all the answers

Match the characteristic with the Programming approach:

<p>Top-Down = Procedure Oriented Programming Bottom-Up = Object Oriented Programming More Secure = Object Oriented Programming</p> Signup and view all the answers

Flashcards

Computer Languages

Languages that serve as an interface between humans and computers, using words, symbols, and codes.

Machine Language (1GL)

A low-level language using binary digits (0s and 1s) directly understood by a computer's hardware.

Assembly Language (2GL)

A low-level language using mnemonics and op-codes, requiring an assembler to translate to machine language.

High-Level Language

Languages closer to human language, using English-like words and symbols, requiring a compiler or interpreter.

Signup and view all the flashcards

Third Generation Languages (3GL)

A type of high-level language where programmers write English-like words to instruct the computer.

Signup and view all the flashcards

Fourth Generation Languages (4GL)

A type of high-level language using English-like statements to specify what should be accomplished, without explaining how.

Signup and view all the flashcards

Fifth Generation Languages (5GL)

Programming languages, also known as natural languages, that have visual tools which make it easy to develop a program.

Signup and view all the flashcards

Source Code

A program written by a programmer later converted to machine language.

Signup and view all the flashcards

Object Code

The program converted into machine language, after compilation or interpretation.

Signup and view all the flashcards

Compiler

A translator that converts the entire source code into object code at once.

Signup and view all the flashcards

Interpreter

A translator that converts source code into object code line by line.

Signup and view all the flashcards

Programming Paradigm

An approach to classify programming languages based on their features.

Signup and view all the flashcards

Procedure-Oriented Programming (POP)

A programming model that emphasizes methods or procedures; follows a top-down approach.

Signup and view all the flashcards

Object-Oriented Programming (OOP)

A programming model that emphasizes data, following a bottom-up approach.

Signup and view all the flashcards

Class

A common structure or template for creating objects.

Signup and view all the flashcards

Instances

Objects that are created from a class.

Signup and view all the flashcards

Data Abstraction

Hiding the internal details and showing only the essential information.

Signup and view all the flashcards

Inheritance

A mechanism where a new class inherits properties from an existing class.

Signup and view all the flashcards

Polymorphism

The ability of an object to take on many forms.

Signup and view all the flashcards

Encapsulation

Bundling of data and methods that operate on that data within a class.

Signup and view all the flashcards

Study Notes

  • Communication is the means to express ideas and requires a language.
  • Computer language serves as an interface between humans and computers.
  • It comprises words, symbols, and codes understandable by computers to write programs.

Types of Computer Languages

  • Computer languages are classified into machine language, assembly language, and high-level language.

Machine Language (1GL)

  • Uses binary digits (0s and 1s) grouped in sets of 8 bits (one byte).
  • It directly is understood by computer hardware.
  • Machine code is in binary format
  • Converts all data types (text, graphics, audio) into binary format.
  • Machine-dependent that does not need compilers or interpreters.
  • Machine language is a first-generation language.
  • Example: Character 'a' is 01100001, 'b' is 01100010
  • 8 bits represent a character.
  • Programs in machine language execute faster because it directly interacts with the computer.
  • Code conversion is not needed if the program is written in machine language.
  • Machine language is machine-dependent.
  • Code in this language is in binary, which is difficult to debug.

Assembly Language (2GL)

  • It is a low-level language
  • Uses mnemonics (symbols and abbreviations) and op-codes (numbers).
  • An "Assembler" converts it to machine language.
  • MASM (Macro Assembler) is an example.
  • An assembler translates assembly language code into machine language (0s and 1s).
  • Uses statements instead of binary digits, so it is easily understood and developed by the programmer.
  • It is easy to debug
  • Needs a translator program because it's machine dependent.
  • Programmers should have knowledge of mnemonics.

High-Level Language

  • It overcomes the inconvenience of low-level languages
  • Programs are written in English or symbols, so it is closer to human languages.
  • Writing codes is easier to develop and modify.
  • It needs a compiler or interpreter for execution, because it is machine-independent language.
  • Third, fourth, and fifth generation languages are the three categories of high-level languages.

Third Generation Languages (3GL)

  • The programmer writes English-like words to tell the computer what to do.
  • Uses arithmetic operators, such as * for multiplication and + for addition.
  • Examples are BASIC, PASCAL, C, FORTRAN, C++, Java, and C#.

Fourth Generation Languages (4GL)

  • Uses English-like statements.
  • They specify what the program should accomplish
  • A 4GL is faster and takes less time to code.
  • Programmers with very little programming knowledge can develop programs.
  • Examples are MATLAB, Oracle Reports, or Informix.

Fifth Generation Languages (5GL)

  • Natural languages are is known as the programming languages
  • It has visual tools to develop a program.
  • Examples include Mercury, OPS5, and Prolog.
  • Natural language is very easy to use
  • Natural languages are associated with expert systems and artificial intelligence.
  • These systems are popular in medical and scientific fields and not widely used in business applications.

High-Level Language Advantages

  • User-friendly design
  • Similar to English
  • Less coding time.
  • Easier to maintain.
  • Problem-oriented
  • Can be translated into machine language to run on any computer with a translator.
  • Independent of the machine.

High-Level Language Disadvantages

  • Needs to be translated, wasting computer time.
  • The object code may be inefficient.

Comparison of Computer Languages

Machine Language

  • Uses binary digits.
  • Directly understood by the computer.
  • Example: Character 'A' = 01100001.

Assembly Language

  • Uses mnemonics.
  • Requires an assembler.
  • Example: Addition uses 'Add' (Add A B).

High-Level Language

  • Uses English-like language and symbols.
  • Requires a compiler.
  • Example: Adding 10 and 20 (int s=a + b;).

Source Code and Object Code

  • Source code is written in a text editor and converted to machine language.
  • Compiler or interpreter converts source code
  • Object code is the program converted into machine language.

Compiler

  • A compiler translates the entire source code into object code at once.
  • It displays the errors for the whole program together.

Interpreter

  • It translates the source code line by line before executing.
  • It translates one statement at a time.
  • Displays errors one line at a time.

Programming Paradigms

  • High-level programming languages are classified based on their features
  • There are two types of programming paradigms: Procedure-Oriented Programming (POP) and Object-Oriented Programming (OOP).

Procedure-Oriented Programming

  • A model for beginners in programming
  • It follows a top-down approach.
  • Emphasizes methods or procedures over data values.
  • Procedure programming splits the programming code into events or procedures, that contain a series of steps or instructions.
  • FORTRAN, COBOL, BASIC

Procedure-Oriented Programming Principles

  • Follows a top-down approach.
  • Divides large programs into smaller functions or methods.
  • Provides step-by-step execution instructions.

Procedure-Oriented Programming Advantages

  • Reliable and tested algorithms.
  • Easy to follow program flow.
  • Requires less memory
  • Uses functions.
  • Programs can be executed on different types of processors.

Procedure-Oriented Programming Disadvantages

  • Methods are shared globally.
  • Debugging is required in programs.
  • Emphasizes operation over data, exposing data.
  • Reduces data security.
  • Hard to correlate with real-world objects.

Object-Oriented Programming

  • It follows a Bottom-Up approach
  • It emphasizes more on data rather than functions
  • Divides the program into entities, known as objects.
  • Increases the ability to deal with complex software problems

Object-Oriented Programming Principles

  • Data Abstraction
  • Inheritance
  • Polymorphism
  • Encapsulation
  • The four pillars of Object-Oriented Programming

Object-Oriented Programming Advantages

  • Each instance has exclusive properties.
  • It uses re-usability where code is written once and can be used multiple times using different objects.
  • Maintaining and modifying existing code is easier
  • Abstraction and Data hiding maintain data security.
  • The concept of Inheritance helps avoid data redundancy by allowing code reuse.

Object-Oriented Programming Disadvantages

  • Object-Oriented programs need more lines of code
  • Requires more memory, and its execution may be slower.
  • It requires intensive testing.
  • Proper planning is necessary for designing effective programs

Difference between POP and OOP

Procedure-Oriented Programming

  • Programs are divided into functions or methods.
  • Uses a Top-Down approach.
  • Deals with Algorithm/Procedures.
  • It is less secure.
  • Examples: C, Fortran

Object-Oriented Programming

  • Programs are divided into objects.
  • Uses the concept of Bottom-Up approach.
  • Deals with data.
  • It is more secure.
  • Examples: C++, Java

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Overview of Computer Languages
0 questions
Programming Basics: 1st Generation Languages
9 questions
Use Quizgecko on...
Browser
Browser