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
کون سا آپریٹنگ سسٹم ملتے جلتے کاموں کو گروپ بنا کر بیچز کی صورت میں چلاتا ہے؟
- Real-time operating system
- Batch operating system
- Distributed operating system
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر کے مدر بورڈ پر سی ایم او ایس بیٹری کا کیا کام ہے؟
- To power the processor
- To maintain system time and BIOS/UEFI settings
- To increase internet speed
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
درج ذیل میں سے کون سی آپٹیکل اسٹوریج ڈیوائس کی مثال ہے؟
- SSD
- DVD Drive
- Hard drive
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
جی این یو آپریٹنگ سسٹم کا منصوبہ کس نے شروع کیا؟
- Bill Gates
- Steve Jobs
- Richard Stallman
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
مندرجہ ذیل میں سے کون سی غیر مستحکم میموری ہے؟
- RAM
- ROM
- Cache
- Both A and C