Flashcards: Problem Solving and Algorithm Analysis — 54 cards

All cards

1Question

Why is a computer called a dumb machine?

Answer

It operates strictly according to instructions and cannot perform tasks without software.

2Question

What is the first step in the program-development process?

Answer

Requirements specification.

3Question

Which step follows problem analysis in program development?

Answer

Algorithm design.

4Question

What is the final step in the program-development process?

Answer

Documentation.

5Question

What does requirements specification state about the problem?

Answer

It states the problem, required inputs and resources, expected outputs, and constraints.

6Question

What are the inputs in the apple-cost problem example?

Answer

Apple quantity in kilograms and cost per kilogram.

7Question

What is the output in the apple-cost problem example?

Answer

Total cost in rupees.

8Question

What is the formula for total cost in the apple-cost problem?

Answer

Total cost equals cost per kilogram multiplied by quantity.

9Question

What defines an algorithm in problem solving?

Answer

A complete, unambiguous, finite sequence of logical steps.

10Question

What must an algorithm's instructions be?

Answer

Clear and unambiguous.

11Question

What inputs and outputs must an algorithm have?

Answer

Zero or more well-defined inputs and one or more well-defined outputs.

12Question

What are two essential properties of an algorithm's execution?

Answer

Finite termination and feasible operations.

13Question

What independence does an algorithm have?

Answer

It is independent from programming code.

14Question

Which variables does the average-of-three-numbers algorithm read?

Answer

Variables a, b, and c.

15Question

What operations does the average-of-three-numbers algorithm perform?

Answer

It sums a, b, and c, divides by 3, stores in d, prints d, and ends.

16Question

What are the major steps in top-down algorithm design?

Answer

Get the data, perform computations, and display the result.

17Question

What three requirements must a top-down algorithm meet?

Answer

Correctness, finiteness, and efficiency.

18Question

What initial values does the factorial algorithm set?

Answer

Factorial to 1 and i to 1.

19Question

What condition controls the factorial algorithm's loop?

Answer

i is less than or equal to n.

20Question

What operation is repeated inside the factorial algorithm's loop?

Answer

Multiplying factorial by i.

21Question

What does the factorial algorithm do after completing the loop?

Answer

Prints factorial.

22Question

What is program testing?

Answer

The process of executing a program to demonstrate its correctness.

23Question

What is program verification?

Answer

The process of ensuring that a program meets user requirements.

24Question

What does program documentation include?

Answer

In-line comments and separate external files.

25Question

How does program documentation help others and the original programmer?

Answer

It helps others modify the program and helps the original programmer understand it later.

26Question

What is a flowchart?

Answer

A graphical representation of an algorithm’s logic paths and operation sequence.

27Question

Which symbol represents start and end in flowcharts?

Answer

The oval terminator symbol.

28Question

What is pseudocode?

Answer

An informal, English-like description of an algorithm without programming syntax.

29Question

What does A = 10 mean in programming?

Answer

It assigns the value 10 to A.

30Question

What does A == 10 test in programming?

Answer

Whether A equals 10.

31Question

What distinguishes low-level from high-level programming languages?

Answer

Low-level languages are hardware-close and machine-dependent, high-level are readable and portable.

32Question

What does machine-level language consist of?

Answer

Binary instructions made of 1s and 0s.

33Question

How does machine-level language execute on hardware?

Answer

It executes directly without a compiler or interpreter.

34Question

What must assembly language be translated into?

Answer

Machine code by an assembler.

35Question

Name some mnemonics used in assembly language.

Answer

ADD, SUB, INR, DCR, and CMP.

36Question

What stages does the C compilation process include?

Answer

Preprocessor, compiler, assembler, linker, loader, and execution.

37Question

How does a compiler translate source code?

Answer

It translates the entire program before execution.

38Question

How does an interpreter process source code?

Answer

It translates and executes instructions line by line.

39Question

What does time complexity measure in an algorithm?

Answer

The time or number of constant-time steps as a function of input size n.

40Question

What is the time requirement formula for adding two n-bit integers?

Answer

t(N)=cnt(N) = c \cdot n

41Question

How is space complexity expressed mathematically?

Answer

S(p)=A+Sp(I)S(p) = A + S_p(I)

42Question

What does A represent in the space complexity formula?

Answer

Fixed space independent of the problem instance.

43Question

What does Sp(I)S_p(I) represent in space complexity?

Answer

Variable space dependent on the problem instance.

44Question

What does best-case analysis measure in algorithm complexity?

Answer

The minimum number of operations performed.

45Question

What does worst-case analysis measure in algorithm complexity?

Answer

The maximum number of operations performed.

46Question

What is the best-case time complexity of linear search?

Answer

Θ(1) when the item is first.

47Question

What is the exact time cost formula for single-loop summation?

Answer

T(n)=2n+3T(n) = 2n + 3

48Question

What is the asymptotic time bound for single-loop summation?

Answer

O(n)O(n)

49Question

What is the space bound for single-loop summation and why?

Answer

O(n)O(n) because of the array.

50Question

What is the exact time cost formula for matrix addition?

Answer

T(n)=2n2+2n+2T(n) = 2n^2 + 2n + 2

51Question

What are the time and space bounds for matrix addition?

Answer

Both are O(n2)O(n^2).

52Question

What is the exact time cost formula for matrix multiplication?

Answer

T(n)=2n3+3n2+2n+2T(n) = 2n^3 + 3n^2 + 2n + 2

53Question

What is the time bound for matrix multiplication?

Answer

O(n3)O(n^3)

54Question

What is the space bound for matrix multiplication?

Answer

O(n2)O(n^2)

Test yourself with the quiz

Test your knowledge with 23 questions on Problem Solving and Algorithm Analysis.

1. Why can a computer not produce useful results without software?

2. Which sequence best represents the program-development process?

Take the quiz →

Read the study sheet

Review the complete course in the study sheet for Problem Solving and Algorithm Analysis.

See study sheet →

Similar courses

Create your own flashcards

Import your course and AI generates flashcards in 30 seconds.

Flashcard generator