C Language - Input/Output Questions and Answers

Practice Mode
Showing 10 of 54 questions
Q31
 What is the purpose of the flag + used in printf () function ?
  • A Centered
  • B Right justified
  • C Putting sign
  • D Left justified
Answer: Option D
Q32
 What is the purpose of the flag + used in printf() function ?
  • A Left justified
  • B + or - precedes the signednumbers
  • C Right justified
  • D Centered
Answer: Option B
Q33
 What is the purpose of the flag # used in printf () function ?
  • A Left justified
  • B Right justified
  • C 0 and 0x precede non-zero octal and hexa values respectively
  • D Leading zeros appear
Answer: Option C
Q34
 What is the purpose of the flag 0 used in the function printf()?
  • A Leading blanks are displayed
  • B Leading zero appears
  • C - sign precedes
  • D + or - sign precedes
Answer: Option B
Q35
 What is the purpose of the flag blank used in the function printf () ?
  • A - precedes negative value and blank precedes positive value.
  • B - precedes negative value and + precedes positive value.
  • C - sign precedes negative value and nothing precedes positive value.
  • D Blank precedes negative and positive numbers.
Answer: Option A
Q36
 What is the output of the following code ? main () { printf ("%c", 'a'); }
  • A 65
  • B a
  • C A
  • D Error
Answer: Option C
Q37
 What is theoutput of the following code ? main () { printf("%d", ' A ');}
  • A 65
  • B a
  • C A
  • D Error
Answer: Option A
Q38
What is the output of the following code ? main () { Char name {}; strcpy (name, "poorani"); printf("%C%c%c", name [4], name [5], name [6]); }
  • A rani
  • B ran
  • C ani
  • D orani
Answer: Option C
Q39
What format is used to print a character with the printf function ?
  • A %s
  • B %c
  • C %char
  • D %Ic
Answer: Option B
Q40
 "The stock's value increased by 15%." select the statement, which will exactly reproduce the line of text above. 
  • A Printf ("\" The stock \'s value increased by %d%%.\"\n",15);
  • B printf(" The stock\'s value increased by %d%.\n",15);
  • C printf("\"The stock\'s value increased by %d%%.\"\n",15);
  • D printf('\"The stock\'s value increased by %d%.\"\n");
Answer: Option A
Questions and Answers for Competitive Exams Various Entrance Test