M3 CSE 240

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:44 PM on 2/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

12 Terms

1
New cards

What type of values are stored within a pointer type?

a integer value, which represents the address.

2
New cards

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

3
New cards
<p><span><span>A pointer variable can take the address of a memory location as its value. Read the given program.</span></span></p><p><span>1.The output of the 1st printf statement is</span></p><p><span><span>2. The output of the 2nd&nbsp;printf&nbsp;statement&nbsp;is</span></span></p><p><span><span>3.The output of the 3rd&nbsp;printf&nbsp;statement &nbsp;is</span></span></p>

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

4
New cards

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

5
New cards

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

6
New cards

Given the declaration: char A[3] = {'C', 'a', 'r'}, *p = A; what statement prints character a?

  1. printf("%c", *(++p));

  2. printf("%c", *p++);

  3. printf("%c", *p);

  4. printf("%c", *p+1);

1, 2

7
New cards

Given the C declaration:

char a[] = "Hello";
char p = a, q;

what operations are valid syntactically? Select all that apply.

  1. q = &&a;

  2. q = &&a[0];

  3. q = &(*p);

  4. q = (&a[0]);

3, 4

8
New cards

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

9
New cards

What C/C++ constant variable can potentially be modified during the execution?

const x = 5;=

10
New cards

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

11
New cards

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

12
New cards

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)

  1. where to insert a new item, if the items in the array do not need to be sorted.

  2. the starting address of the array.

  3. where to delete an existing item in the array.

  4. how far the search() function should go in searching the items of the array.

1, 4