C Programming Language Variables
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?
Answer: y will be converted to int 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.
This question appeared in
Past Papers (5 times)
ETEA 25 Years Past Papers Subject Wise (Solved) (2 times)
ETEA Past Papers (1 times)
KPK Teacher Past Papers SST PST CT TT PET (2 times)
This question appeared in
Subjects (1 times)
COMPUTER (1 times)
Related MCQs
- Which function is used to get values into variables from the keyboard during the execution of a program?
- A set of _____ used to write a computer program.
- The high level languages are using ______words to write a program
- What type of test is easier for students who cannot write long answers?
- A train 240 m long passes a pole in 24 seconds. How long will it take to pass a platform 650 m long?
- A computer program that translates one program instructions at a time into machine language is called?
- A computer program that converts an entire program into machine language is called _______
- A computer program that combines object codes into a single executable program is called _____?
- When creating a computer program, the ______ designs the structure of the program.
- When we write all the numbers from 1 to 100. then how many times do we write the number