326 exam 1 and Final

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/41

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:27 PM on 7/10/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

42 Terms

1
New cards

How do we evaluate programming languages?

Readability, writability, and reliability

2
New cards

What are the evaluation criteria

1) simplicity/orthogonality

2) control structures

3) data types

4) syntax design

5) abstraction support

6) expressive

7) Type checking

8) exception handling

9) aliasing

3
New cards

What are the 3 implementation methods

1) compilation/translation

2) interpretation

3) hybrid (both)

4
New cards

What’s the difference between a compiler and interpreter

Compiler: translates source program and generates an executable

Interpreter: reads a line of code, translates it, and executes the translation

5
New cards

What are the common types of programming paradigms

imperative and declarative

6
New cards

how do we precisely describe what a program is in a language

we use grammars to describe the syntax of different languages

7
New cards

list all the terms used to describe syntax and briefly describe them

1) Lexeme: lowest level syntactic unit of a language: *, class, sum, …

2) Token: A category of lexemes: identifies, keywords, …

3) Sentence: A stream of characters over an alphabet

8
New cards

What are the 2 distinct ways to define a language

recognizer (scanner) and a generator (parser)

9
New cards

What is a metalanguage

a language used to describe another language

10
New cards

Explain how BNF can be used

to create rules for any languages

11
New cards

why are derivations important

It shows the steps/sequence of rules that must be applied to generate a sentence of a given language

12
New cards

what’s a parse tree

a tree that represents a syntactically valid program/string

13
New cards

given a parse tree and a grammar, can we always produce a correct derivation without any mistakes

yes, but ONLY if the grammar is unambiguous

14
New cards

when is a grammar ambiguous

2+ DIFFERENT parse trees for the same string

15
New cards

How do we preserve left associativity

1) Determine the precedence of all operators

2) Write the grammar in a cascading manner

16
New cards

Can we prove when a grammar is ambiguous

No, but we can demonstrate it

17
New cards

How do we precisely describe what a program is in a language

We use grammars to desceibe the sytax of deifferent languages

18
New cards

What are the 2 distinct goals of parsing

1) Determine if the program/string is syntactically correct

2) Produce/generate a unique parse tree

19
New cards

What are the 2 types of parsing algorithms that we will study

1) top down

2) bottom up

20
New cards

Top Down parsing

parse tree is created from root (start) to leaves (terminals) during a Left Most derivation

21
New cards

Bottom Up Parsing

parse tree is created from leaf nodes (terminals) to root (start symbol during a Right Most derivation

22
New cards

What is a recursive descent parsing, and how is it implemented

1) A kind of top down parsing

2) One function per non terminal with one case per different RHS (for the same LHS)

23
New cards

Provide an example of an expression that can be parsed using a recursive descent parser

A → aA | ε

w = aaa…a

24
New cards

If we let G be a grammar, then what can a parser do?

It can describe whether w (input) is the language generated by a grammar

25
New cards

What are the rules for computing the first sets

1) If X produces a terminal a, then FIRST(X) = {a}

2) If X produces ε, then FIRST(X) = {ε}

3) If X produces a mix of terminals and non-terminals, then FIRST(X) = FIRST(Y1) U FIRST(Y2) U … excluding {ε}

26
New cards

What makes a grammar LL(1)

1) No left recursive rules

2) Must pass pairwise disjoint test

27
New cards

What is “name resolution” used for?

mapping an identifier to the actual declaration or definition the identifier corresponds to

28
New cards

what can be named

classes

parameters

fields

functions

local variables

global variables

packages

name spaces

files

29
New cards

what do we mean by “this is the scope of variable x”?

where x exists in memory

where x can be read/modified

where x is visible to the compiler

30
New cards

what’s the difference between static and dynamic scope

static: scope of a variable is determined at compile time by looking upwards int the code (symbol table)

dynamic: scope of a variable is determined at runtime based on the call stack

31
New cards

what is an activation record? How are they represented

1) a data structure used by a program during function calls

return address (caller)

arguments

local vars

registers

static/dynamic links

32
New cards

what is a primitive or atomic type?

simplest type provided by a language: int, float, etc

33
New cards

what is a constructed type?

types that are built by combining primitives and or other constructed types: arrays, structs, classes, etc.

34
New cards

why can’t floating point values be accurately represented in memory

because of how binary numbers represent real numbers

35
New cards

explain why a boolean type is not an actual type in C/C++

there isnt a special boolean register

bool is just a macro definition

36
New cards

what’s the difference between structs and unions

struct: stores multiple variables together, each with its own scope

union: stores only one of many vars at a time to save memory

37
New cards

name 4 different types of binding times and explain them

Language design time: any legal construct in the language - if(a>b){}

Language Implementation: representation of literals/values - int num = 3;

Compile time: binding happens during compilation - static double PI = 3.14

Runtime: binding happens during execution - int * ptr = new int;

38
New cards

at what time does the binding of a value to a variable “x” occur?

Global: during compilation

Local: during execution

39
New cards

what is static binding or early binding?

association of a name to a symbol (entity) at compile time

static double PI = 3.14

40
New cards

what is dynamic binding or late binding

association of a name to a symbol (entity) at run time

int * ptr = new int;

41
New cards

what does strongly typed mean? Is C++ strongly typed?

All type related errors are caught at compile time. C++ is NOT strongly typed: pointers, inheritance, and polymorphism

42
New cards

Explore top flashcards

WY 4 Unit 4
Updated 1064d ago
flashcards Flashcards (40)
Ordlista 1
Updated 498d ago
flashcards Flashcards (30)
Bio Cell Membrane
Updated 512d ago
flashcards Flashcards (22)
AP EURO unit 1
Updated 904d ago
flashcards Flashcards (34)
Vocab 6B
Updated 1148d ago
flashcards Flashcards (23)
german final vocab
Updated 1157d ago
flashcards Flashcards (78)
WY 4 Unit 4
Updated 1064d ago
flashcards Flashcards (40)
Ordlista 1
Updated 498d ago
flashcards Flashcards (30)
Bio Cell Membrane
Updated 512d ago
flashcards Flashcards (22)
AP EURO unit 1
Updated 904d ago
flashcards Flashcards (34)
Vocab 6B
Updated 1148d ago
flashcards Flashcards (23)
german final vocab
Updated 1157d ago
flashcards Flashcards (78)