CS4080 Final

studied byStudied by 87 people
5.0(1)
get a hint
hint

Name 3 of the most important domain areas that have historically driven the design of programming language, and name one such language for each area.

1 / 65

Tags and Description

66 Terms

1

Name 3 of the most important domain areas that have historically driven the design of programming language, and name one such language for each area.

Scientific Computation - Fortran

AI - Lisp python

Enterprise - Java Cobalt

Systems programming - C Pearl

Web applications - Javascript, Typescript, PHP

New cards
2

Describe how computer architecture can affect the design of programming languages.

languages that follow the designed of a computer’s architecture can be followed easily, while languages that use abstractions are harder to translate. This is why early languages followed computer architecture.

New cards
3

Describe the different ways in which a programming language may be implemented.

compiler: take source code and turns it into machine code

interpreter: program that reads source code and executes it

virtual machine: code is compiled into byte code, instructions are simulated in software

New cards
4

Describe the two components of a programming language.

syntax: rules to write valid words in the language

semantics: the meaning of sentences within the language

New cards
5

What is the alphabet of a programming language?

set of all valid symbols in the language

New cards
6

What is the difference between reserved words and keywords?

reserve words: words that may or may not be used by the language (could be used in future updates)

key words: reserved words with functionality in the language

New cards
7

What does it mean for a language to be Case Sensitive? Give an example.

keywords, variables, function names, and other identifiers must always be typed with a constant capitalization of letters

EX:

“while” != “While”

New cards
8

What does it mean for a language to be Case Insensitive? Give an example.

the language can ignore the differences between upper and lowercase letters

EX:

“while” = “WHILE”

New cards
9

What are the stages of a compiler?

LSSTOT

Lexical analysis

Syntax analysis

Semantic analysis

Translation

Optimization

Transcription

New cards
10

What is a variable?

a name for memory location that holds a value of a particular data type that can be destructively updated

New cards
11

What is the difference between L-values and R-values?

L-value: value of memory location that holds the value you are storing in the variable

R-value: the actual value you are storing in the location

New cards
12

Describe the phenomenon known as memory aliasing.

when a memory location can be accessed through more than one name (when 2 or more variable have the same L)

New cards
13

What is name binding?

the associating of a name with a specific value/property (memory, type, scope)

New cards
14

What is Static Binding?

when a name is connected to a property before execution

New cards
15

What is Dynamic Binding?

when a name is connected to a property during exection

New cards
16

Describe static allocation.

when memory is allocated before execution, typically done by the compiler

New cards
17

Where is the data placed when allocated statically?

the .data section / segment

New cards
18

Describe Dynamic Allocation.

when memory is allocated during execution, usually incurs overhead

New cards
19

Where is data placed when allocated dynamically?

the .heap section / segment

New cards
20

Describe static typing.

name is assigned a type before execution

New cards
21

Describe dynamic typing.

name is assigned a type during execution

New cards
22

What is the difference between Explicit and Implicit typing?

if the language requires the use to explicitly specify the type of an element with a syntactic feature the it has explicitly typing, otherwise it is implicit

New cards
23

Describe Static Scoping.

(lexical scoping) when the scope of a name is defined at programming / writing time with lexical features

New cards
24

Describe Dynamic Scoping.

The scope of a name is defined while the program is run by looking at the current state of the stack of activation records.

New cards
25

Give a list of 5 primitive data types and their typical sizes.

(all in bytes)

int - 4

long - 8

char - 1-4

float - 4

short - 2

boolean - 1

byte - 1

New cards
26

what is a constant size string?

can be implemented with arrays and may or may not be immutable, these are very fast to access and travers. modifying it may involve allocating a new string which is expensive

New cards
27

what is a dynamic size string?

can be implemented with buffered arrays or linked-lists, these are slower to read (not so much if buffered array is used)

New cards
28

Why must the elements of an array be all of the same type?

in order to iterate though an array all elements must be the same type and size in terms of bits

New cards
29

Why must the size of an array be immutable?

arrays are usually stored in contiguous blocks of memory, once the block of memory is allocates it is hard to iterate though is you want to add more space

New cards
30

What are associative arrays?

arrays where the subscript is not an integer, but a string or some other type, these are maps in which a string is a key that must be unique for every element that it is mapping.

New cards
31

Describe array-of-arrays implementation of multi-dimensional arrays.

array is stored in an array, which allows for contiguous allocation which is fast since it is all in one block.

EX:

Array [ref1, ref2]

Ref1 = [2,3]

Ref2 = [4,6]

New cards
32

Describe sequential-allocation implementation of multi-dimensional arrays.

array is stored all in one block, the first element tells where to jump to and the second tells which element is implemented

EX:

Array[[1,2][4,6]]

New cards
33

What are jagged arrays?

arrays in which at least one dimension is variable instead of constant

New cards
34

List the different kind of expressions in a programming language.

relational expression

logical expression

New cards
35

What is the arity of an operator?

the number of operands in which an operator operates.

New cards
36

what is prefix

operator is placed before the operand (+3,4)

New cards
37

what is infix

operator is placed between the operands (3+4)

New cards
38

what is suffix

operator is placed after the operand (x++)

New cards
39

what is left to right evaluation

when evaluation happens starting from the left reading to the right

EX:

x + 3 - 2 = (x+3)-2

New cards
40

what is right to left evaluation

when evaluation happens starting from the right reading to the left

EX:

x + 3 - 2 = x+(3-2)

New cards
41

Describe precedence.

a mechanism to sort ambiguous expressions by creating a hierarchy of operators where the position of the hierarchy determines the binding strength

New cards
42

What does it mean for the evaluation of an expression to have a side-effect?

the evaluation results in a visual change or destructive update of memory

New cards
43

What does it mean for an expression to be pure?

when an expression is side effect free

New cards
44

What is Referential Transparency?

if the substation of the expression by the value it yields results in a program with the same semantics

New cards
45

What are mixed-mode expressions?

and expression with more than one type of operand

New cards
46

what is type coercion?

the conversion is implicit / automatic

New cards
47

what is type casting?

the conversion is explicit and performed with some syntactic feature in the language

New cards
48

Describe short-circuit of logical expressions.

a form of lazy evaluation given a binary operation, is the evaluation of the first operand is enough to determine a value, the second is not evaluated

New cards
49

What is an assignment?

the cornerstone of imperative languages since they are used to perform destructive updates

New cards
50

List the different kinds of assignments and provide examples.

simple: x=e

parallel: x,y = 1,2

multiple: x,y,z=42

compound: x+=1

unary: x++

conditional: x=if b then E1, else E2

New cards
51

What is a restricted-unconditional jump? Provide an example.

similar to goto, it allows one to jump unconditionally to a target instruction

EX:

(i) x=y+1

Goto (i+j)

(i+j) z=42

New cards
52

what is pass by value copy?

when you make a copy of the value and pass it, this does not affect the original value

New cards
53

what is pass by reference?

when you pass the memory location of the value, this will change the original value even outside the function

New cards
54

what are formal parameters?

variables that are defined when the function is declared

EX:

func int x: {}

New cards
55

what are arguments?

variables that are declared when the function is called

EX:

number(12)

New cards
56

what is the difference between formal parameters and arguments?

arguments are passed into the function and parameters are what the function takes in as an argument

New cards
57

what is positional parameter?

arguments bind to the parameter according to the position

EX:

int f(x,y,z)

return x,y,z

int r call f(1,2,3) //x=1,y=2,z=3)

New cards
58

what is keyword parameter?

arguments binding is explicitly specified using the name of the parameter

EX:

s = call f(y=2, x=1, z=3)

New cards
59

What are default parameters?

when the language allows you to specify default values for the parameters

EX:

fun int f(x,y=2,z)

int t = call f(x=1, z=3)

New cards
60

name the main evaluation criteria for programming language design.

simplicity

orthogonality

lv of abstraction

portability

cost

expressivity

New cards
61

simplicity

language with minimal set of features with rules on how to apply them and combine them as simply and clearly as possible

New cards
62

orthogonality

the way different constructs can be combined, and how simple these combinations are to understand

New cards
63

lv of abstraction

the features provided to create abstraction

New cards
64

portability

how easy it is for a program to be created in the language can be moved from one system to another

New cards
65

cost

cost of using language in a project (development, maintenance, execution)

New cards
66

what are the 3 paradigms of programming languages

function

imperative

logical

New cards

Explore top notes

note Note
studied byStudied by 11 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 66 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 42 people
Updated ... ago
4.0 Stars(1)
note Note
studied byStudied by 15 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 29 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 93 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 11922 people
Updated ... ago
4.8 Stars(78)

Explore top flashcards

flashcards Flashcard38 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard42 terms
studied byStudied by 133 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard41 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 168 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard255 terms
studied byStudied by 81 people
Updated ... ago
4.2 Stars(5)
flashcards Flashcard44 terms
studied byStudied by 30 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard33 terms
studied byStudied by 2 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard39 terms
studied byStudied by 197 people
Updated ... ago
5.0 Stars(1)