C Language - Input/Output Questions and Answers
The C Language Input/Output questions with answers focus on concepts like printf(), scanf(), file handling, and formatted I/O operations in C programming. These programming questions and answers help you understand how data is read from and displayed to the console or files. Practicing such MCQs is crucial for C programming interviews, technical tests, and campus placements conducted by Infosys, TCS, and Wipro. Each question includes detailed solutions and code examples to clarify syntax, input validation, and buffer management—making it ideal for students preparing for technical exams.
C Language - Input/Output
Showing 10 of
54 questions
31. What is the purpose of the flag + used in printf () function ?
- Centered
- Right justified
- Putting sign
- Left justified
32. What is the purpose of the flag + used in printf() function ?
- Left justified
- + or - precedes the signednumbers
- Right justified
- Centered
33. What is the purpose of the flag # used in printf () function ?
- Left justified
- Right justified
- 0 and 0x precede non-zero octal and hexa values respectively
- Leading zeros appear
34. What is the purpose of the flag 0 used in the function printf()?
- Leading blanks are displayed
- Leading zero appears
- - sign precedes
- + or - sign precedes
35. What is the purpose of the flag blank used in the function printf () ?
- - precedes negative value and blank precedes positive value.
- - precedes negative value and + precedes positive value.
- - sign precedes negative value and nothing precedes positive value.
- Blank precedes negative and positive numbers.
36. What is the output of the following code ? main () { printf ("%c", 'a'); }
- 65
- a
- A
- Error
37. What is theoutput of the following code ? main () { printf("%d", ' A ');}
- 65
- a
- A
- Error
38. What is the output of the following code ? main () { Char name {}; strcpy (name, "poorani"); printf("%C%c%c", name [4], name [5], name [6]); }
- rani
- ran
- ani
- orani
39. What format is used to print a character with the printf function ?
- %s
- %c
- %char
- %Ic
40. "The stock's value increased by 15%." select the statement, which will exactly reproduce the line of text above.
- Printf ("\" The stock \'s value increased by %d%%.\"\n",15);
- printf(" The stock\'s value increased by %d%.\n",15);
- printf("\"The stock\'s value increased by %d%%.\"\n",15);
- printf('\"The stock\'s value increased by %d%.\"\n");