Computer Systems Flashcards

1
Q

What are the 3 main uses of symbols in Assembly Languages ?

A

1,2) Labels - Assembly programs can declare and use symbols that mark
various locations in the code, for example, LOOP and END.
3,4) Variables: Assembly programs can declare and use symbolic variables, for
example, i and sum.
5) Predefined symbols: Assembly programs can refer to special addresses in the computer’s memory using agreed-upon symbols, for example, SCREEN and KBD.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a Assembler Do ?

A

1,3) can translate symbolic programs
4,5) into binary code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does a Parser Do ?

A

1) reads a stream of tokens
2) (created by Lexer)
3,4) and checks if tokens conform to a specific grammer or syntax
5) (HACK = nand2tetris) (SAL = dj barnes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does a Lexical Analyser Do ?

A

1,3) break up the input code into a sequence of tokens
4,5)that can be processed by the parser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Not gate

A

(1,2) CHIP Not {
IN in;
OUT out;

(3,5) PARTS:
Nand (a=in, b=in, out=out);

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

And gate

A

(1) CHIP And {
IN a, b;
OUT out;

PARTS:
(2,3) Nand (a=a, b=b, out=c);
(4,5) Nand (a=c, b=c, out=out);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Or Gate

A

CHIP Or {
IN a, b;
OUT out;

PARTS:
Nand (a=a, b=a, out=c)
Nand (a=b, b=b, out=d)
Nand (a=c, b=d, out=out)
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Commutative Laws (Boolean Logic)

A

order in which we write logical operators ‘AND’ ‘OR’ we can switch the order of the perands without changing the outcome.
example: ‘AND’ operator, A AND B is the same as B AND A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Associative Laws (Boolean Logic)

A

tell us the order in which group the logical operators ‘AND’ ‘OR’ does not effect final result of operation.
example: given expression A AND (B AND C) we can use associative law and AND group it as (A AND B) AND C or OR to (A OR B) OR C and the result will be same

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Distributive Laws (Boolean Logic)

A

tell us how we can combine logically operators ‘AND’ ‘OR’ in different ways, law state that we can ‘distribute’ an operator over another to simplify complex logical expression.
example: if we have A AND (B OR C) we can use distributive law to rewrite it as (A AND B) OR (A AND C) another example A OR (B AND C) to rewrite it as (A OR B) AND (A OR C)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

De Morgan’s Law (Boolean Logic)

A

two rules that help us negate complex boolean expressions
The negation of a logical “AND” is the same as the logical “OR” of the negations of the terms. In other words, NOT (A AND B) is the same as NOT A OR NOT B.
The negation of a logical “OR” is the same as the logical “AND” of the negations of the terms. In other words, NOT (A OR B) is the same as NOT A AND NOT B.
example: NOT (A AND B) use de morgan law to rewrite as NOT A OR NOT B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a subroutine?

A

can be eithera consturctor, method or function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

subroutine ‘constructor’

A

that create new objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

subroutine ‘method’

A

operate on the CURRENT object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

subroutine’function’

A

that operate on no particular object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly