1/63
Final Exam
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
In Ocaml, the terms values and expressions can be used interchangeably
F
Using mutable variables can cause side effects
T
Due to Ocaml’s type constraints, you cannot make a list of functions
F
fold_left’s accumulator cannot be a tuple
F
Regular Expressions can only describe a finite set of strings
F
No regular expression can describe strings of any length that contain any number of balanced parentheses
T
The expression (fun x y → 3) (print_string “a”) (print_string “b”) always prints out “ab”
F
Property Based Testing is intended to completely replace unit testing
F
Using only the reference counting garbage collection technique will result in certain data structures not being freed
T
Rust’s Type System prevents use after free (ignoring the unsafe keyword and the RC module)
T
A reference’s lifetime is part of its type
T
A conservative Garbage Collector will not free data if it is unsure if the data is still in use
T
Mark and sweep solves the problem of fragmentation in garbage collection
F
Rust’s Type System allows use after free (ignoring the unsafe keyword and the RC module)
F
A variable’s lifetime and their scope are the same thing.
F
Modern garbage collectors use one type of garbage collection algorithm exclusively.
F
Using reference counting garbage collection technique ensures that all data structures are freed
F
In Rust, values are freed once their lifetime ends.
F
A reference’s lifetime is not a part of its type.
F
Mark and Sweep garbage collection technique halves usable memory.
F
Reference counting garbage collection technique ensures cyclic data structures gets freed
F
A piece of data can have multiple immutable references to it.
T
Modern Garbage Collectors use a mix of different garbage collection techniques.
T
Regular expressions can describe strings with 2 sets of balanced parenthesis
T
in the expression let x = ref 4 in let y = x in !y, both x and y point to the same thing
T
The concept of fold is limited to lists
F
The variables f in let f () = print_int 3andlet f = print_int 3 have the same behavior when used
F
Regular expressions cannot describe arbitrarily sized palindromes
T
In the expression let x = ref 4 in let y = x in !y, x and y point to different memory addresses
F
You can write map in terms of fold_left / fold_right (ignoring side effects/unit operations)
T
let f () = print_int 3 and let f = print_int 3 have the same behavior when using f
F
Regular expressions can describe strings with an arbitrary number of balanced parenthesis
F
In OCaml, all values are expressions but not all expressions are values
T, everything is an expression, but 2 + 3 is not a value
In OCaml, all expressions are values but not all values are expressions
F, everything is an expression, but 2 + 3 is not a value
map (fun x-> x + 1) a will modify the list a in-place
F, map doesn’t modify anything in place because lists are immutable in OCaml
Having mutable variables can make it hard to reason about how a program runs
T, Side effects occur when we have mutability, this can be difficult to reason about
Having immutable variables can make it easy to reason about how a program runs
T, Its very easy to write mathematical proofs about our program if there is no mutability
A function with type int-> float-> bool returns 2 things: a float and a bool
F, Functions return only 1 thing ever
A function with type int-> bool-> float could be interpreted as returning a bool-> float function
T, Currying allows for this interpretation
let f x = x + 3 is an example of a higher order function
F
let f x = x 3 is an example of a higher order function
T
An OCaml function can return different types depending on how it’s called
F
let x = 3 in let x = 4 in x is an example of variable shadowing
T, This returns 4 and variables are immutable so shadowing does occur
Stop and Copy Garbage collection will not clean up cyclic data structures
F
The rules of references that Rust uses helps prevents double frees
F
Both Ocaml and Rust are statically typed
T
In Rust, null pointer exceptions will not occur
T
The LL(k) parser we used in project 4 runs in little-o(n) time where n is the number of tokens.
T
In Rust, a reference’s lifetime is part of its type
T
In Rust, a reference’s lifetime is not part of its type
T
Rust is Turing complete which means it can solve more problems than Ocaml
F
Regular Expressions can recognize strings of arbitrary length with balanced parenthesis
F