Friday, July 30, 2010

Some Technical Interview questions on C and C++.

Hello friends,
Here are some questions that are regularly asked in interviews.Be prepared with crisp and perfect answer to all of these.

1>What are the different storage class specifiers in C?explain them?.

2>Explain the memory segments in c?(code segment,data,stack and heap).

3>Diff between declaration and definition?give examples w.r.t to variables and functions?.

4>What do u mean by little-endian and big-endian?write a code to determine wheather the machine is little-endian or big-endian?.

5>What are the difference between c and c++?explain the pillars of oops?.

6>Give the real-world examples for each pillar of oops?.

7>What is the difference between structures and unions?give real world example where unions are used?.

8> Write a program to reverse a string with an efficiency of n/2?.

9>Write a program to check the palindrome of a string?.

10>Write a single line condition that checks wheather the string is power of 2 or not?.

11>Write the code to set the particular bit in a integer?.

12>What do u mean by pointer?explain the difference between constant pointer and pointer to a constant?.

13>Write a program to reverse the singly linked list?.

14>How would u check, list is circular or not?.

15>I want to delete the middle node in a list of some thousands of nodes(given the address of that deleting node).How will u do this efficiently?.

16>How does the free function works in c?.
17>Give the real-world example where the static variables are used?

18>What do u mean by volatile variable?why it is used?is it possible to decalre a variable which is constant and volatile?.

19>Write a program to swap 2 variables without using temporary variable?

20>Is it possible to execute a user defined function after calling exit in a program?

21>What do u mean by variable number of arguments?.Write a function to use variable number of arguments?

22>What do u mean by virtual functions?How these are achieved?.

23>Explain the different types of inheritance with an example?

24>What is the issue with multiple inheritance?

25>Write a program to swap 2 nibbles in a byte?

26>Write a C program to find the number of 1's in an integer?

27>Write a C Program to sum the digits in an integer?

28>What do u mean by preprocessor statements?I want to compile only some part of code
depending upon some condition.How do i achieve this?

29>Define constructor and destructor?Explain the execution of both w.r.t base class and derived class?

30>What is copy constructor?When is it called?


31>What is the difference between dynamic linking and static linking of  libraries?