Lecture2a- Algorithm.pdf Flashcards

1
Q

What is the main purpose of writing a program?

A

To solve a problem by designing, implementing, and testing a solution.

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

What are the key steps in solving a problem through programming?

A

Understand the problem
Design a solution
Consider alternatives and refine the solution
Implement the solution
Test the solution

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

Why is breaking a solution into smaller pieces important?

A

It makes the solution manageable and allows for better organization, especially using object-oriented programming.

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

What are the four basic software development activities?

A

Establishing requirements (What the program must do)
Creating a design (How the program will work)
Implementing the design (Writing source code)
Testing (Ensuring the program works correctly)

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

What is an algorithm?

A

A step-by-step set of instructions to solve a problem, acting as a blueprint for writing a program.

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

What are the steps (psuedocode) to calculate the area of a circle?

A

Get the radius.
Compute the area using the formula A = π × r × r.
Display the result.

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

What is pseudocode?

A

A mix of natural language and programming concepts used to outline a solution before coding.

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

What is a flowchart?

A

A diagram that represents an algorithm using symbols (e.g., rectangles for processes, diamonds for decisions).

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

Describe the psuedocode for converting Celsius to Fahrenheit?

A

Declare variables: TempCelsius, TempFahrenheit.
Prompt the user for a Celsius input.
Store the user input in TempCelsius.
Calculate TempFahrenheit = (TempCelsius × 9/5) + 32.
Display the Fahrenheit value.

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