Question 1949 – Nielit STA 17-12-2017
December 10, 2023
Question 1966 – Nielit STA 17-12-2017
December 10, 2023
Question 1949 – Nielit STA 17-12-2017
December 10, 2023
Question 1966 – Nielit STA 17-12-2017
December 10, 2023

Question 1957 – Nielit STA 17-12-2017

How many times the word “PROCESS” will be printed when executing the following program?
main()
{
printf(“process”);
fflush();
fork();
fork();
}

Correct Answer: B

Question 35 Explanation: 
→ fflush() is typically used for output stream only. Its purpose is to clear (or flush) the output buffer and move the buffered data to console (in case of stdout) or disk (in case of file output stream).
→ The two fork() calls create 3 child processes, and hence “PROCESS” will be executed 4 times if we don’t use fflush.
→ If we put a ‘\n’ at end of printf or use fflush(stdout); only 1 printf will be done.
A
8
B
4
C
6
D
7
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!!