Control Flashcards

1
Q

What does the ‘if’ statement do?

A

It evaluates a specific condition and if it’s met, executes the branch of code.

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

What is the syntax for a basic if statement?

A

if ( condition )
{
body;
}

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

What is the operator used to compare if two values are equal?

A

The ‘==’ operator

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

What does the ‘!’ operator do?

A

It inverts a value

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

What is the value of ‘x’ after the code is executed?

int x = 9;
if (x != 10)
{
   x = 10;
} 

x += 3;

A

x = 13

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