Theory-of-Computation
October 4, 2023
NIC-NIELIT Scientist-B 2020
October 4, 2023
Theory-of-Computation
October 4, 2023
NIC-NIELIT Scientist-B 2020
October 4, 2023

Programming-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.
A
1
B
320
C
64
D
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.
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.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!