Programming Languages & Compilers

Programming Languages & Compilers

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

Dynamic Scope

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 (67)

Section 1

(50 cards)

Dynamic Scope

Front

Refers to scope of a variable that is defined at run-time. It refers to the identifier with the most recent environment

Back

Explicit Heap Dynamic Variable

Front

A nameless/abstract variable that is allocated/deallocated with an explicit allocation operator. Ex: bsh % set = new HashSet();

Back

int[] a = new int[10];

Front

Create an array in Java

Back

Pointer

Front

An object that stores the memory address of another value located in memory. Can be re-assigned any number of times Can be assigned NULL directly

Back

Static Variable

Front

Variable declared with a keyword Lasts program's entire run-time May not always be visible to functions/subunits in the program

Back

Float

Front

A single precision (32 bit) floating point data type

Back

Ordinal

Front

A data type who's values can be counted. A finite, ordered set of values (Types: integer, char) Ex: x = 1..10; y = 'a'..'z'; Advantages: Readability, reliability

Back

Dereference Operator

Front

Operator (symbol: *) that returns a value equivalent to the value at the pointer address Ex: int x; int *p; x = 0; p = &x; //this sets p equal to the value at x's memory location *p = 1; //this sets the value of x's (also p's) memory location to 1 print x; output: 1

Back

Rectangular Array (2D Array)

Front

A 2D array with a number of rows, and columns. Each row, and column has the same number of objects

Back

Local Variable

Front

A variable declared in the same program/function in which it is used, and is not available to other subunits/functions in the program

Back

Address Operator

Front

Operator (symbol: &) that returns the memory address of a variable.

Back

Implicit Heap Dynamic Variable

Front

A variable that is allocated without the use of an explicit allocation operator. Ex: list = [10.2, 3.5] This variable storing [10.2, 3.5], not the variable "list"

Back

Stack Dynamic Variable

Front

A variable (local by default) that is bound/unbound to an address on the stack at run-time

Back

Nonlocal Variable

Front

A variable not declared in the same program subunit in which it is used, and is not available to every subunit/function in the program

Back

Reference Environment

Front

Collection of variables that are visible that can be used by certain statements in a program (Similar to scope)

Back

R Value

Front

The value of a variable

Back

Associative Array

Front

An abstract array type that can hold data in "key, value" pairs. Ex: A list of phone numbers where you can look up a person's name by finding their phone number. The name is the value and the number is the key

Back

Static Binding

Front

Variables are bound to a type at compile-time. Type cannot be changed after execution. pros: flexibility cons: high memory cost, and type error

Back

C++, Java, C#

Front

In the languages __________ , variable declarations can appear anywhere statements can appear

Back

case sensative

Front

Syntax in C-based languages are __________

Back

Keywords

Front

__________ are special only in certain context

Back

Column Major (Order)

Front

Method for storing multidimensional array where consecutive elements of a column reside next to each other Starts on the first column, then the second column, etc

Back

Runtime Heap

Front

A large storage area that is managed at run-time used to store data in some variable amount

Back

int a[10];

Front

Create an array in C++

Back

Struct

Front

A collection of variables of different data types that are referred to by a common name. A separate memory location is allotted to each member of the structure Minimum of 8 bytes

Back

1D Array

Front

An array where the values are stored in the form of a list. Ex: int[ ] a = {11, 22, 33, 44, 55};

Back

Static Scope

Front

Refers to the scope of variable that is defined at compile-time. It is always refers to the variable with top level environment

Back

Alias

Front

Two variables referring to the same memory location (harmful to readability)

Back

Jagged Array (3D Array)

Front

A 3D array of arrays in which the sub-arrays can be different sizes. Each row, and column can have a different number of objects

Back

L Value

Front

The address of a variable

Back

Reference

Front

An object that stores the memory address of another value located in memory. Cannot be re-assigned Cannot be assigned NULL directly

Back

names

Front

Variables do not need __________

Back

Global Variable

Front

A variable not declared in the same program subunit in which it is used (lasts program's entire run-time), and is available to every function/subunit in the program

Back

Dangling Pointer

Front

Pointers that do not point to a valid object of the appropriate type. Caused by deleting or deallocating without modifying the value of the pointer. Ex: int *aptr = new int(5); int *bptr = aptr; aptr = bptr; delete bptr; now bptr is dangling

Back

Scope

Front

The visibility of variables (Which parts of a program can use a variable)

Back

Slice

Front

An operation that extracts a subset of elements from an array and packages them as another array. Ex: a[1:3]

Back

Dynamic Binding

Front

Variables are bound to a type at run-time depending on the value assigned, and can be changed after execution

Back

Array Access

Front

Access function for single-dimensional arrays

Back

Row Major (Order)

Front

Method for storing multidimensional array where consecutive elements of a row reside next to each other Starts on the first row, then the second row, etc

Back

Memory Leak

Front

A state in which a program requests memory but never releases it, which can eventually prevent other programs from running. Caused an object stored in memory is not accessible by the running code. Ex: int *aptr = new int(5); int *bptr = new int(6); aptr = bptr; Heap storage of int 5 is no longer accessible

Back

Double

Front

A 32 bit floating point data type

Back

Primitive Data Type

Front

The most basic data types available: boolean , byte , char , short , int , long , float and double

Back

Record

Front

Aggregate of data & elements where individual elements are defined by name

Back

Block Scope

Front

The area within if, switch conditions or for and while loops.

Back

Multidimensional Array

Front

An array of arrays whose elements are stored in row-major order. Ex: int[ ][ ] a = { { 1, 2 }, { 3, 4, 5 } };

Back

Call Stack (Runtime Stack)

Front

A data structure that stores information about the active subroutines of a computer program. It is used at runtime when methods are invoked, holds "call frame" containing local variables, parameters, etc...

Back

Common int Types

Front

Byte, short, int, and long

Back

Storage Binding

Front

Allocation: getting a cell from some pool of available cells Deallocation: putting a cell back into the pool

Back

Union

Front

A collection of variables of different data types that are referred to by a common name. A single memory location is allotted to all members of the structure Minimum of 4 bytes

Back

Reserved words

Front

__________ can't be used as variable names. They vary in different languages

Back

Section 2

(17 cards)

Special Expressions

Front

A combination of one or more constants, variables, operators, and functions that the programming language interprets

Back

Mixed Mode Expression

Front

An arithmetic expression that contains two different data types. Ex: 1 + 2.5 = 3.5 2.0 / 8 = 0.25

Back

Boolean Operators

Front

&&, ||, !

Back

Strong type Language

Front

A programming language in which each type of data (integer, character, double, etc.) is predefined as part of the language. Ex: Java, Ruby, Python

Back

Type Checking

Front

The activity of ensuring that the operands of an operator are of compatible types

Back

Binary Operator

Front

An operator that has two operands

Back

Ternary Operator

Front

An operator that has three operands

Back

Unary Operator

Front

An operator that has only one operand

Back

Narrowing Conversion

Front

A conversion from one data type into another in which information could be lost. Ex: Converting from "double" to an "int"

Back

Implicit Conversion

Front

The conversion from a "lower" data type to a "higher" data type. Ex: int main() { int x = 10; char y = 'a'; // y implicitly converted to int. ASCII // value of 'a' is 97 x = x + y; // x is implicitly converted to float float z = x + 1.0; printf("x = %d, z = %f", x, z); } Output: x = 107, z = 108.000000

Back

Operator Overloading

Front

Allows you to redefine the way an operator works for user-defined types only (objects, structures). It cannot be used for built-in types (int, float, char etc.). Is generally defined by the programming language

Back

Conditional Expression

Front

Feature of a programming language, which perform different computations or actions depending on whether a specified boolean condition evaluates to true or false avg = (count == 0)? 0 : total/count; this is equicalent to: if (count == 0) avg = 0; else avf = total/count

Back

Relational Operators

Front

>, <, >=, <=, ==, !=

Back

Short Circuit Evaluation

Front

When a boolean expression is evaluated the evaluation starts at the left hand expression and proceeds to the right, stopping when it is no longer necessary to evaluate any further to determine the final outcome

Back

Widening Conversion

Front

A conversion between one data type and another in which information is not lost. Ex: Converting from an "int" to a "double"

Back

Operator Precedence

Front

The order that an operator is executed. For example, many times a multiplication operator will execute before the addition operator

Back

Explicit Conversion

Front

The conversion from a "higher" data type to a "lower" data type. Ex: int main() { double x = 1.2; // Explicit conversion from double to int int sum = (int)x + 1; printf("sum = %d", sum); return 0; } Sum = 2

Back