Fundamental Programming — Test 3
Page 1 of 3
Question 1
What does the inline keyword on a C++ function guarantee?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 2
In def f(*args):, what is the type of args?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 3
Given def f(a, *, b):, which call is valid?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 4
In C, which statement about passing an array to a function is correct?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 5
Given int f(int n){ return n == 0 ? 0 : n + f(n-1); }, what is f(4)?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 6
What happens when a recursive Python function has no reachable base case?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 7
Does CPython optimize tail-recursive calls (tail-call optimization)?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026
Question 8
What does p(3) print?
void p(int n){ if(n == 0) return; p(n-1); cout << n; }
FPSC- Programmer (BS-17) - PMD High Yield - 2026
Question 9
What is the time complexity of the naive recursive Fibonacci function fib(n) = fib(n-1) + fib(n-2)?
FPSC- Programmer (BS-17) - PMD High Yield - 2026
Question 10
Which statement about recursion compared with iteration is correct?
FPSC- Programmer (BS-17) - Pakistan Meteorological Department (PMD) Model Papers - 2026