Fundamentals of Algorithms Study Notes
What is an algorithm?
a) A finite set of undefined instructions
b) A finite set of well-defined instructions used to solve a problem
c) A random sequence of computational steps
d) None of the aboveWhich of the following characteristics is NOT part of a good algorithm?
a) Effectiveness
b) Finiteness
c) Ambiguity
d) Definiteness**What does the notation *
X = Y* mean?**
a) Assign value of X to Y
b) Assign value of Y to X
c) Get value of Y from X
d) None of the aboveIdentify the control structure used when the instructions are executed in order.
a) Selection
b) Iteration
c) Sequence
d) None of the aboveWhat is the general form of a WHILE loop?
a)WHILE (condition) DO
b)IF (condition) THEN
c)FOR I ← start TO end DO
d)REPEATIn a selection control structure, what does an IF statement do?
a) Executes instructions in order
b) Chooses between two or more paths
c) Repeats instructions
d) None of the above**What does the notation *
X ← X + Y* indicate?**
a) Assign value Y to X
b) Increment X by Y
c) Add Y to X's current value
d) None of the aboveWhich of the following is an example of an algorithm?
a) Algorithm to find the sum of two numbers
b) Algorithm to create a graph
c) Algorithm to sort a list of names
d) All of the above