Classical

C Programming MCQ - I/O Operations

6:  

printf( "%c", 100);

A.

prints 100

B.

prints ASCII equivalent of 100

C.

prints garbage

D.

none of above

 
 

Option: B

Explanation :


7:  

The program fragment

int i = 263 ;
putchar( i );

A.

prints 263

B.

prints the ASCll equivalent of 263

C.

rings the bell

D.

prints garbage

 
 

Option: C

Explanation :


8:  

The following statement
           prlntf( ‘%f ’, 9/5) ;
prints

A.

1.8

B.

1.0

C.

2.0

D.

none of above

 
 

Option: D

Explanation :

9/5 yields integer 1. Printing 1 as a floating point number prints garbage.


9:  

The following program fragment 

    unsigned i = 1;
     int j = -4;
     printf ("%u ", i + j);


prints

A.

garbage

B.

-3

C.

an integer that changes from machine to machine

D.

none of above

 
 

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.


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)

A.

an unpredictable value

B.

8 * log( x + 3 )

C.

log( x+ 3 )

D.

none of above

 
 

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)}.




Suggest an improvement

 


Syllabus Covered in this section is

  • Elements of C-Tokens
  • Identifiers
  • data types in C
  • Control structures in, C
  •  Sequence, selection and iteration(s).
  • Structured data types in C
  • Arrays, Structures, union, String, and pointers
  • Functions, Recursion
  • Parameter passing, Scope
  •  Binding, Abstract data types

This Section covers Multiple Choice Questions Answers in C Programming . Here questions answers are given with explanation and references. These questions can be used for the preparation of various competitive and academic exams.

Who can benefit - 

  • Any undergraduate or postgraduate student who is seeking C Programming objective type questions answers can use this section.
  • C programming Multiple Choice questions Answers can help you in interview preparation.
  • C Programming Objective type Questions Answers are also used at SSC and HSc level for Exam preparation.
  • C Programming MCQ Questions Answers are also used by engineering students in the preparation of their Exams.
  • Any candidate who has to appear for DOEACC A, B or C level Exam can also learn C Programming Questions Answers.
  • All the teachers who are appearing for Kendriya Vidyalya Sangathan Entrance Exam can also use C Programming Multiple Choice Questions Answers.
  • C Programming MCQs can also be used by the students who are pursuing B.Sc or Msc Computer Science.
  • C Programming Questions Answers can also be used by BCA students for the preparation of their exams.
  • Any student who is pursuing B.Sc. in Information Technology can also use this C Programming mcq Questions Answers.
  •  MCA students can also prepare for their exams using  C Programming Objective Type Questions Answers.
  • You can get free access to C Programming mcq pdf.
  • You can also have online access to C Programming Questions Answers EBook.

Various Search Terms used for this section are

  • C Programming quiz questions with answers

  • C Programming exam questions answers

  • C Programming MCQ questions Answers

  • C Programming MCQ

  • C Programming Questions Answers