Which loop is preferred to use when the programmer knows in advance how many times the body of the loop will be executed?
جب پروگرامر کو پہلے ہی معلوم ہوتا ہے کہ لوپ کے جسم کو کتنی بار عمل میں لایا جائے گا تو کس لوپ کو استعمال کرنے کو ترجیح دی جاتی ہے؟
- While
- For
- Do-while
- None of these
Explanation
The for loop is ideal when the number of iterations is known beforehand.
It allows initializing, testing, and updating the loop variable in a single line.
Related MCQs
سب سے زیادہ قابلِ اعتماد نیٹ ورک ٹوپولوجی کون سی ہے؟
- Star topology
- Ring topology
- Mesh topology
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ویب سائٹ کے پہلے صفحے کو کیا کہا جاتا ہے؟
- First Page
- New Page
- Screen Page
- Home Page
اس سوال کو وضاحت کے ساتھ پڑھیں
میلویئر سافٹ ویئر کیا ہے؟
- A type of software designed to improve computer performance
- Software that protects against viruses and threats
- Malicious software designed to harm or exploit systems
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کالم اور قطار کے ملنے کی جگہ کو کیا کہتے ہیں؟
- Schema
- Cell
- Table
- Data
اس سوال کو وضاحت کے ساتھ پڑھیں
کون سی میموری سب سے تیز ہوتی ہے اور عام طور پر سی پی یو کے اندر موجود ہوتی ہے؟
- Main Memory
- SRAM
- Cache Memory
- DRAM