2.1 Information Storage Flashcards

1
Q

In binary representations(2 complement) , the most significant bit indicates what

A

The sign of the number
0 for positive
1 for negative

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

size of char

A

8 bit in IA32, 8 bits in x86-64

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

size of short

A

16 bit in IA32, 16 bits in x86-64

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

size of int

A

32 bit in IA32, 32 bits in x86-64

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

size of long

A

32 bit in IA32, 64 bits in x86-64

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

size of float

A

32 bit in IA32, 32 bits in x86-64

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

size of double

A

64 bit in IA32, 64 bits in x86-64

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

size of char*

A

32bit in IA32, 64 bits in x86-64

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

char *p

A

p is a pointer to an object of type char

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

Big Endian

A

Least Significant byte has HIGHEST address (least significant byte is stored first)
01 23 45 67

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

Little Endian

A

Least significant byte has LOWEST address (least significant byte is stored last)
67 45 23 01

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

When is byte ordering important

A

When a code is transferred from one machine to another and when inspecting machine level programs

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

%d

A

to print a number as signed decimal

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

%u

A

to print a number as unsigned decimal

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

%x

A

to print a number in hexadecimal format

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

%p

A

print pointer

17
Q

typedef

A

provides a way of giving a name to a data type in C

18
Q

Intel byte ordering system

A

Little Indian

19
Q

Who uses Big endian

A

IBM and Oracle

20
Q

What is a pointer

A

a variable that stores the memory address of another variable as its value

21
Q

What is a mask

A

A bit pattern that indicates a selected set of bits within a word

22
Q

Logical operations

A

Logical operations treat any nonzero argument as true and argument 0 as false.

23
Q

Difference between logical operators and bitwise operators

A
  • The logical operators do not evaluate their second argument if the result of the expression can be determined by evaluating the first term
  • The arguments in bitwise operations are restricted to 0s and 1s
24
Q

Another way to express x==y

A

(returns 1 when they are equal and 0 otherwise)
!(x^y)

25
Q

Logical shift

A

(right shift) Fills the left end with zeros

26
Q

Arithmetic shift

A

(right shift) Fills the left end with k repetitions of the most significant bit

27
Q

What kind of right shift do most compilers and machines use

A

Arithmetic shift for signed data

28
Q

Type of right shift for unsigned data

A

logical shift

29
Q

Operator order of precedence

A
30
Q

What does leal do

A

Computes addresses without memory reference
Computes arithmetic expressions of the form x + k * i