CMSC330 True False Questions

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/63

flashcard set

Earn XP

Description and Tags

Final Exam

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

64 Terms

1
New cards

In Ocaml, the terms values and expressions can be used interchangeably

F

2
New cards

Using mutable variables can cause side effects

T

3
New cards

Due to Ocaml’s type constraints, you cannot make a list of functions

F

4
New cards

fold_left’s accumulator cannot be a tuple

F

5
New cards

Regular Expressions can only describe a finite set of strings

F

6
New cards

No regular expression can describe strings of any length that contain any number of balanced parentheses

T

7
New cards

The expression (fun x y → 3) (print_string “a”) (print_string “b”) always prints out “ab”

F

8
New cards

Property Based Testing is intended to completely replace unit testing

F

9
New cards

Using only the reference counting garbage collection technique will result in certain data structures not being freed

T

10
New cards

Rust’s Type System prevents use after free (ignoring the unsafe keyword and the RC module)

T

11
New cards

A reference’s lifetime is part of its type

T

12
New cards

A conservative Garbage Collector will not free data if it is unsure if the data is still in use

T

13
New cards

Mark and sweep solves the problem of fragmentation in garbage collection

F

14
New cards

Rust’s Type System allows use after free (ignoring the unsafe keyword and the RC module)

F

15
New cards

A variable’s lifetime and their scope are the same thing.

F

16
New cards

Modern garbage collectors use one type of garbage collection algorithm exclusively.

F

17
New cards

Using reference counting garbage collection technique ensures that all data structures are freed

F

18
New cards

In Rust, values are freed once their lifetime ends.

F

19
New cards

A reference’s lifetime is not a part of its type.

F

20
New cards

Mark and Sweep garbage collection technique halves usable memory.

F

21
New cards

Reference counting garbage collection technique ensures cyclic data structures gets freed

F

22
New cards

A piece of data can have multiple immutable references to it.

T

23
New cards

Modern Garbage Collectors use a mix of different garbage collection techniques.

T

24
New cards

Regular expressions can describe strings with 2 sets of balanced parenthesis

T

25
New cards

in the expression let x = ref 4 in let y = x in !y, both x and y point to the same thing

T

26
New cards

The concept of fold is limited to lists

F

27
New cards

The variables f in let f () = print_int 3andlet f = print_int 3 have the same behavior when used

F

28
New cards

Regular expressions cannot describe arbitrarily sized palindromes

T

29
New cards

In the expression let x = ref 4 in let y = x in !y, x and y point to different memory addresses

F

30
New cards

You can write map in terms of fold_left / fold_right (ignoring side effects/unit operations)

T

31
New cards

let f () = print_int 3 and let f = print_int 3 have the same behavior when using f

F

32
New cards

Regular expressions can describe strings with an arbitrary number of balanced parenthesis

F

33
New cards

In OCaml, all values are expressions but not all expressions are values

T, everything is an expression, but 2 + 3 is not a value

34
New cards

In OCaml, all expressions are values but not all values are expressions

F, everything is an expression, but 2 + 3 is not a value

35
New cards

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

36
New cards

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

37
New cards

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

38
New cards

A function with type int-> float-> bool returns 2 things: a float and a bool

F, Functions return only 1 thing ever

39
New cards

A function with type int-> bool-> float could be interpreted as returning a bool-> float function

T, Currying allows for this interpretation

40
New cards

let f x = x + 3 is an example of a higher order function

F

41
New cards

let f x = x 3 is an example of a higher order function

T

42
New cards

An OCaml function can return different types depending on how it’s called

F

43
New cards

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

44
New cards

Stop and Copy Garbage collection will not clean up cyclic data structures

F

45
New cards

The rules of references that Rust uses helps prevents double frees

F

46
New cards

Both Ocaml and Rust are statically typed

T

47
New cards

In Rust, null pointer exceptions will not occur

T

48
New cards

The LL(k) parser we used in project 4 runs in little-o(n) time where n is the number of tokens.

T

49
New cards

In Rust, a reference’s lifetime is part of its type

T

50
New cards

In Rust, a reference’s lifetime is not part of its type

T

51
New cards

Rust is Turing complete which means it can solve more problems than Ocaml

F

52
New cards

Regular Expressions can recognize strings of arbitrary length with balanced parenthesis

F

53
New cards
54
New cards
55
New cards
56
New cards
57
New cards
58
New cards
59
New cards
60
New cards
61
New cards
62
New cards
63
New cards
64
New cards