Programming Languages

Programming Languages

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

semantics

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (73)

Section 1

(50 cards)

semantics

Front

meaning behind the language

Back

assembler

Front

a program that takes the source code of an assembly written program and turns into object code. There are different assemblers for different processors.

Back

C language

Front

static, weak, and compiled to machine code low-level control, efficiency Good for writing Operating system

Back

Why can't compilers have garbage collections?

Front

That'd defeat the whole purpose of a compiler language. The main reason why you'd use compiler language is for their efficiency with memory and speed. If a garbage collection was programmed into the language then it'd have unnecessary overhead defeating the whole reason why you'd want to work with compiler language in the first place.

Back

Low-level

Front

The advantage of low level languages are 1) precise control 2) efficiency Ex. Assembly

Back

imperative paradigm

Front

The paradigm that says to allow modification of states outside a function. To have a side effect.

Back

OS's Kernel

Front

computer program that manages input/output requests from software, and translates them into data processing instructions for the central processing unit and other electronic components of a computer.

Back

Garbage collection(automatic memory management)

Front

The interpreter auto allocates heap memory when the programmers use it or when the programmer doesn't need it anymore.

Back

C++

Front

an (almost) superset of C C with features for OOP Good for commerical applications

Back

Strong typing

Front

allows the programmer to manipulate a piece of data only with operations defined for that data's type. Because arbitrarily manipulating bytes may cause error, you restrict programmers to what the programming language defines nothing more.

Back

Why is the assembler/compilation phase and linker phase separate?

Front

It is because it saves time when a code needs to change. Rather than having to assemble/compile and link all the source code all at once, you can just assemble or compile the source code that needs to be changed and linked with the other object codes that has already been assembled or compiled.

Back

Dynamic Linking

Front

The ability to link code(shared libraries) from other files to the executable during runtime. .so(Linux) .dll(Windows)

Back

source code

Front

the text code that is human readable

Back

System call

Front

how a program requests a service from an operating system's kernel.

Back

syntax

Front

arrangement of the language

Back

Procedural

Front

action-centered design. Lines after lines of codes with not much modularization

Back

Paradigm

Front

a style of solving program problems

Back

linker

Front

a program that links together multiple object codes that was assembled or complied from a source code. The linker is necessary to turn a program into an executable.

Back

Function signature

Front

a function's name and its number/types/order of parameters. The return type does not count.

Back

Compilers

Front

program that is used to translate from high level languages to machine code

Back

Type error

Front

a bug that occurs in the program when you call upon the wrong type of data. Ex. x = true if(x>10) { // code } During the runtime, the interpreter or the compiler will say Type Error Exception because you can not logically compare a Boolean type with a integer. This type of program only occurs in dynamic typing language. Static typed languages detect this before run time.

Back

Interpration

Front

Reads source code and turns it into action. It does what the source code says line by line unlike compilation which translates all code into machine code before turning it into action.

Back

Terminals

Front

Electronic keyboards and screens

Back

Memory leak

Front

a bug in which the program allocates a chunk of heap memory but neglects to give the chunk back to the OS when it's no longer needed. Memory leaks can make programs use up all the address space the OS is willing to give.

Back

Dynamic Typing

Front

a programming language that does not declare the types of variables, parameters, and functions. It checks the operands of operations at RUNTIME. More flexible, especially when using collections

Back

assembly language(assembly)

Front

A language that is used to represent the bytes for manipulation. These languages are processor specific.

Back

Why use dynamic linking and shared libraries?

Front

Memory usage. When multiple programs are running at the same time, it saves memory to run only one copy of that code. When multiple processes use the same library, the libraries include in each process's address space and their virtual memory, but the actual code is in one physical memory.

Back

Popularity of programming paradism

Front

Most popular 1) Object Oriented/Imperative(Most languages of today) 2) Procedural/Imperative 3) Object Oriented/functional 4) Procedural/ Functional Least popular

Back

Weak typing

Front

allows the programmer to manipulate bytes of data in any arbitrary way desired Ex. Assembly languages Sure programmers might make mistakes;however, sometimes programmers want the flexibility of control cover the bytes.

Back

Static Typing

Front

Exact opposite of dynamic. This type of programming language makes sure that you declare the types of variables, parameters, and functions. The types of operands, arguments, and assigned values are checked before execution. Ensures that type errors does not occur.

Back

Compilation and Interpretation hybrid

Front

It takes source code and compiles it into bytecode which is interpreted by the JVM. The reason why this hybrid exists is because they wanted to make a language that had both the benefits of compilation and interpretation Ex. Java

Back

High-level Lanuage

Front

The advantage of high level languages are 1) expressiveness 2) portability across multiple processors Ex. C, C++, Java

Back

Machine Code

Front

code that only computers can understand

Back

functional paradigm

Front

The paradigm that says you are NOT allowed to modify anything outside the function when using the function. All and everything that happens in the function stays in the function without a side effect.

Back

Polymorphism(method overloading in static languages)

Front

ability of operations or functions to accept the varied number and.or types of inputs and possibly changes behavior for each and every varied inputs Ex. the print method print("Hello") print(100) print(false)

Back

tool

Front

any sort of program to create software 1) compiler 2) linker 3) interpreter 4) text editor(Notepad++) 5) debugger ---> program tool that helps programmer tract down bugs by executing code step by step while reporting what's happening in program memory 6) profiler ---> a tool that helps are programmers optimize their code by measuring the performance of code 7) version control ----> a snapshot of code of a project that can be stored in repositories for programmers to go back. Version control also helps programmers organize their code in repositories instead of having the mess of organizing it on your computer. 8)IDE(Integrated Developer Environment)

Back

Assembly vs Compilation

Front

To assemble, Each line of source code corresponds with one instruction. Each line of code becomes one instruction resulting in program. To compile, Each line of source code does NOT correspond with one instruction, but rather multiple instructions.

Back

libraries

Front

body of pre-existing code. We use libraries for common functionality. Most languages have something called "standard libraries"

Back

Why would you mix Assembly and C?

Front

In all high level language, there is no way to invoke a "system call". Only Assembly languages can invoke a system call.

Back

Can you link and run programs that are written in Assembly and C?

Front

Yes, they both produce object files. foo.asm ----> foo.o bar.c -----> bar.o

Back

Heap

Front

part of the program memory where you can store anything else you want other than local variables. Programmers explicitly must ask the OS to allocate heap memory. When finished with heap memory, the programmer must manually de-allocate the heap memory or that will cause memory leak.

Back

Can interpreters have memory leak despite having a garbage collector?

Front

Yes. The auto garbage collection only occurs when a data is de-referenced to any existing variable. If a programmer forgets to de-reference a variable, the garbage collection will not activate.

Back

What is Address space(program memory) made of?

Front

1) text(code) ---> Auto allocated by OS 2) call stack(local variables) ---> Auto allocated by OS 3) heap(Everything else) ---> manually manage by programmer

Back

Compilation

Front

the translation from high level language to machine code

Back

Object-oriented

Front

data-centered design. Codes of lines are categorized by objects. All objects have attributes and behaviors. These attributes and behaviors are encapsulated in an object and they communicate with other objects by sending a message .

Back

What does a interpreter need to work?

Front

1) Arithmetic 2) Variables 3) Control flow 4) Functions

Back

Compilation vs Interpretation

Front

Compilation 1) Faster and efficient Interpretation 2) Portability

Back

JIT(Just In Time)

Front

JIT is used with VM which has the ability to compile bytecode to machine codes when some part of a bytecode is being used often.

Back

Interpreter

Front

program used to read source code to produce action line by line. Linker is not necessary for Interpreter since it does the linking itself between 2 or more source code files.

Back

Hex-editior

Front

a program that allows the editing of bytes in hex form

Back

Section 2

(23 cards)

Why is it called a script?

Front

high level instructions, but the real work is being done by other actors (Perl, Python)

Back

Functional Languages

Front

(Scheme, Haskell, Scala, ML)

Back

Efficiency

Front

Programmer control Overhead: interpretation, automatic memory management, dynamic typing

Back

Query Languages

Front

Language used to make request to the database SQL(Structured Query Language)

Back

shell languages

Front

any language that uses command prompt Ex. Windows command prompt (bash,zsh,ksh)

Back

Java

Front

OOP C-style syntax mix of static and dynamic typing compiled to bytecode, interpreted by VM JVM

Back

Domain-specific Language

Front

opposite of general purpose languages

Back

Database

Front

storage for storing large quantity of data

Back

Perl

Front

dynamic interpreted semi-OOP Condemned for being too difficult to understand

Back

Python

Front

dynamic interpreted object oriented indentation-sensitive Praised for being clean Semantically Perl and Python are same

Back

PHP

Front

dynamic interpreted semi-OOP mostly used in web programming condemned for being ugly, but it's popular for web

Back

How do you run a program without having to write different version for each platform?

Front

1) Differing CPU instruction sets ----> solved by using any language other than Assembly. 2) System calls ---> To run on different OS, we can avoid making system calls directly and use the library as an intermediary. We invoke library calls and the library calls invoke system calls. 3) Difference in capabilities have no work around 4) Libraries for different OS, but using the library our code can be the same for all platform

Back

Objective C

Front

near superset of C C with features for OOP mostly used by Apple

Back

C#

Front

kinda like Java by Microsoft OOP C-style syntax mix of static and dynamic typing compiles to bytecode, interpreted by VM CLR(Common Language Runtime)

Back

Scripting languages

Front

(Perl Python)

Back

Ruby

Front

dynamic interpreted OOP

Back

Data(Markup) languages

Front

languages that expresses data (HTML XML)

Back

Shell script

Front

sequential lines of code ran on shell

Back

Portability

Front

1) CPU instruction sets --> Different processor 2) System calls ---> different API for different OS 3) capabilities ---> different capabilities for Input/Output devices 4) libraries

Back

Graphical languages

Front

languages not represented in text, but rather graphics. Ex. GUIBuilders

Back

Javascript

Front

dynamic interpreted C-style-syntax OOP(via prototypes) interprete embedded in web browsers Nothing to do with Java

Back

logic languages

Front

(Prolog) no one uses it

Back

Efficiency ranking

Front

Most Efficient 1) Assembly, C,C++, Objective-C 2) Java, C# 3) Perl, Python, Ruby, PHP, Javascript Least Efficient

Back