Pointer to Void

1

What we can't do on a void pointer?

A. pointer arithemetic
B. pointer functions
C. both of the mentioned
D. none of the mentioned

2

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        int a = 5, c;
6.        
        void *p = &a;
7.        
        double b = 3.14;
8.        
        p = &b;
9.        
        c = a + b;
10.        
        cout << c << '\n' << p;
11.        
        return 0;
12.        
    }
A. 8, memory address
B. 8.14
C. memory address
D. none of the mentioned

3

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        int n = 5;
6.        
        void *p = &n;
7.        
        int *pi = static_cast(p);
8.        
        cout << *pi << endl;
9.        
        return 0;
10.        
    }
A. 5
B. 6
C. compile time error
D. runtime error

4

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        int i;
6.        
        char c;
7.        
        void *data;
8.        
        i = 2;
9.        
        c = 'd';
10.        
        data = &i;
11.        
        cout << "the data points to the integer value" << data;
12.         
        data = &c;
13.        
        cout << "the data now points to the character" << data;
14.        
        return 0;
15.        
    }
A. 2d
B. two memory addresses
C. both of the mentioned
D. none of the mentioned

5

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int main()
4.    
    {
5.    
        int *p;
6.        
        void *vp;
7.        
        if (vp == p);
8.        
            cout << "equal";
9.            
        return 0;
10.        
    }
A. equal
B. no output
C. compile error
D. runtime error