Question: 1 -
Choose the right option string* x, y;
-
none of the above
-
Both x and y are pointers to string types
-
y is a pointer to a string, x is a string
-
x is a pointer to a string, y is a string
Answer:
x is a pointer to a string, y is a string
Solution:
* is to be grouped with the variables, not the data types
* is to be grouped with the variables, not the data types
Question: 2 -
Which of the following is the correct way to declare a pointer ?
-
int &ptr
-
All of the above
-
int ptr
-
int *ptr
Answer:
int *ptr
Solution:
int *ptr is the correct way to declare a pointer.
int *ptr is the correct way to declare a pointer.
Question: 3 -
Which of the following gives the [value] stored at the address pointed to by the pointer : ptr?
-
&ptr
-
ptr
-
Value(ptr)
-
*ptr
Answer:
*ptr
Solution:
*ptr gives the [value] stored at the address pointed to by the pointer : ptr.
*ptr gives the [value] stored at the address pointed to by the pointer : ptr.
Question: 4 -
Generic pointers can be declared with__________ .
-
auto
-
void
-
None of the above
-
asm
Answer:
void
Solution:
Generic pointers can be declared with void.
Generic pointers can be declared with void.
Question: 5 -
A pointer can be initialized with
-
Address of an object of same type
-
All of the above
-
Null
-
Zero
Answer:
All of the above
Solution:
A pointer can be initialized with null, zero and Address of an object of same type.
A pointer can be initialized with null, zero and Address of an object of same type.