Week 1 Flashcards

1
Q

What are the 4 most common types of the C language for performing arithmetic calculations?

A

Char
Int
Float
Double

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

What is a type?

A

A rule that defines how to store values in memory and which operations are admissible on those values.

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

What is a char?

A

Occupies one byte and can store a small integer value, a single character, or a single symbol

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

What is an int?

A

Occupies one word and can store an integer value. In a 32 bit environment, an int occupies 4 bytes.

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

What is a float?

A

Typically occupies 4 bytes and can store a single-precision, floating point number

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

What is a double?

A

Typically occupies 8 bytes and can store a double-precision, floating point number.

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

What is a size specifier?

A

Adjusts the size of the int and double types

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

What are the 3 type int size specifiers?

A

Short
Long
Long Long

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

How many bits does a short int contain?

A

At least 16 bits

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

How many bits does a long int contain?

A

At least 32 bits

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

How many bits does a long long int contain?

A

At least 64 bits

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

What is a const qualifier?

A

Any type that can hold a constant value. A constant value cannot be changed. To qualify a type as holding a constant value, use the keyword const. A const is unmodifiable.

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

What are the 2 integral types? What are the 2 floating-point types?

A

Integral types: char, int

Floating-point types: float, double

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

How are integral types stored?

A

The integral types (char and int) are stored in equivalent binary form. Binary form represents the value stored exactly. The integral types are short, long, signed, unsigned, and plain ints.

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

How are floating-point types stored?

A

Stored as tiny and big values from being separated into three components: a sign, an exponent, and a significand.

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

How are characters and symbols stored?

A

In char types. Characters and symbols cannot be represented in binary form.

17
Q

What is a value range?

A

The number of bytes allocated for a type that determines the range of values that the type can store

18
Q

What is a declaration?

A

A program variable with a type. The type identifies the properties of the variable

Ex. [const] type identifier [=initial value]

19
Q

How do you group multiple declarations that share the same type?

A

Separate the identifiers with commas.

Ex. char children, digit
int nPages,nBooks,nRooms
float cashFare, height, weight
double loan, mortgage

20
Q

We may select any identifier as a variable as long as it satisfies the following name conventions:

A
  • starts with a letter or underscore
  • contains any combination of letters, digits, and underscores
  • contains less than 32 characters
  • is not a C reserved word