Final Flashcards

1
Q

T/F? A pointer variable must be declared specific to the data type of the variable whose address will be assigned to it.

A

True

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

T/F? A pointer has as its value a signed integer that is allocated four bytes of storage.

A

False

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

T/F? To assign the address of a variable to a pointer variable an address operator must be used.

A

True

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

T/F? To access the contents of a variable through a pointer variable, the pointer variable must be assigned the memory address of the variable first, and then the pointer must be dereferenced.

A

True

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

T/F? A pointer variable has no data type of its own.

A

False

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

T/F? A pointer variable must contain an unsigned integer so it cannot point to a character string.

A

False

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

T/F? A pointer variable must not be assigned a scalar constant.

A

True

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

T/F? A pointer variable can be added to another pointer variable.

A

False

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

T/F? A pointer variable can be subtracted from another pointer variable.

A

True

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

T/F? A pointer variable can be used to change the address of an array.

A

False

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

T/F? Two pointer variable can point to the same variable.

A

True

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

T/F? An array name is an address variable.

A

False

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

T/F? The address of an array is found as either the array name or the explicit address of the first element of the array.

A

True

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

T/F? The elements of a one-dimensional array may be accessed by dereferencing the offset address only once.

A

True

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

T/F? To input data to an array using a pointer variable, the name of the array may be used to specify the address of the array elements.

A

False

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

T/F? To input data to an array using pointer variable, the name of the array may be used to specify the address of the array elements.

A

True

17
Q

T/F? Arithmetic operations may be performed by using an array name without dereferencing the name.

A

False

18
Q

T/F? An array can be copied y assigning the address to a pointer variable.

A

False

19
Q

T/F? The dynamic storage allocation functions are in the sodlib.h header file in C.

A

True

20
Q

T/F? To allocate a block of storage at the time of execution of the program, dynamic storage allocation functions are used.

A

True

21
Q

T/F? The pointer tot he dynamic storage returned by calloc() must be cast to the data type it is pointing to.

A

True

22
Q

T/F? When a dynamic pointer is incremented by one, the address is incremented by the number of bytes of the data type it is pointing to.

A

True

23
Q

T/F? When a dynamic pointer is incremented, the address of the dynamic pointer variable will change.

A

False

24
Q

Write the code to declare a dynamic pointer and allocate storage to store a one-dimensional array of 200 elements and data type int.

A

int *ptr;

ptr = (int *) calloc(200, sizeof(int));

25
Q

Write the code to declare a dynamic pointer and allocate storage to store a one-dimensional array of 80,000 elements of data type float.

A

float *ptr;

ptr = (float *) calloc(80000, size of(float));

26
Q

Write a program to declare a dynamic pointer and allocate storage to store a two-dimensional array of 50 x 60 of data type float. Also write the code to input data to the dynamic array and output the data from the dynamic array.

A
float *ptr;
ptr = (float *) calloc(50 * 60, sizeof(float));
{
scans("%f", ptr);
ptr++;
}
ptr = ptr - 3000;
for(k = 0; k < 3000; k++)
{
printf("%f", *ptr);
ptr++;
}
27
Q

T/F? If there is not much variability in length of the character strings they may be stored in smooth arrays.

A

True

28
Q

T/F? To store strings with large variability in their length, dynamic storage should be used.

A

True

29
Q

T/F? The dynamic storage allocation function malloc() may be used to allocate storage to store strings.

A

True

30
Q

T/F? A particular structure is a derived data type derived from the basic and derived data types.

A

True

31
Q

T/F? When a structure is declared without a structure tag, a storage template is set up to allocate storage for the structure variables.

A

False

32
Q

T/F? When a structure is declared without a tag, the structure variables must be declared in the structure declaration statement itself.

A

True

33
Q

T/F? When a structure is declared with a structure tag the programmer has a choice of declaring the structure variables in the structure declaration itself or in a separate statement using the structure tag.

A

True

34
Q

T/F? Structure variables may be initialized in the structure declaration statement itself.

A

True

35
Q

T/F?Structure variables may be assigned values by using assignment statements.

A

True

36
Q

Structure variable members may be assigned values by computations.

A

True

37
Q

Structure variables may be elements of an array.

A

True

38
Q

Structure variables are manipulated by using the member operator.

A

True

39
Q

Structure variables may not be manipulated by using the structure variable pointers.

A

False