FINALS Flashcards

1
Q

are commands that enable a program to “take decisions”, following one path or another.​

A

Control Structures

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

Control Structures are commands that enable a program to ____________ , following one path or another.​

A

“take decisions

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

These are the blocks that analyze variables and choose directions in which to go based on given parameters.

A

Control Structures

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

3 types of Control Structures​

A

Conditional Structures (or Selection)​

Iteration Structures (or Looping)​

Selective Structures (switch)

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

Conditional operator

A

(? :)

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

are used to execute one or more statements if a condition is met.​

A

Conditionals (or Selection)

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

4 types of Conditional Structures

A

if statements​

if else statements​

if else if statements​

Nested if statements​

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

execute one or more statements when a condition is met. If the testing of that condition is TRUE, the statement gets executed. But if it’s FALSE (the condition is not met), then nothing happens.​

A

If statements

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

This Control Structure allows a program to follow alternative paths of execution, whether a condition is met or not.​

A

If else statements​

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

can have multiple alternative statements. ​

A

If-else if statements

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

is an if statement that is the target of another if statement.​

A

nested if

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

Use the s____________ to select one of many code blocks to be executed.​

A

Switch statement

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

Multiple – Selection Structure

A

Switch

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

The switch expression is evaluated how many times?

A

once

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

The ______ and ________ keywords are optional.

A

break and default

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

When C++ reaches a _________ keyword, it breaks out of the switch block.​

A

break

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

This will stop the execution of more code and case testing inside the block.

A

break

18
Q

This is a keyword that specifies some code to run if there is no case match.​

A

default

19
Q

refers to Switch statements inside of another Switch Statements.​

A

Nested-Switch statements

20
Q

Other word for Looping stuctures?

A

Iterative or Repetition

21
Q

There may be a situation when you need to execute a block of code several number of times.

A

Looping Structures (Iterative, Repetition)​

22
Q

In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.​

A

Looping Structures (Iterative, Repetition)​

23
Q

allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages.​

A

A loop statement

24
Q

Types of Looping Statements​

A

while Loop (Pretest loop)
do while Loop (Post-test loop)
for Loop (Counter-controlled loop)

25
Q

Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.​

A

while Loop (pretest loop)​

26
Q

Like a while statement, except that it tests the condition at the end of the loop body.​

A

do while Loop (Post-test loop)

27
Q

Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable.​

A

for Loop (Counter-controlled loop)

28
Q

is a piece of code that lacks a functional exit so that it repeats indefinitely.

A

Infinite loop or endless loop

29
Q

Flow of control in for Loop​

A

initialization step
condition / boolean expression
step expression / update statement
condition / boolean expression (until the condition has been met)

30
Q

is executed first, and only once. This step allows you to declare and initialize any loop control variables and this step ends with a semi colon (;).​

A

initialization step

31
Q

If it is true, the body of the loop is executed. If it is false, the body of the loop will not be executed and control jumps to the next statement past the for loop.​

A

condition / boolean expression

32
Q

This statement allows you to update any loop control variables. ​

A

step expression / update statement (increment)

33
Q

The ________________ is now evaluated again. If it is true, the loop executes and the process repeats. After the Boolean expression is false, the for loop terminates.​

A

condition / boolean expression

34
Q

A loop within another loop

A

nested loop.​

35
Q

is collection of items stored at contiguous memory locations. The idea is to store multiple items of same type together.

A

array

36
Q

is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed.

A

array

37
Q

Each item in an array is called an __________?

A

element

38
Q

and each element is accessed by its _________________?

A

numerical index.​

39
Q

The index of an array always starts with ?

A

0

40
Q

Array Initialization​

Initializing values to an array can be done in two ways:​

A

During initialization of the array;​

int arrayInt[] = {1,2,3,4,5};​

double arrayDouble[] = {2.5,3.2,7.0};

Assigning values by its numerical index;​

arrayInt[0] = 2;​

arrayInt[1] = 4;​

arrayInt[2] = 7;

41
Q

is an array containing one or more arrays.​

A

multidimensional array

42
Q

To create a two-dimensional array, add each array within its own set of curly braces:

A

int myNumbers[columns][rows] = { {1, 2, 3, 4}, {5, 6, 7, 8} };​