Added 4, bare with me, i am sleepy
This commit is contained in:
parent
4ba88e84e5
commit
ee65eea156
@ -33,7 +33,7 @@ B49F
|
||||
011000 - D
|
||||
101101 - F
|
||||
|
||||
### What is the smallest negative integer that can be represented in a two's complement system in which each value is represented by eight bits?
|
||||
# What is the smallest negative integer that can be represented in a two's complement system in which each value is represented by eight bits?
|
||||
10000000, -128 (either is correct)
|
||||
|
||||
### Which of the following data storage systems provides the most efficient random access to individual data items?
|
||||
|
81
4_Algorithms.md
Normal file
81
4_Algorithms.md
Normal file
@ -0,0 +1,81 @@
|
||||
### In general, an algorithm in which of the following categories is considered more efficient?
|
||||
Θ(log n)
|
||||
|
||||
### Suppose the statement "X is an integer and X < 5" is a loop invariant at the point at which the test for termination is performed in the loop outlined below.
|
||||
```
|
||||
repeat ( . . . )
|
||||
until (X > 3)
|
||||
```
|
||||
### At the end of this loop, X equals?
|
||||
4
|
||||
|
||||
### What sequence of numbers would be printed if the following procedure were executed with the value of N being 0?
|
||||
```
|
||||
procedure xxx (N)
|
||||
|
||||
print the value of N;
|
||||
|
||||
if (N < 2) then
|
||||
|
||||
(apply the procedure xxx to the value N + 1)
|
||||
|
||||
else
|
||||
|
||||
(print the value of N)
|
||||
|
||||
print the value of N
|
||||
```
|
||||
0,1,2,2,2,1,0
|
||||
|
||||
### What sequence of numbers would be printed if the procedure named xxx as described below were executed with the value of N being 2?
|
||||
|
||||
```
|
||||
procedure xxx(N)
|
||||
print the value of N;
|
||||
if (N<3)
|
||||
then (apply procedure yyy to the value 4)
|
||||
procedure yyy(N)
|
||||
print the value of N;
|
||||
apply the procedure xxx to the value 5
|
||||
print the value of N
|
||||
```
|
||||
2,4,5,5,4,2
|
||||
|
||||
### Which of the following is not a way of representing algorithms?
|
||||
Stepwise refinement
|
||||
|
||||
### Q6 is a table again
|
||||

|
||||
|
||||
### Preconditions, postconditions, and loop invariants are examples of which of the following?
|
||||
Assertions
|
||||
|
||||
### The binary search algorithm is an example of an algorithm in which of the following classes?
|
||||
Θ(log n)
|
||||
|
||||
### Under the assumption that N takes on only integer values, which of the following is the termination condition in the following recursive procedure?
|
||||
|
||||
```
|
||||
procedure xxx (N)
|
||||
|
||||
if (N < 5) then
|
||||
|
||||
(apply the procedure xxx to the value N + 1)
|
||||
|
||||
else
|
||||
|
||||
(print the value of N)
|
||||
```
|
||||
N > 4
|
||||
|
||||
### When searching within the list ` Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom` which of the following entries will be found most quickly using the binary search algorithm?
|
||||
Pat
|
||||
|
||||
### Which of the following set of instructions defines an algorithm in the formal, strict sense?
|
||||
```
|
||||
X ← 3;
|
||||
|
||||
while (X < 5)do
|
||||
|
||||
(X ← X + 1)
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user