C Structure, Union, Enums Test 416) Find out the error in the below program?
The correct option is (c). Explanation: This type of declaration is known as self-referential structure. This type of declaration is allowed to be used in a program. Here *e is the pointer to a struct employ. Therefore the compiler will return No error in a program 17) The Bit fields cannot be used in a union.
The correct option is (b). Explanation: False, the bit fields are allowed to be used inside a union. The C program using bit fields inside a union is given below: 18) The union elements can be of different sizes.
The correct option is (a). Explanation: True, the union element can be of different sizes. All the union elements may have different sizes but they share the common space of memory. 19) If the below structure is used for writing into a file using fwrite(), can fread() read it back successfully?
The correct option is (b). Explanation: No, because the structure in a program contain a char pointer while writing the structure to the disk using fwrite() only the data stored in pointer 'n' will get written. Hence the fread() fails to read the data stored in pointer. Therefore the fread() cannot read it back successfully. 20) What will be the output of a program in Turbo C under DOS (16 bit platform)?
The correct option is (c). Explanation: Since the C language is machine or compiler dependent language. In Turbo C(DOS) the size of integer data type is 2. Therefore the statement printf("%d \n", sizeof(bit)); prints the value 2 in output. Next TopicC Preprocessor Test |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India