C and C++ Interview Questions And Answers for freshers and experience

C and C++ interview questions and answers on advance and basic C and C++ with example so this page for both freshers and experienced condidate

from 46 to 60 C and C++ interview questions and answers

Question: 46 :: How to declare a function pointer?

int (* function_pointer)(); --> This is the declaration of the function pointer.
function_pointer = display; --> This is assignment of address of a function to the function pointer.

Question: 47 :: What are the two shift operators and what are their functions?

There are two shift operators those are Left Shift Operator and Right Shift Operator.
Left shift operator and Right shift operator are denoted by << and >> respectively.
These are used when there is arequirement to multiply/divide an integer by a power of two.


Question: 48 :: What is the size of integer variable?

The size of the integer variable varies with the processor and the operating system, i.e,weather an operating system is 16-bit or 32-bit or 64 bit.
For 16-bit its 4 byte and for 32-bit also its 4 byte but for 64-bit its 8 bytes.

Question: 49 :: When a C file is executed there are many files that are automatically opened what are they files?

When a C file is executed some files that are opened automatically are stdout, stdin and stderr ,i.e, standard output, standard input and standard error.

Question: 50 :: What is Endianness?

The attribute of a system that indicates whether integers are represented with the most significant byte stored at the lowest address or at the highest address.

Question: 51 :: Out of fgets() and gets() which function is safe to use?

fgets() is more safe to use in comparison with gets() because fgets() can be told the size of the buffer into which the string supliied will be stored which has an advantage of no stack overflow, i.e, since the size of the buffer is already known.

Question: 52 :: What do you mean by const correctness?

A program is said to be const correct if it nevr changes a constant oblect thrughout.

Question: 53 ::Which bitwise operator is used to check whether a particular bit is on or off?

The operator that is used for checking the on or off bit is the & opertaor.

Question: 54 :: What are the uses of typedef in a program?

The are many uses of typedef some of them includes:
It makes writing of complicated declaratioms a lot easier.
It helps in achieving portability in programs.
It helps in providing a better documentation for a program.

Question: 55 :: What is the use of bit fields in structure declaration?

TO save the sapce in structures having several binary flags or other small fields bit fields are used.

Question: 56 :: is arr and &arr are same expression for an array?

No, they both are different.
array gives the address of the first element of the array whereas the &arr give the address of the array of elements

Question: 57 :: What are the uses of pointers?

Pointers can be for dynamic memory allocations, implementing linked lists, trees graphs, in call by reference, accessing elements of strings and arrays, etc.

Question: 58 :: What do the header files usually contains?

Header files contains the preprocessor directives like typedef declarations, declaration of global variables and functions, structures, unions , enum, and also external function/variables declaration. #include is used to pull in the header files in the program.

Question: 59 :: If a header file is included twice by mistake in the program, will it give any error?

Yes, if header files are included twice or more than once in a program it gives an error so it should be taken care that a file is included only once in the program.

Question: 60 :: We use library functions in the program, in what form they are provided to the program?

Library functions are provided in object code form and are not provided in the source code form. The object code form of the functions is already compiled and are used in the programs.

Go On Top

Next PageNext Page



Ask your interview questions on C and C++

Write Your comment or Questions if you want the answers on C and C++ from C and C++ Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---