Data type interview questions

1. What is use of void data type?
2. What is size of int data type in c?
3. What will happen if we will assign a value to float variable which is beyond the range of float data type?
4. Write down three derived data types in c.
5. Can we use signed keyword with double? Why?  
6. Why range of signed char is -128 to 127 not -127 to 128?
7. What is cyclic nature of int data type?
8. What will be output of following c code?
void main(){
    char i=250;
    printf(“%d”,i);
}
9. What is volatile keyword in c?
10. It is necessary to initialize the const variable in c?

3 comments:

Ramesh said...

1)

what is void data type
Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function.
The another used of void is to declare the pointer in C/C++ where It is not sure what data type is addressed by the pointer.
eg:
void *p;
Here p can hold the address of int or float or char or long int or double.

Narasimha Rao said...

1)Built-in data types
Fundamental data types (int, char, double, float, void, pointer)
Derived data types (array, string, structure)

2)Programmer-defined data types
Structure
Union
Enumeration

Narasimha Rao said...

programmer defined data types also called as user defined data types