FAC1003 — MINIMAL LEAK
Quick-scan version. Full version: FAC1003 Exam Leaks 2025-2026
Format
| Part |
Type |
Marks |
| A |
T/F, fill blanks, find errors |
24 |
| B |
Write full C++ code (4 Qs) |
56 |
What's Coming Out
DEFINITELY
- ✅ Pointers & References —
*, &, and reference & params
- ✅ Functions — void vs non-void
- ✅ Factorial — recursion + iteration SAME QUESTION
- ✅ Fibonacci — MEMORIZE THE CODE
- ✅ Function prototypes
- Arrays 2D and 1D
Maybe
- ? Passing/returning arrays
- ? Sum of factorial (non-void)
NOT Coming Out
- ❌ Searching & sorting
- ❌ Strings (much)
Memorize These
Pointer vs Reference
int* ptr = &x; // Pointer: stores address
void f(int &x) // Reference: modifies original
Factorial — Recursion
int factorial(int n) {
if (n <= 1) return 1;
return n * factorial(n-1);
}
Factorial — Iteration
int factorial(int n) {
int r = 1;
for(int i=1; i<=n; i++) r *= i;
return r;
}
Fibonacci — MEMORIZE
int fib(int n) {
if (n <= 1) return n;
return fib(n-1) + fib(n-2);
}
Swap with Reference
void swap(int &a, int &b) {
int t = a; a = b; b = t;
}
T/F Answers
| # |
Statement |
Ans |
| 1 |
Function can be called multiple times |
TRUE |
| 2 |
Prototype must include function body |
FALSE |
| 3 |
sqrt() needs <cmath> |
TRUE |
| 4 |
Program starts from called function |
FALSE |
| 5 |
Prototype params must match definition |
TRUE |
Scope
| Type |
Where |
Keeps Value? |
| Local |
Inside block |
No |
| Global |
Outside all functions |
Yes |
| Static |
Inside function |
YES |
Key Distinctions
- Void: No return, does action
- Non-void: Returns value, needs
return
- Recursion: Function calls itself, needs base case
- Iteration: Uses loop
Related