• Call Us : 03082533000 (WhatsApp)
  • Email Us : TestPointpk.com@gmail.com
Sticky Note
What is the output of the following python code? a= [1, 2, 3, 4] b= [num * 2 for num in a if num % = = θ] print(b)
  1. [2, 6]
  2. [2, 4, 6]
  3. [4, 8]
  4. None of these
Explanation
  1. The list comprehension iterates through a, checks if num is even (num % 2 == 0), and if true, multiplies num by 2.
  2. For the list a = [1, 2, 3, 4], the even numbers are 2 and 4. Multiplying them by 2 gives 4 and 8.

Output: [4, 8]

Related MCQs

دوسری نسل کے کمپیوٹر میں مندرجہ ذیل میں سے کون سی ٹیکنالوجیز استعمال ہوئی؟
  1. Vacum Tubes
  2. Transistors
  3. Integrated circuits
  4. None of these
اس سوال کو وضاحت کے ساتھ پڑھیں

کمپیوٹر کا بانی کس کو کہا جاتا ہے؟
  1. Barbara Liskov
  2. Tim Berners-Lee
  3. Charles Babbage
  4. John von Neumann
اس سوال کو وضاحت کے ساتھ پڑھیں

کون سی سہولت دو یا دو سے زیادہ ٹاسک، جابز یا پروگرامز کو بیک وقت اجازت کی اجازت ہے؟
  1. Multi-computing
  2. Multi-processing
  3. Multi-tasking
  4. None of these
اس سوال کو وضاحت کے ساتھ پڑھیں

درج ذیل میں سے آپریٹنگ سسٹم کی مثال کون سی ہے؟
  1. Photoshop
  2. MS Windows
  3. MS Word
  4. None of these
اس سوال کو وضاحت کے ساتھ پڑھیں

آپریٹنگ سسٹم کے کرنل کا بنیادی کام کیا ہے؟
  1. Manage hardware and system resources
  2. Run user applications
  3. Provide internet connectivity
  4. None of these
اس سوال کو وضاحت کے ساتھ پڑھیں

All Rights Reserved © TestPointpk.com