Week 7 (making decisions 3) Flashcards

1
Q

What is the scope of variables?

A

Live and die by the block

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

When can you use variables with the same name?

A

When they are in nested blocks

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

How can you compare chars?

A

with the greater than and less than operators, as well as the ==

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

How do you compare string objects?

A

with < , > , == (compares char for char and if they are all equal then the whole thing is equal.

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

what is the conditional operator? (syntax)

A

first expression to be tested ? executes if true : executes if false;

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

syntax for switch statement

A

switch (IntegerExpression)
case ConstantExpression:
statement;
break;

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

what is an enumerated data type?

A

set of named integer constants

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

Are enums string literals?

A

No, they are named constants.

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

Can you set enums = 1;

A

no

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

how to check if files exsist

A

if (!inputfile)

if(inputFile.fail)

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