Question

Some pointer arithmetic is allowed. Which of the following arithmetic operators is allowed? (can have multiple...

Some pointer arithmetic is allowed. Which of the following arithmetic operators is allowed? (can have multiple answers)

a) pointer + integer

b) pointer - pointer

c) pointer - integer

d) integer + pointer

e) integer * pointer

Which statement correctly defines a vector object for holding Dealer objects?

a.Dealer vector v;

b.Dealer<vector> v;

c.vector<Dealer> v;

d.vector v<Dealer>;

One of the following statements dynamically allocates an array of floats having size SIZE.

a.float array;

b.float *array[SIZE];

c.float array = new float[SIZE];

d.float *array = new float[SIZE];

Which of the following statements declare two-dimensional array?

a.int a[];

b.int a[5][6];

c.int a[][];

d.int a[][4];

e.None of the above

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The below operations are allowed, pointer only support + and - and not *
a) pointer + integer
b) pointer - pointer
c) pointer - integer
d) integer + pointer


c.vector<Dealer> v; is the correct way to define vector to store Dealer objects

d.float *array = new float[SIZE]; is the correct way;


b.int a[5][6]; is the correct statement; we need to mention the size of first and second dimensions is square brackets

Add a comment
Know the answer?
Add Answer to:
Some pointer arithmetic is allowed. Which of the following arithmetic operators is allowed? (can have multiple...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Multiple choice questions 1. A variable that is shared by all objects of a class is...

    Multiple choice questions 1. A variable that is shared by all objects of a class is called_________? A.Static variable B. Const variable C.Member variable D. None of the above 2. Each object of a class has its own copy of the class's: A. member functions B. static member variables C. instance member variables D. A & C E. A & B 3. In a vector, which of the following statements is true? (can have multiple answers) a) Indexing vector access...

  • Which of these function correctly defines the function g(), which should return a pointer to a...

    Which of these function correctly defines the function g(), which should return a pointer to a dynamically allocated array? a. int g(int size) { int *ptr = new int [size]; return *ptr;} b. int* g (int size) { int data [size]; int *ptr =data; return ptr;} c. int* g(int size) { int *ptr = new int[size]; return ptr;} d.int g(int size { int *ptr = new int [size]; return ptr;} e. int g (int size) { int data[size]; int *ptr...

  • TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes...

    TRUE/FALSE 1. If pl is an integer pointer variable, with the value of 1000, pl++ changes P1 to point to the memory location 1001. ANSWER: T 2. When you return a dynamic array to the freestore, you must include the number of elements in the array 3. You can assign an array to a pointer variable. 4. The size of dynamic arrays must be declared at compile time. 5. int *pl; declares a static variable. ANSWER: F ANSWER: F ANSWER:...

  • You will write the following files: mystack.h - contains the class definition for the mystack class....

    You will write the following files: mystack.h - contains the class definition for the mystack class. mystack.cpp - contains the definitions for member functions of the mystack class. inpost.cpp - contains your convert() function. inpost.h - contains the function prototype for convert() so that the main() can call it. Each of the files (with the exception of inpost.h) is described in more detail below. All header files should contain header guards to prevent them from being included multiple times in...

  • Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839....

    Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...

  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

  • I have updated my previously posted C++ question to ensure that I have included all of...

    I have updated my previously posted C++ question to ensure that I have included all of the necessary documentation in order to complete Part 2 - Bank Account of the assigned lab in its entirety. Please note that the lab below is somewhat lengthy, and I do not expect you to answer each question! If coding the full lab is too much to ask, please focus soley on Part 2 of the lab, titled Bank Account and the subsections that...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL...

    WONT COMPILE ERROR STRAY / TEXT.H AND CPP PROGRAM SAYING NOT DECLARED HAVE A DRIVER WILL PASTE AT BOTTOM MOVIES.CPP #include "movies.h" #include "Movie.h" Movies *Movies::createMovies(int max) { //dynamically create a new Movies structure Movies *myMovies = new Movies; myMovies->maxMovies = max; myMovies->numMovies = 0; //dynamically create the array that will hold the movies myMovies->moviesArray = new Movie *[max]; return myMovies; } void Movies::resizeMovieArray() { int max = maxMovies * 2; //increase size by 2 //make an array that is...

  • 1. (10pts) What is the value (in decimal) of X in each case below? Give the...

    1. (10pts) What is the value (in decimal) of X in each case below? Give the expression based on which you arrive at your value. Assume 4 bytes are used to store int and float, 8 for long and double. a. int X b. float X x sizeof[char)/ (float) sizeof10 c. int C- 4: 2. (20pts) Rewrite the following program using macro definitions (adefine) for all the constants and a new type definition (typedef) called Card for all the values...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT