Theory-of-Computation
October 4, 2023NIC-NIELIT Scientist-B 2020
October 4, 2023Programming-for-Output-Problems
Question 13
|
What will be the output of the following program? Assume that you are running this program in little-endian processor.


1
|
|
320
|
|
64
|
|
Compilation error
|
Question 13 Explanation:
Ptr = (char*) &a ; /* It is type casted to char* */
Printf (“%d”, *ptr) ; /* Here *ptr is referring a single character */

Printf (“%d”, *ptr) ;
Output: 64 /* @ ASCII value is 64 */
Note: Assume short a is 2 byte integer.
Printf (“%d”, *ptr) ; /* Here *ptr is referring a single character */

Printf (“%d”, *ptr) ;
Output: 64 /* @ ASCII value is 64 */
Note: Assume short a is 2 byte integer.
Correct Answer: C
Question 13 Explanation:
Ptr = (char*) &a ; /* It is type casted to char* */
Printf (“%d”, *ptr) ; /* Here *ptr is referring a single character */

Printf (“%d”, *ptr) ;
Output: 64 /* @ ASCII value is 64 */
Note: Assume short a is 2 byte integer.
Printf (“%d”, *ptr) ; /* Here *ptr is referring a single character */

Printf (“%d”, *ptr) ;
Output: 64 /* @ ASCII value is 64 */
Note: Assume short a is 2 byte integer.
Subscribe
Login
0 Comments