Unit 1 : Algorithm Introduction Flashcards

1
Q

What is a program? ( 4 )

A
  1. Is a collection of computer instructions or operations
  2. grouped together
  3. logical manner
  4. accomplish a given task.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Basic Computer Operations ( 6 )

A

A computer can:
1. receive information. → input
2. produce information. → output
3. perform arithmetic ( Basic Calculation + , - , * , / )
4. assign a value to a piece of data.
5. compare two pieces of information and select one of two alternative actions.
6. repeat a group of actions.

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

What is Problem Solving refer to?

A
  1. The entire process of taking the statement of a problem and developing a computer program that solves that problem.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an Algorithm?

A
  1. Instructions to describe the processes necessary to produce the desired output from a given input
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Key characteristics of an effective algorithm ( 5 )

A
  1. Step-by-step
  2. Detailed
  3. Unambiguous ( Must be clear that what is meant )
  4. Follow logical orders for Coffectness & Efficiency
  5. Input & Output
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What tools can we represent algorithm ? ( 2 )

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

What are the standard rules to pseudocode? ( 5 )

A
  1. Statements are written in simple English. → semiformal
  2. Each instruction is written on a separate line.
  3. Keywords and indentation are used to signify particular control structures
  4. Each set of instructions is written from top to bottom, with only one entry and one exit.
  5. Write whatever you want but it must be understandable to others ( Pseudocode doesn’t have any standard )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of define the procedual logic of an algorithm using Pseudocode? ( 2 )

A
  1. Easy to understand for its readers.
  2. Free of syntactical complications of programming language. ( a broadmap without using complicated programming language )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does flowchat use to represent the program logic?

A
  1. Shapes ( Geometrical symbols and lines which are connected according to the logic of the algorithm )
  • Graphical Representation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the steps to develop a program? ( 7 )

A
  1. Define the problem.
  2. Outline the solution.
  3. Develop the outline into an algorithm.
  4. Test the algorithm for correctness.
  5. Code the algorithm into a specific programming
    language.
  6. Run the program on the computer.
  7. Document and maintain the program.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How can we define the problem when developing our program ?

A
  1. Divide into 3 separate components
    • Inputs : a list of source data provided to the problem
    • Outputs : a list of the outputs required
    • Processing: a list of actions needed to produce the required outputs
  2. It can presented in an IPO chart ( Tables dividing Input, Processing and Output )
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does outline the solution do ?

A
  1. breaking down the problem into manageable parts and identifying the key components needed to solve it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can we outline the solution? ( 5 )

A
  1. Major processing tasks involved. ( The major processing tasks would include summing the numbers and dividing the sum by the count )
  2. Major subtasks (if any) ( Other features, like letting user decide how many numbers to sum up )
  3. Major control structures ( Conditions [ if-else ] , Loops [ while, for ], Functions, Classes )
  4. Major variables ( sum, num1 , averageNumber )
  5. Mainline logic ( how to calculate average number )

Example : Write a program to calculate the average of a list of number

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

How to develop ( write out ) an algorithm using what tools ? ( 2 )

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

List out all the common terms used ( 5 )

A
  1. Start / End
  2. Display ( Print )
  3. Prompt user for ( Read )
  4. If () Then, Else, Endif
  5. Dowhile (), Enddo
  • We can also write it in our own ways
    Write ENDIF in the last if or elseif or else statement
    Same as Enddo
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does diamond indicate?

A
  1. Point where decision is made
15
Q

What does the hexagon indicates?

A
  1. The beginning of the repetition structure
16
Q

What does the double line rectangle indicates?

A
  1. Used at a point where a subprogram is used
17
Q

What does the arrow indicates?

A
  1. The direction of flow of the algorithm
18
Q

What does circles with arrows indicate

A
  1. To connect the flowchart between pages
19
Q

What is the most important and the most often forgotten steps?

A
  1. Test Algorithm for Correctness
20
Q

What is the main purpose for testing algorithm for correctness?

A
  1. To identify major logic errors early, so that they may be easily corrected
21
Q

What do we do when we are in Step 5 : Code th Algorithm?

A
  1. Code the algorithm into a specific programming language
22
Q

What should we do when we are in Step 6 : Run the Program? ( 2 )

A
  1. Use the program compiler
  2. Use programmer-designed test data to machine-test the code for both syntax and logic errors
23
Q

What are program maintenance

A
  1. Refers to changes which may need to be made to a program
24
Q

What is the oval shape in flowchart indicate?

A
  1. The beginning or end of an algorithm
25
Q

What does the parallelogram indicates in flowchart?

A
  1. The input or output of information
26
Q

What does rectangle indicate in flowchart ?

A
  1. A computation ( calculation ) , with the result of the computation assigned to a variable
27
Q

What does good structured programming refers to? ( 3 )

A
  1. Structure Theorem
  2. Top Down Development
  3. Modular Design
28
Q

What does structure theorem in structured programming refers to? ( 3 )

A
  1. Sequence
  2. Selection ( IF - THEN - ELSE )
  3. Repetition ( DOWHILE )
29
Q

What does top down development in structured programming refers to? ( 3 )

A
  1. Outline general solution
  2. Break down into detailed steps
  3. Also known as stepwise refinement or functional decomposition
30
Q

What does modular design in structured programming refers to? ( 2 )

A
  1. Grouping tasks together because they all perform the same function
  2. Aids in reading and understanding the program
31
Q

Should we do the program documentation after finishing the program?

A
  1. No
  • It should start it early and continue throughout the development process
32
Q

Is writing program documentation an ongoing task? When should it start and when should it end? ( 3 )

A
  1. Yes, it was an ongoing task
  2. Initial definition
  3. Final test result
33
Q

What does program documentation includes? ( 2 )

A
  1. External Documentation
    • Hierarchy Charts
    • Solution Algorithm
    • Test Data Results
  2. Internal Documentations