Created by
justindsalasTeacher
Terms in this set (15)
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;
a) x = array;
x = x + 6;
x = 'D';
b) x = &array;
x = x + 6;
x = 'D';
c) x = array;
*(x + 6) = 'D';
d) x = &array[0];
x = x + 6;
*x = 'D';
char array[] = "Hello Joe";
char *x;
a) x = array;
x = x + 6;
x = 'D';
b) x = &array;
x = x + 6;
x = 'D';
c) x = array;
*(x + 6) = 'D';
d) x = &array[0];
x = x + 6;
*x = 'D';
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?
a) A compilation error will occur at this line: while (*p != '\0')
b) It prints: carbike
c) A compilation error will occur at this line: char *p = &a[0][0];
d) It prints: carb
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?
a) A compilation error will occur at this line: while (*p != '\0')
b) It prints: carbike
c) A compilation error will occur at this line: char *p = &a[0][0];
d) It prints: carb
Given the following C code:
char a[2][3] = { { 'c', 'a', 't'}, { 'd', 'o', 'g'} };
int i, j;
for (i = 0; i<2 ; i++) {
for (j = 0; j<3; j++)
printf("%c", a[i][j]);}
What will happen?
a) It prints: catdog
b) A compilation error will occur at this line: char a[2][3] = { { 'c', 'a', 't'}, { 'd', 'o', 'g'} };
c) It prints: cat
d) A compilation error will occur at this line: printf("%c", a[i][j]);
char a[2][3] = { { 'c', 'a', 't'}, { 'd', 'o', 'g'} };
int i, j;
for (i = 0; i<2 ; i++) {
for (j = 0; j<3; j++)
printf("%c", a[i][j]);}
What will happen?
a) It prints: catdog
b) A compilation error will occur at this line: char a[2][3] = { { 'c', 'a', 't'}, { 'd', 'o', 'g'} };
c) It prints: cat
d) A compilation error will occur at this line: printf("%c", a[i][j]);
Sets found in the same folder
Other sets by this creator
Verified questions
Other Quizlet sets
1/4