C Language INTERVIEW QUESTION & ANSWERS
116. |
What is bit field? |
|
A bit field is a commonly used data structure used to compactly hold a set of Boolean flags. Instead of using Boolean variables for each flag, the flags are stored in a fixed-size data structure like an integer, whose size in bits is known. The Boolean flags are then stored in each bit of the data structure, minimizing memory usage. In order to retrieve, read and write information from and to a bit field, the programmer uses
the bitwise operators AND, OR and NOT. |
117. |
What are the use of bit field? |
|
The Bit field are useful for number of reasons, such as :
- When storage is limited, we can store several Boolean variables in one byte
- Certain devices transmit status information encoded into one or more bits within a byte
- Certain encryption routines need to access the bits within a byte
|
118. |
What is stream? |
|
A stream is a sequence of elements in time. Only one stream element, the current one, is available at a time. In other words, the computer looks at input and output data, whether from a physical device such as keyboard or from file stored on a secondary storage, as a stream of characters or bytes. In this way, the programmer does not have to worry about the different properties of input/output devices, since every device sends or receives time sequenced bytes. All of C’s file structures are byte streams. |
119. |
What are Cpreprocessor? |
|
The preprocessor uses programmer supplied commands to prepare the source program for compilation. The translator then accepts source program and converts it into machine code and generates the object module. Depending on the compiler design, the preprocessor and translator can work together, or the preprocessor can create a separate version of the source program, which is then read by the translator. |
120. |
Difference between character constants and numeric type constants? |
|
- Each character constant has some integer value associated with it, while numeric type constants can be exact quantities or even approximations.
- The value of a character constant may vary from one computer to another but the constants themselves are independent of the character set.
- A character constant cannot be of length more than 1, but a numeric type constant has no such restriction.
|