02 - Data Types Flashcards

1
Q

What value will sizeof(char) always return?

A

1

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

What type is missing in this hierarchy?

char <= ??? <= int <= long <= long long

A

short

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

How many bytes does the C standard require for the short data type?

A

> = 2

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

How many bytes does the C standard require for the intndata type?

A

> = 2

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

How many bytes does the C standard require for the long data type?

A

> = 4

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

How many bytes does the C standard require for a pointer?

A

Nothing

The standard does not define the length of a pointer

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

What is the data type of this constant?

7

A

Integer (int by default)

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

What is the data type of this constant?

3.141

A

Floating point (double by default)

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

What is the data type of this constant?

-12.4e-24

A

Floating point (double by default)

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

What is the data type of this constant?

1000000000ll

A

long long

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

What is the data type of this constant?

902ul

A

unsigned long

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

What is the data type of this constant?

7.45f

A

float

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

What is the data type of this constant?

‘\n’

A

char

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

What is the data type of this constant?

“\n”

A

string (array of char)

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

What is the data type of this constant?

“Hello, World!\n”

A

string (array of char)

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

What is the data type of this constant?

0x10

A

hexadecimal

17
Q

What is the data type of this constant?

-0100

A

octal

18
Q

What is the data type of this constant?

0xdull

A

unsigned long long hex

19
Q

What is the symbol to denote a new line?

A

\n

20
Q

What is the symbol to denote a tab?

A

\t

21
Q

What does the special character ‘\n’ denote?

A

A newline

22
Q

What does the special character ‘"’ denote?

A

A double quote

23
Q

What characters can a C variable name start with?

A

A letter of an underscore

24
Q

Which C variables are automatically initialised?

A

Global variables are initialised to 0. All other variables must be manually initialised

25
Q

In the printf() function, what does the %i symbol denote?

A

An int value

26
Q

In the printf() function, what does the %c symbol denote?

A

A char

27
Q

In the printf() function, what does the %s symbol denote?

A

A String

28
Q

In the printf() function, what does the %d symbol denote?

A

An int

29
Q

In the printf() function, what does the %f symbol denote?

A

A float

30
Q

In the printf() function, what does the %e symbol denote?

A

A float in scientific notation

31
Q

In the printf() function, what does the %li symbol denote?

A

A long int

32
Q

In the printf() function, what does the %lf symbol denote?

A

A double

33
Q

What will the following program print?

int i = 2;
int j = 3;
char c = ‘\n’;
printf(“%d < %d%c”,i,j,x);

A

The program will output:

“2 < 3” and end with a new line

34
Q

What are the five categories of operators in C?

A
Arithmetic
Relational
Boolean
Incremental
Bitwise