Programming Languages Flashcards

1
Q

What is Computational Thinking?

A

• formulates the solution to a problem in the form of
algorithms

  • solves by using computer
  • consists of several parts
  • a sequence of step-by-step instructions
  • tells the computer how to solve a problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Computational Thinking Process

A

Computational Thinking Process

  • Abstraction, Function and data structure
  • Decomposition, Break a problem into smaller parts
  • Pattern Recognition, Identify similarity in a problem
  • Algorithm Design, Step-by-step instructions for the computer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

At the end of this lesson, you should be able to

A
  • Distinguish between the low-level machine-language and high-level programming language
  • Describe the two ways of translating high-level language program code to machine-language instructions
  • State the main features of high-level programming languages: C, C++, Java, Python
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Programming is the process of

A

Programming is the process of

implementing a representation of the solution for the computer to execute

• taking an algorithm and encoding it using certain programming language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Programming language is a medium through which

A

Programming language is a medium through which programmer may give instructions to a computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The computer has its own language.

A

The computer has its own language.

• machine-language that is specific to the type of
computer processor

• consists of a set of machine instructions and
data objects that are encoded in ‘0’ and ‘1’
binary format

• error-prone for human to code a program
directly using the computer’s machine codes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

High-level programming languages that are more user-friendly are hence invented.

A

High-level programming languages that are more user-friendly are hence invented.

  • provide abstraction from the internal operating detail of the computer
  • enable the programmers to focus on solving the problem
  • make the process of developing the algorithm simpler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Program Translations Sequence

A

High-level program code is first translated into low-level machine-language instructions.

Which then instruct the computer to perform the necessary operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Two approaches for program translation:

A
  • interpretation

* compilation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Interpretation approach

A

• uses a program known as interpreter

• reads one high-level code statement at a time
- immediately translates and executes the statement before processing the next one

• examples: Python, R, and JavaScript

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Compilation approach

A

• uses a program called compiler

• reads and translates the entire high-level language program
(source) code into its equivalent machine-language instructions in an
executable file

• the resulting machine-language instructions can then be
executed directly on the computer when the program is launched

• examples: C and C++

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Pros for Interpreter

A

• very portable across different computing platforms

• produces results almost
immediately

  • easy to debug
  • program executes more slowly
  • useful for implementing dynamic, interactive features, such as those used on web pages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Compiler

A
  • program runs very fast AFTER compilation
  • smaller in code size after compilation
  • must compile the entire program before execution
  • needs to be re-compiled if to be used on different computing platforms

• used in large and sophisticated software applications when speed is
of the utmost importance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

C language

A

• developed to help implement the Unix operating system

• allow for direct access of, and manipulation of, the underlying computer’s
hardware.

It is a compiled language

• the program code (i.e. source code) needs to be
compiled first, before it can be executed.

Most suitable for applications

  • direct access to the computer’s hardware
  • fast real-time response
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

C++ language

A
  • an extension to the C language
  • with additional support for Object-Oriented Programming (OOP)

In OOP

• programs are designed based on objects that contain attributes
and behaviors

• programming is then focused on how the objects interact with one another

  • without the need to know the internal code detail of the object

C++ is a compiled language

• used for applications that need high performance and are based on object-oriented software design principles

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Python language

A

• a relatively easy-to-learn programming language

• targeted for general purpose programming for applications that do
not need direct access to the computer’s hardware

It is an interpreted language

• program code is hence portable across different computing platforms

Python interpreter converts and executes the Python program statement one-by-one to the corresponding machine instructions

  • provides instant feedback to the user at runtime
  • very helpful for learning to program
17
Q

Java language

A

• highly portable, general purpose language with Object-Oriented (OO)
methodological support

Designed to run as an interpreted language on a Java Virtual Machine (JVM)

  • portable across different types of machines and devices
  • no direct access to the computer’s hardware

Combination of compiler and interpreter, as well as Just-in-time (JIT) compiler

• the source code (with file extension .java) is first compiled to Java bytecode
(with file extension .class)

• Java bytecode instruction is then interpreted by the JVM interpreter during
execution

• JVM may call the JIT compiler to compile some of the bytecode instructions at
runtime before they are executed, achieving better performance

18
Q

HTML (Hypertext Markup

Language)

A
  • a content-markup language uses symbols and phrases

* instructs the web browser to structure information for display or process

19
Q

PHP (PHP: Hypertext Pre-processor) is another script language

A
  • dynamically generates html webpage before it is sent to the browser
  • Example: contents that need to be composed based on user’s request
20
Q

R language

A
  • an interpreted language
  • used for statistical computing, such as data analysis
  • provides extensive graphic plotting functions
  • useful for displaying data trends
21
Q

MATLAB language

A
  • commonly used for developing science and engineering computation applications
  • an interpreted language used primarily for numerical computing
  • supports many functions and libraries, such as matrix manipulation, plotting, and visualization of data