Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago