Programming in C - I/O Operations

6. printf( "%c", 100);

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


7. The program fragment
int i = 263 ;
putchar( i );

Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


8. The following statement
printf( ‘%f ’, 9/5) ;
prints

  • Option : D
  • Explanation : This statement is undefined behavior because the argument has to be of type double and 9 / 5 is of type int.
    Following program yields an output of 1.8
    int main()
    {
    printf("%f",9/5.0);
    return 0;
    }
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


9. The following program fragment
unsigned i = 1;
int j = -4;
printf ("%u ", i + j);
prints

  • Option : C
  • Explanation :
    In the computer I used to execute this program. The output was 4294967293. That's because in my system, sizeof (int ) is 4 bytes (32 bits), and negative numbers are represented in 2's complement form.
    This means -4 will be represented as 11111111 11111111 11111111 11111100 (i.e. 30 one's followed by 2 zeroes).
    Note that this number is 232 - 1 - 3. Before j gets added to 1, it will be converted to an unsigned integer. So, i + j is essentially adding 1 to 232- 1 - 3 which gives 4294967293.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


10. If the following program fragment ( assume negative numbers are stored in 2's complement form )
unsigned i=1;
int j = -4;
printf( " %u ", i + j);
prints x, then printf( " %d ", 8* sizeof( int ));
outputs an integer that is same as (log in the answers are to the base two)

  • Option : C
  • Explanation :
    Let size of ( int ) = 1. So, -4 will be stored as 1 1 1 1 1 1 0 0.
    Since we are adding unsigned and signed integers, the signed gets converted to unsigned.
    So, i + j will become 1 1 1 1 1 1 0 1. We are trying to print this as an unsigned integer.
    So, what is printed will be 28 - 1 - 2. So, log (x + 3) = 8 (i.e.. 8 * sizeof ( int)}.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *


  • input output operations in c Questions can be used to give quizzes by any candidate who is preparing for UGC NET Computer Science
  • This input output operations in c Questions section will help you test your analytical skills in a tricky method, thereby giving you an edge over other students
  • Any student who wants to prepare for DOEACC A Level, DOEACC B Level, and DOEACC C level can also use these Objective Type Questions Answer.
  • All candidates who have to appear for the Kendriya Vidyalaya Entrance exam can also refer to this mcq section.
  • You can also get access to the input output operations in c MCQ ebook.
  • input output operations in c Questions can be used in the preparation of JRF, CSIR, and various other exams.
  • You can also download pdf for these input output operations in c multiple-choice questions Answers.
  • This input output operations in c Multiple Choice Questions Answers section can also be used for the preparation of various competitive exams like UGC NET, GATE, PSU, IES, and many more.
  • input output operations in c Questions can be used to gain a credit score in various undergraduate and postgraduate courses like BSc, MSc and MCA
  • input output operations in c Questions for UGC NET Computer Science

    input output operations in c MCQ

    input output operations in c Multiple choice questions