203 Flashcards

1
Q

What is boolean?

A

This is a type of variable where it can only be true or false

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

How is an if statement executed?

A

If the conditional statement is true then the block of code will be executed.

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

What is the condition for a While loop to loop?

A

The statement must be true.

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

What is the condition for a for loop to loop?

A

As long as the statement is true.

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

What is a do while loop?

A

The contents of the loop is executed before the condition is quieried

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

What is the difference between a for loop and while loop?

A

A for loop has an initialisation part and an incrementor part that increments every time the loop loops

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

Why would you use a for loop instead of a while loop?

A

When the number of loops is known before hand

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