What is the output of the following code? [code]sprintf(‘%d’,5)[/code]

What is the output of the following code?
Code:
sprintf(‘%d’,5)
A. 5
B. ‘5’
C. Syntactical error
D. Logical error
 
Answer: b
Explanation: The sprint() command will convert the argument variables given to it into the format specifier mentioned as an input. But, the new value output of the sprint command will be assigned to a variable, here it’ll be the ans variable, which will be a string variable.
 

Tìm kiếm

Back
Top