GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Which of the following are reasons why we might dynamically…

Which of the following are reasons why we might dynamically allocate data in our program? Mark all that apply.

Read Details

Given the following: class TestQuestion{ std::string *answer…

Given the following: class TestQuestion{ std::string *answers;public: TestQuestion(int count) { answers = new std::string[count]; } ~TestQuestion { // What goes here? }}; How can you properly delete the dynamically allocated memory for an instance of this class?

Read Details

How do we access the data at the memory address a pointer po…

How do we access the data at the memory address a pointer points to? Or, how do we access the “pointee” of a pointer? 

Read Details

How many times do you need to deallocate memory (using eithe…

How many times do you need to deallocate memory (using either delete[] or delete) to prevent this code from leaking? float* myData[3];float* myPtr = nullptr;for (int i = 0; i < 2; i++) myData[i] = new float[10];myData[2] = new float;myPtr = myData[2];

Read Details

Our morals are shaped from:

Our morals are shaped from:

Read Details

σύν

σύν

Read Details

Given the following code: vector numbers;for (int i = 0; i

Given the following code: vector numbers;for (int i = 0; i

Read Details

How could you convert this code to use dynamically allocated…

How could you convert this code to use dynamically allocated memory? int count;cin >> count;double myArray[count]; // Compiler error, cannot declare variable-length arrays

Read Details

Errors could occur on which of the following lines? Mark all…

Errors could occur on which of the following lines? Mark all that apply. 1 int x = 7;2 int* y = &x;3 cout

Read Details

Given the following template function: templatevoid Foo(T& a…

Given the following template function: templatevoid Foo(T& a, T& b, T c){    T t = a;    a = b;    b = t;     t = a; c = t;    a = c;} What would the output be for the following code? int a = 7;int b = 4;int c = 1;Foo(a, b, c);cout

Read Details

Posts pagination

Newer posts 1 … 70,861 70,862 70,863 70,864 70,865 … 89,133 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top