Friday, 7 February 2014
C Interview Questions and Answers - 5
See the Complete C tutorial Here
81) What are the types of assignment statements?
C supports a variety of assignment statements. These are given below :
Simple assignment statement
Multiple assignment statement
Arithmetic assignment statement
82) What is the sizeof () operator?
Even though it looks like a keyword, sizeof( ) is an operator which is used to know the memory size of the data types and variables. This operator returns the number of bytes allocated for the variable (or) data type. The format of the sizeof() operator is as follows.
where v is a variable name / data type / value.
83) What is the use of bitwise operator?
The bitwise operator performs the operation on bits (i.e. bit by bit). Using the bitwise operators we can set / reset / check any bit in the value of the variable.
84) What is the Difference between = and = = Operators?
The two operators = and == are used for assignment and checking respectively. If not properly used, it causes many problems. The following program illustrates what will happen if we use = instead of = =.
85) What is unary operator?
The operators that act upon a single operand to produce a new value are known as unary operators.
86) What are the types of unary operators?
C support unary operators are :
minus operator -
increment operator + +
decrement operator –
87) What is the difference between break and continue?
The break statement is used to exit from all the loop constructs (while, do while and for) and switch.case statements, whereas the continue statement is used to skip all subsequent instructions and can control back to the loop control. The continue statement can be used for any loop construct.
88)What is storage class?
The storage class in C provides the complete information about the location and visibility of variables. Scope of a variable means the portion of the program within which it can be referenced and lifetime means the time of its existence in the memory.
89) What are the different storage classes in C?
There are four types of storage classes.
Automatic : Variable used as a local variable. This is the default one. Initial value of variable is garbage value without initialization.
Extern : Variable used as a local variable. Retains its value during next function call.
Regiter : Variable used as a local variable. May be stored in register if possible. Default initial value is garbage value.
Static : Variable used as a global variable.
90) What are the types of bitwise operator?
There are three types of bitwise operator.
Bitwise Exclusive OR(^)
91) What is difference between function overloading and operator overloading?
A function is overloaded when same name is given to different function.While overloading a function, the return type of the functions need to be the same.
92) What is getche() function?
It returns a character just entered from the standard input unit. The entered character is echoed (displayed) to the computer screen. It reads a single character the moment it is typed without waiting for the Enter key to be hit.
93) What is getch() function?
It returns a character just entered from the standard input unit. The entered character is not echoed on the screen. It reads a single character the moment it is typed without waiting for the Enter key to be hit.
94) What is putchar() function?
It prints the character constant or the character variable to the standard output device. The function putchar( ) has the following form :
putchar (var name)
95) What is an arrays?
Arrays can be defined as a collection of variables of the same type that are referred through a common name.
96) What are the advantages of the functions?
It reduces the complexity in a program by reducing the code
Function are easily understanding and reliability and execution is faster
It also reduces the time to run a program.In other way, Its directly proportional to complexity
Its easy to find-out the errors due to the blocks made as function definition outside the main function.
97)What are the characteristics of arrays in C?
An array holds elements that have the same data type
Array elements are stored in subsequent memory locations
Two–dimensional array elements are stored row by row in subsequent memory locations
Array name represents the address of the starting element
Array size should be mentioned in the declaration. Array size must be a constant expression and not a variable.
98) What is the difference between arrays and pointers?
Array is collection of similar datatype. it is a static memory allocation means we can not increment and decrement the arry size once we allocated. and we can not increment the base address, reassign address.
Pointer is a dynamic memory allocation. we can allocate the size as we want, assigning into another variable and base address incrementation is allowed.
99) What is else if ladder?
The else if ladder helps select one out of many alternative blocks of statements for execution depending on the mutually exclusive conditions.
100) What is class?
A class represents description of objects that share same attributes and actions. It defines the characteristics of the objects such as attributes and actions or behaviors. It is the blue print that describes objects.
See the Complete C tutorial Here