Algorighims Flashcards

1
Q

What does an output of 1 indicate for the following algorithm running on a five-element list of integers?
i = 0
x = 0
while i < 5
if list[i] < 0
x = 1
i = i + 1
Put x to output

All integers are positive.

All integers are negative.

At least one integer is negative.

At least one integer is positive.

A

At least one integer is negative.

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

When should a programmer develop an algorithm to solve a problem?

Before knowing the problem

Before writing a program to solve the problem

While writing a program to solve the problem

After writing a program to solve the problem

A

Before writing a program to solve the problem

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

What is the purpose of the following class diagram?

Shows how the Employee class is used in the program

Describes the execution flow of the Employee class’ operations

Specifies the Employee class’ behavioral requirements

Depicts the Employee class’ name, data members, and functions

A

Depicts the Employee class’ name, data members, and functions

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

Which elements are characteristic of a class diagram?

System’s classes, attributes, and methods and their features, constraints, and relationships

Flow of logic and process interaction within a system

Physical resources or logical architecture of a system

Internal structure of a class and collaboration between classes or instances

A

System’s classes, attributes, and methods and their features, constraints, and relationships

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

Review the following use case diagram:

What does a use case diagram do?

Diagrams a single use case

Connects several use cases to class diagrams

Provides an overview of several use cases

Lists use case goals

A

Provides an overview of several use cases

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