intro to algorithms Flashcards

1
Q

what is a program

A

A collection of computer instructions or operations grouped together in a logical manner to accomplish a given task.

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

What are the six Basic computer operations?

A

A computer can:
-receive information
-repeat a group of actions
-output information
-perform arithmetic
-assign a value to a piece of data
-compare two pieces of date and select one of two alternative actions

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

what is an algorithm?

A

it is a set of instructions or steps that are detailed, ordered and unambiguous that are developed to describe the processes necessary to produce a desired output from a given input to accomplish a task.

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

an algorithm can be represented using

A

-flowchart
and
-pseudocode

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

what is pseudocode?

A

It is a high level description of a computer program or algorithm that uses simple, English-like statements to outline the basic logic of the program

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

what are the Benefits of pseudocode

A

-Simplifies the logic of a program
-makes it easy to communicate the logic of the program to non programmers.
-can prevent common mistakes and save time.

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

what are the steps to writing pseudocode

A
  1. understand the problem
    2.Break down the problem into steps
  2. write the pseudocode
  3. test the pseudocode
  4. translate the pseudocode into actual code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the steps to developing a program?

A

1.define he problem
2. outline the problem
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
9
Q

what is a flow chart?

A

a flow chart is the graphical representation of computer logic it shows the flow of input and ouput and processes throughout the program.

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

what is program documentation?

A

this is the continuous record of the process of the program through out its creation and evaluation.

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

what are the two types of documentation?

A

external and internal documentation. external documentation includes hierarchy charts, the solution algorithm, and test data results. internal documentation is coded into the actual program and by be comments the programmer made while coding.

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

what is program maintenance?

A

Program maintenance refers to changes which may need to be made to a program throughout its usage.

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

what is selection control structure?

A

this refers to the capablity of the computer to make a decision. This deision is based on a conidtion and the action sthat can be taken given that the condition has been meet or not. In order to do so the computer program by use IF THEN ELSE, DO WHILE and CASE OF

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

what are the types of if statements

A

simple selection
simple selection with null branch
combined selection
nested if

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

what is a simple if and give and example

A

a simple if statement is when computer is given a condition and has the choice of doing one or the other action based on the condition.
e.g IF input/2 = 0
THEN PRINT “even”
ELSE PRINT “odd”
END IF

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

What is a null branch?

A

This is an if statement where if the condition is not meet then the computer must do nothing. e.g
IF input = Thursday
THEN PRINT “thats the day today”
END IF

17
Q

What is a combined if

A

This if statement incoprated the terms AND & OR. E.G
IF input <= 10 AND input >=7
THEN PRINT “You passed!”
ELSE PRINT “you failed”
END IF
If the inout is less than 10 and great then 7 then its pass if its less then 7 then fail.
BUT
IF input <10 OR input > 7
THEN PRINT “You have passed”
ELSE PRINT “invalid input”
END IF
or is a choice between the two conditions. so 8 would give u passed as it is greater the 7 and so would 6 as it is less then 10

18
Q

what is a nested if

A

This is an if statement within an if statement and can be linear of non liner.
in linear one if leads to an action or to the next if until all the conditions have been meet. where as in a non liner if, IF all the coniditions are meet it leads to action 1 if only 2 are meet it lead to action 2 if only one is meet action 3 if non then action 4.

19
Q

What is case of

A

in case of a n input has to equal to a constant in order to start the action.
CASE OF variable
Input = constant1
ACTION 1
e.tc
OTHERWISE
do Action
ENDCASE

20
Q

what is DO WHILE

A

This is a type of loop. some programs need the logic to continue over and over again. thus do while loops back to the start of the program. there are two types of do while counter-controlled and sentinel- controlled.

21
Q

what is counter controlled and give and example

A

A counter controlled loop is the definite repetition loop as the number of repetitions is known before the loop begins executing.
e.g
initialization
DOWHILE (condition)
statement_block
incrementation/DE incrementation
ENDDO

22
Q

what is a sentinel - controlled loop

A

A sentinel controlled loop is the indefinite repetition loop as the number of repetitions is not known before the loop begins executing

23
Q

What is an array?

A

Arrays are a way of storing multiple variables of the same data type under the one variable name. this way the data is organized.

24
Q
A