CECS 325 FINAL NEWEST 2025 EXAM COMPLETE QUESTIONS
AND CORRECT DETAILED ANSWERS (VERIFIED ANSWERS)
|ALREADY GRADED A+
Which of the following statements is true?
The code will compile but there is something wrong with this code
There is nothing wrong with the code
C++ is a dangerous motorcycle and you could be mortally wounded if you try to use it!!!
The code will not compile. - ANSWER-The code will compile but there is something wrong with
this code
Suppose I have a file numbers.dat with the number 1 through 1000 sorted, one number per
line. What will be printed on the screen if I type this command sequence:
% more numbers.dat | tail -100 | head -20 | tail -1
920
none of these answers is correct
921
901 - ANSWER-920
When a C++ program runs, and dynamic memory is needed, where does the allocated dynamic
memory live in memory?
register
heap
ram
stack - ANSWER-heap
Consider the following C++ code:
1|Page
, CECS 325 Final Newest 2025 Exam
int a = 10;
int *ptr = &a;
cout << ptr;
What is printed out?
the memory address of a
the number 10
the contents of a
the memory address of ptr - ANSWER-the memory address of a
The fibonacci function is a recursive function. Each time the function gets called in a recursive
loop, what type of memory is used to store the contents and state of the program?
register
heap
ram
stack - ANSWER-stack
Consider this code segment:
int x = 10;
int y = 20;
int z = mystery(x, y);
cout << z << "/" << x + y;
Also consider this function:
int mystery(int a, int &b)
{
a += 5;
2|Page
, CECS 325 Final Newest 2025 Exam
b += 5;
return a + b;
}
What prints to the screen?
40/35
35/40
40/30
30/40 - ANSWER-40/35
Consider the following segment of code in C++:
int nums[10] = {1,2,3,4,5,6,7,8,9,10};
printArray(nums);
Also consider the this function:
void printArray(int n[ ])
{
for(int i=0, i<n.size; i++)
cout << n[i];
}
How many numbers will the printArray( ) function actually print out?
1
the correct answer is not listed
10
all the numbers in the array - ANSWER-the correct answer is not listed
Consider the following code segment in C++::
3|Page
, CECS 325 Final Newest 2025 Exam
int A[ ] = {0, 1, 2, 3, 4, 5};
int *ptr = A;
How would I print 5 to the screen?
cout << ptr[5];
cout << ptr + 5;
cout << *ptr[5];
cout << ptr * 5; - ANSWER-cout << ptr[5];
In the C++ language when building a class, header files (.h) must be separate from
implementation files (.cpp) - ANSWER-False
What does Amdahl's law describe?
The computing power will double every 18 months
Programs can run faster if you use parallel processing
Moore was an optimist
The sequential work will limit the speedup due to parallelism! - ANSWER-The sequential work
will limit the speedup due to parallelism!
This program will compile and run just fine:
#include <iostream>
int main()
{
cout << "Hello World\n";
} - ANSWER-False
When building a class in C++, it is good practice to make the data members public so that other
classes can quickly access them. This is what makes C++ a fast language. - ANSWER-False
4|Page