Interview Question On C++
Interview Question On C++
C Interview Question-Part 2
1) What is static variable?
Static variable are constant variable whose value remain the same throughout the progr
2) How can you determine the size of an allocated portion of the memory?
The malloc or free implementation would determine the size of the memory easily.
3) Why do we use structure?
Structures are used for various purpose
* Use of structure variable
* To develop individual array.
4) Define these functions fopen(), fread(), fwrite() and fseek()?
Fopen():- function to open a file, the pointer points to the first record in the file.
Fread():- it reads the file were the pointer is pointing.
Fseek():- This function enables to move from one record to another.
Fwrite:- This function write data in the file were the pointer is pointing.
5) What are logical operators in C?
Logical operators in C are AND and OR operator.
AND denoted by && for example exp1&& exp2
OR denoted by || for example exp1||exp2
6) What is enum used for and state its format?
Enum creates a sequence of integer constant. It is optional to use the name in the enu
7) what is ternary operator?
This operator return the value based on the evaluation of the expression.
General format:-
(expr 1) ? true: false
It is similar to if else construct.
8) Can u write c program without using main function?
Without the main function the program will not be executed. The compiler starts compil
9) What is the use of main function?
The main function invokes other function within it. It is first function during the ex
10) Is c a structural language?
No C is a procedural language. An example of structural language is COBOL.
11) What are the rules for constructing the real constant?
* A real constant should have atleast one digit
* It should be a decimal point
* By default it is assigned positive value
* Within real constant no blank space or commas.
12) The following variable is available in xyz.c, who can access it?:
Static float score
All the functions that contained in the file can access the variable.
13) Disadvantage of using pointers?
The major disadvantage of using pointers is that hackers easily identify source code
14) Why do we use void main() in C language?
The program starts its execution from void main function. Every function in the pr
15) How can I convert number into string?
Number can be converted into string by using the itoa() function. Sprintf can also b
16) What are the advantages of the functions?
•Testing is much easier
•More readability
•Improves the performance of the program
•Reduce the program size.
•Understanding the logic quiet easy.
17) Difference between internal and external static?
Static variable declared internally within the static class and have scope within the
18) Are pointers integers?
Pointers represents the address and it is merely holds a positive value.
19) Can a file other then abc.h be included with #include?
Whatever file specified in the # include the preprocessor would include it. It is alwa
20) what is static identifier?
Static variable represents local variable and it remains in the memory even after the
21) what is static identifier?
Static variable represents local variable and it remains in the memory even after the
22) What are the advantages of the automated variable?
Auto variable can be used in different blocks.
Efficient use of memory.
Variables are protected.
23) What is the use of clrscr()?
Clscr() is a function creates a black screen that creates an impression of clearing t
24) What is the difference between far and near?
Near pointer operates under 64 kilo bytes and far pointer operates under 16 kilo byte
25) What is size of operator?
Size of operator is to obtain the size of the operand. Format of size of operator Siz