Suppose z is an integer while z and y are long variables. If you write z = z + y; in your C program, which of the following will happen?
- Compiler will generate error
- z will be converted to long and z will be calculated as long
- y will be converted to int and z will be calculated as int
- z will be converted to long and z will be calculated as int
Explanation
In z = z + y;, since z is an int and y is long, y is converted to int (if possible) to match the type of z due to usual type conversion rules.
The result is calculated as an int, and this may cause data loss if y exceeds int range.
Related MCQs
ورچوئل میموری میں میموری کے وسائل کن کے درمیان منظم اور مختص کیے جاتے ہیں؟
- Printers
- Processes
- Keyboards
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
وی پی این کا بنیادی مقصد کیا ہے؟
- To provide privacy and secure connections over networks
- To delete computer files
- To increase RAM
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ای میل ایڈریس کا ڈومین والا حصہ عام طور پر کس چیز کی نشاندہی کرتا ہے؟
- The email password
- The organization or mail service domain
- The user's phone number
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
سرچ انجن کا بنیادی مقصد کیا ہے؟
- To create documents
- To search for information and websites
- To design presentations
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
نیٹ ورک کارڈ کے منفرد ہارڈویئر ایڈریس کو کیا کہتے ہیں؟
- IP Address
- MAC Address
- Email Address
- None of these