Answer Key
Part I: Multiple-Choice Questions
c) They provide reusable solutions to commonly occurring problems in software design.
a) char *b[5];
b) Singleton Pattern
a) int *p;
declares p
as a pointer to an integer.
a) It is used to allocate memory dynamically during program execution.
c) A negative integer
c) QMainWindow
a) int (*funcPtr)(int, int);
a) Deallocates memory previously allocated by new
.
a) Create an interface to allow incompatible interfaces to work together.
Part II: Code Output Prediction
10
World
30
Part III: Coding Answer
#include <iostream>
using namespace std;
void allocateAndPrintArray(int n) {
int *arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = i + 1;
cout << arr[i] << " ";
}
cout << endl;
delete[] arr;
}
Once you complete the Practice Exam, upload your answers, and I will provide feedback on what you got right and wrong, explanations, and areas to focus on.