SIMPLE & COMPLEX DATA TYPES & VARIABLES Flashcards

Lecture 5, 6 & 8

1
Q

Bit

A

Holds one of two values: 0 or 1.
Basic & smallest block of computer memory

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

Bytes

A

8 bits

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

Word

A

Natural unit of memory for a given computer design.
Larger a word is the more information it can store

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

Integer/arithmetic data type

A

Char
Int
Short
Long

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

Floating point data types

A

Float
Double

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

Void

A

Function that returns no value: void(something)
/has no parameter: something(void)

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

Char

A

1 byte
Stores single character in single pair of quotation marks
%c

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

Int

A

2/4 bytes
Stores whole numbers
%d

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

Float

A

Single precision floating pt value
4 byte
6 decimal places
%f

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

Double

A

Double precision floating pt value
8 bytes
15 decimal places
%lf

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

Constants

A

Fixed values(literals) that the program may not alter during its
execution.

Must be defined before the main function.

Format:
#define CONSTANTNAME value

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

Long

A

Stores large integer
8 /4 bytes

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

Arrays

A

Ordered sequence of data elements of one type.

Counting begins at zero. Account for null character \0 when determining size.

Format:
type array[size];

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

Character string

A

General formats:

For word
char array[size]=”string “;

For single characters
char array[size]={‘a’,’b’,’c’,’\0’};

Function descriptor
%s
No, ‘&’ needed in scanf.

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

General string characteristics

A

type array[size];

Word
type array[size]=’string name’;
Single numbers
type array[size]={a,b,c};

Multidimensional array:
type array[size1][size2];

Multidimensional single no. :
type array[size1][size2]={{a,b,c},{d,e,f}};

17
Q

Variable

A

Tells the compiler where and how much storage to create for the variable. Specifies a data type and contains a list of one or more variables of that.
Variable names:
 should be lowercase for local variables
 should be UPPERCASE for constant