Question: 1 -
A pointer can be initialized with
-
All of the above
-
Zero
-
Address of an object of same type
-
Null
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.
Question: 2 -
Which of the following is the correct way to declare a pointer ?
-
int &ptr
-
int ptr
-
int *ptr
-
All of the above
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 -
Choose the right option string* x, y;
-
none of the above
-
y is a pointer to a string, x is a string
-
x is a pointer to a string, y is a string
-
Both x and y are pointers to string types
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: 4 -
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: 5 -
Generic pointers can be declared with__________ .
-
None of the above
-
auto
-
void
-
asm
Answer:
void
Solution:
Generic pointers can be declared with void.
Generic pointers can be declared with void.