ANSWERS
C/C++ has 2 pointer operators, which operator represents the name of an
address? (Commonly referred as l-value) - ANSWERS Asterisk (*)
Multiple pointers can reference the same objects - ANSWERS True
Given this snippet of code, determine which of the following options will change
the test in array to "Hello Doe" after execution.
char array[] = "Hello Joe";
char *x; - ANSWERS a. x = array;
*(x + 6) = 'D';
d. x = &array[0];
x = x + 6;
*x = 'D';
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; - ANSWERS 1000
, A pointer variable can take the address of a memory location as its value. Read
the given program:
#include <stdio.h>
main(){
int a = 20; b = 30; *p, *q, **r;
p = &a;
*p = 50;
q = &b;
*q = 70;
r = &p;
**r = 90;
printf("%d\n", a);
printf("%d\n", b);
a = 20;
b = 80;
printf("%d\n", **r);
Answer the following three questions.
1.The output of the 1st printf statement is 50 .
2. The output of the 2nd printf statement is 70 .
3.The output of the 3rd printf statement is 90 . - ANSWERS a. 90
b. 70
c. 20
What data types in C have the same data range, assuming the computer used is a
32bit computer? - ANSWERS pointer type and unsigned int
, Given the following code, what will happen? :
char a[] = {'c', 'a', 't', '\0'}; char *p = a; while (*p != 0) { *p = *p + 1; printf("%c",
*p++); // *p++ is the same as *(p++) } - ANSWERS It prints: dbu
Given the following code, what will happen? :
char *p = "hello", *s = "this is a string";strcpy(p, s); printf("%s\n", p); - ANSWERS A
compilation error will occur at this line: strcpy(p,s);
Given the following union type definition in a 32bit computer:
union person {
char gender;
int age;
char name[16];
} x;
What is the total number of bytes used by the variable x? - ANSWERS 16
The tail variable in an array of structures is used for indicating - ANSWERS a. how
far the search() function should go in searching the items of the array
b. where to insert a new item, if the items in the array do not need to be sorted
Consider the following snippet of code in a 32bit computer:
#define max 10
struct contact {