Question What does the following statement mean?
int (*fp)(char*)
A pointer to a pointer
B pointer to an array of chars
C pointer to function taking a char* argument and returns an int
D function taking a char* argument and returning a pointer to int
Answer C
Marks 1
Unit
Id 2
Question The operator used for dereferencing or indirection is ____
A *
B &
C ->
D –>>
Answer A
Marks 1
Unit III
Id 3
Question Choose the right option
string* x, y;
A x is a pointer to a string, y is a string
B y is a pointer to a string, x is a string
C both x and y are pointer to string types
D none of the mentioned
Answer A
Marks 1
Unit III
Id 4
Question Which one of the following is not a possible state for a pointer?
A hold the address of the specific object
B point one past the end of an object
C Zero
D point to a byte
Answer D
Marks 1
Unit III
Id 5
Question Which of the following is illegal?
A int *ip;
B string s, *sp = 0;
C int i; double* dp = &i;
D int *pi = 0;
Answer D
Marks 1
Unit III
Id 6
Question #include <iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 15;
int *arr[ ] = {&a, &b, &c};
cout <<arr[1];
return 0;
}
A 10
B 15
C 20
D Random number
Answer D
Marks 2
Unit III
Id 7
Question The correct statement for a function that takes pointer to a float, a pointer to a pointer to a
char and returns a pointer to a pointer to a integer is
A int **fun(float**, char**)
B int *fun(float*, char*)
C int ***fun(float*, char**)
D int ***fun(*float, **char)
Answer C
Marks 1
Unit III
Id 8
Question #include <iostream>
using namespace std;
int main()
{
char arr[20];
int i;
for(i = 0; i < 10; i++)
*(arr + i) = 65 + i;
*(arr + i) = ‘