• Call Us : 03082533000 (WhatsApp)
  • Email Us : TestPointpk.com@gmail.com
Sticky Note
What is the use of templates in C++?
  1. Optimization
  2. Reduce memory loss
  3. Code reusability (generic programming)
  4. Memory allocation
Explanation
  • Templates in C++ allow writing generic functions or classes.
  • They enable the same code to work with different data types without rewriting it.
  • This improves code reusability and maintainability.
  • Templates are not directly about memory optimization or allocation.
  • Example: template <typename T> T add(T a, T b) works for int, float, or double.
  • Related MCQs

    یونیورسل ٹیورنگ مشینوں کا خیال کون تیار کرتا ہے جو پہلے کمپیوٹر کی بنیاد بنتی ہے؟
    1. Bill gates
    2. Alan Turing
    3. Babbage
    4. None of these
    اس سوال کو وضاحت کے ساتھ پڑھیں

    ای میل کا مطلب کیا ہے؟
    1. Easy mail
    2. Electronic mail
    3. Electric mail
    4. Eye mail
    اس سوال کو وضاحت کے ساتھ پڑھیں

    ڈیٹابیس میں کالمز کو کیا کہتے ہیں؟
    1. Rows
    2. Fields
    3. Records
    4. None of these
    اس سوال کو وضاحت کے ساتھ پڑھیں

    کمپیوٹر سائنس کا بانی کون ہے؟
    1. Augusta Adaming
    2. Allen Turing
    3. Charles Babbage
    4. None of these
    اس سوال کو وضاحت کے ساتھ پڑھیں

    ٹورنگ ٹیسٹ کس سال متعارف کروایا گیا؟
    1. 1936
    2. 1945
    3. 1950
    4. None of these
    اس سوال کو وضاحت کے ساتھ پڑھیں

    All Rights Reserved © TestPointpk.com