1/11
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What type of values are stored within a pointer type?
a integer value, which represents the address.
Given this snippet of code, what is the value of x after executing the last statement?
int x = 10, y, *z;
y = &x;
z = &y;
**z = 1000;
1000

A pointer variable can take the address of a memory location as its value. Read the given program.
1.The output of the 1st printf statement is
2. The output of the 2nd printf statement is
3.The output of the 3rd printf statement is
80, 60, 10
Given this snippet of code, determine which of the following options will change the text in array to "Hello Doe" after execution. (Check all that apply.)
char array[] = "Hello Joe";
char *x;
1.
x = array;
*(x + 6) = 'D';
2.
x = &array[0];
x = x + 6;
*x = 'D';
3.
x = &array;
x = x + 6;
x = 'D';
4.
x = array;
x = x + 6;
x = 'D';
1, 2
Given the following code
char p = "hello", s = "this is a string";
p = s;
printf("%s\n", p);
What will happen?
It prints: this is a string
Given the declaration: char A[3] = {'C', 'a', 'r'}, *p = A; what statement prints character a?
printf("%c", *(++p));
printf("%c", *p++);
printf("%c", *p);
printf("%c", *p+1);
1, 2
Given the C declaration:
char a[] = "Hello";
char p = a, q;
what operations are valid syntactically? Select all that apply.
q = &&a;
q = &&a[0];
q = &(*p);
q = (&a[0]);
3, 4
Given the following code
char a[2][4] = { { 'c', 'a', 'r', 'b' }, { 'i', 'k', 'e', '\0' } };
char p = &a[0][0];
while (p != '\0')
{
printf("%c", *p); p++;
}
What will happen?
It prints: carbike
What C/C++ constant variable can potentially be modified during the execution?
const x = 5;=
Given the following snippet of code, answer the following two questions based on the code:
typedef enum {red=0, amber, green} traffic_light;
traffic_light x = red, y = green;
while (x != y) { x++; }
y++;
printf("x = %d, y = %d", x, y);
1. What value will be printed for variable x? Please choose:
2. What value will be printed for variable y? Please choose:
2, 3
Consider the following snippet of code in a 32-bit computer. (Hint: no padding is needed before email since it is made of chars, not word sized values like int or a pointer.)
#define max 10
struct contact {
char name[30];
char email[30];
int phone;
};
struct contact A[max];
What is the size of the entire array A in bytes?
640
When using an array of structures to store a collection, we typically have a variable storing the number of entries (called something like: tail, count, or size). In addition to the number of entries, what does this variable help to indicate?
The tail variable in an array of structures is used for indicating (Select all that apply)
where to insert a new item, if the items in the array do not need to be sorted.
the starting address of the array.
where to delete an existing item in the array.
how far the search() function should go in searching the items of the array.
1, 4