FPSC Past Papers MCQs

FPSC Programmer (BS 17) PMD High Yield 2026  — 350 MCQs  (Page 3 of 35)

Practice FPSC Past Papers MCQs with solved questions from real past exams. These MCQs cover FPSC Programmer (BS 17) PMD High Yield 2026 past papers and are ideal for candidates preparing for competitive exams.

View Tests (30 MCQs each)
Can two C++ functions be overloaded if they differ only in their return type, as in int f(int) and double f(int)?
  • Yes, but only for virtual functions
  • Yes, the compiler picks one based on the assignment target
  • No, it is a compilation error
  • Yes, if both are inline
In C++, what is the result of using delete p; on memory allocated with p = new int[10];?
  • Undefined behavior; delete[] p must be used
  • Compilation error
  • It frees only p[0]
  • It correctly frees all 10 ints
What is wrong with this C++ function? int* f(){ int x = 5; return &x; }
  • Memory leak
  • Compilation error
  • Nothing; it works correctly
  • It returns a dangling pointer to a local variable that no longer exists
What makes a C++ class abstract?
  • It is declared with the abstract keyword
  • It has no constructor
  • It has at least one pure virtual function (= 0)
  • All of its members are private
The 'diamond problem' in C++ multiple inheritance is solved by which feature?
  • Virtual functions
  • Virtual inheritance
  • Abstract classes
  • Friend classes
Why must a C++ copy constructor take its parameter by reference, as in X(const X&)?
  • Only for const-correctness
  • Because constructors cannot take value parameters
  • References are faster
  • Passing by value would require calling the copy constructor itself, causing infinite recursion
According to the structured program theorem (Böhm–Jacopini), which three control structures are sufficient for any algorithm?
  • Sequence, selection, iteration
  • Selection, recursion, exceptions
  • Iteration, inheritance, selection
  • Sequence, goto, recursion