Question: Which statement(s) is/are correct to get the 2nd element's value of an array a? Group of answer choices *a + 1 *(a + 1) &a

Which statement(s) is/are correct to get the 2nd element's value of an array a?

Group of answer choices

*a + 1

*(a + 1)

&a + 1

&a[1]

*a[1]

&(a + 1)

a[1]

Flag this Question

Question 51 pts

Suppose you want to let pointer pa point to variable b, which line should you use?

int main(){ int a=5, b=10; int *pa=&a, *pb = &b; // let pa point to b ______; return 0; } 

Group of answer choices

pa = *pb

pb = pa

pb = &pa

*pa = *pb

pa = &pb

pa = pb

Flag this Question

Question 61 pts

What will be output by the above code segment ?

Group of answer choices

1,4,4,4

3,2,2,3

4,2,2,1

Which line can free the space correctly?

int* foo(int x){ int *y = new int[x*x]; return y; } int main(){ int * z = foo(10); //free space ______________; return 0; }

Group of answer choices

delete [] z

delete z

delete *z

delete [] *z

Flag this Question

Question 101 pts

How do you release the memory at the end?

#include  using namespace std; int main(){ int a = 5; int *p = &a; int *c = new int[5]; //release memory _______; return 0; }

Group of answer choices

delete p; delete [] c;

delete [] c;

delete p; delete c;

delete c;

4,2,2,4

3,2,3,2

Flag this Question

Question 71 pts

Which function parameter list could make the program work and swap output ?

Group of answer choices

(int &v1, int &v2)

(int *v1, int *v2)

(int v1, int v2)

(int *&v1, int *&v2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!