Selection Statements Flashcards

1
Q

Algorithm is a procedure for solving a problem in terms of:

A
  • the actions to be executed
  • the order in which these actions are to be executed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

It is specifying the order in which statements are to be executed in a computer program

A

Program Control

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

It is an artificial and informal language that helps you develop
algorithms

A

Pseudocode

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

Not executed on computers – rather, helps us “think out” a program before starting to write the code in a programming language like C

A

Pseudocode

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

It is a graphical representation of an algorithm or of a portion of an algorithm

A

Flowcharts

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

Types of Control Structures

A
  • Sequence
  • Selection
  • Iteration
  • Function Call
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Statements are executed in a specified order

A

Sequence

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

No statement is skipped and no statement is executed more than once.

A

Sequence

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

It selects a statement to execute on the basis
of condition

A

Selection

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

Examples of Selection

A
  • if statement
  • switch statement
  • conditional operator
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When statements are executed more than one time

A

Looping/Iteration

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

Examples of Looping/Iteration

A
  • while loop
  • for loop
  • do-while loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Allows a program to choose
between two alternatives by
testing the value of an expression

A

If Statement

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

Consists of a test expression
followed by one or more
statements

A

If Statement

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

Difference between if and if-else selection

A
  • if statement performs when the condition is true
  • if-else allows to specify different actions whether the condition is true or false
17
Q

Syntax of single statement if clause

A

Great

18
Q

Syntax of multi statement if clause

A

Good job

19
Q

Syntax of if-else if else statements

A

Wow!

20
Q

Syntax of if-else statements

A

Cool!

21
Q

An alternative to if-else if-else statements

A

Switch statements

22
Q

Expression in the switch must result
in

A

integer value

23
Q

Syntax of switch statements

A
24
Q

Rules of switch statement regarding break

A

break statement must be in the end in each case.

25
Q

Rules of switch statement regarding case labels

A

Duplicate case labels or in the constant aren’t allowed

26
Q

Rules of switch statement regarding order

A

Order of the cases does not matter