- How do you write a program which produces its own source code as its output?
- Implement a queue template class using link list?
- What do you mean by inline function?
- How can I find the day of the week given the date?
- Why doesn’t C have nested functions?
- Write a program to generate the Fibonacci Series?
- Write a program which employs Recursion?
- How can I access memory located at a certain address?
- How can I allocate arrays or structures bigger than 64K?
- What is the most efficient way to count the number of bits which are set in a value?
- How can I return multiple values from a function?
- What is operator overloading?what r the advantages of operator overloading?
- What are inline functions?
- Write a program to concatenate two strings.
- What do you mean by inheritance?
- Implement a circular link list using pointers?
- Implement a Hash Table Abstract. Write programs for String Reversal. The same for Palindrome check.
- How can I invoke another program from within a C program?
- What is namespace?
- Write a program to interchange 2 variables without using the third one.
- What is the difference between "overloading" and "overriding"?
- Write a program to find the Factorial of a number.
- What is encapsulation?
- How can I convert integers to binary or hexadecimal?
- How can I call a function, given its name as a string?
- How do I access command-line arguments
- What’s wrong with the call fopen(”c:\newdir\file.dat”, “r”)?
- What will happen if I say delete this Difference between “C structure” and “C++ structure”.
- What is the difference between "overloading" and "overriding"?
- What are the different types of polymorphism?
- What is the output of printf(”%d”) What is encapsulation?
- What does static variable mean? Give 2 examples of a code optimization.
- What is Dangling Pointer?
- What are Virtual Functions?
- How to implement virtual functions in “C” What are the different types of Storage classes?
- What is a pointer?
- What is virtual function?
- What is Memory alignment?
- Difference between pass by reference and pass by value?
- Why Pointers are not used in C Language. What are the main differences between C and C++ Can we have “Virtual Constructors”?
- what is a smart pointer?
- What is auto pointer?
- Why should you use smart pointers?
- Explain in detail. What is public, protected, private?
- What is polymorphism? Explain with an example?
- When are temporary variables created by C++ compiler?
- Difference between a “assignment operator” and a “copy constructor”
- What is the difference between “overloading” and “overriding”?
- How to reduce a final size of executable?
- What is Memory Leak?
- What is passing by reference?
- What problem does the namespace feature solve?
- What are macros? What are the advantages and disadvantages?
- What is Namespace?
- Why does C++ have both pointers and references?
- Why is "this" not a reference?
- Is there a "placement delete"?
- What's wrong with arrays?
- What are the types of STL containers?.
- Can we generate a C++ source code from the binary file?
- What are inline functions?
- What is the difference between Strings and Arrays?
- What is encapsulation?
- What do you mean by binding of data and functions?
- In a header file whether functions are declared or defined?
- What is “strstream” ?
- What do you mean by binding of data and functions?
- What are the advantages of using pointers in a program?
- What the advantages of using Unions?
- Difference between “vector” and “array”?
- Is there something that I can do in C and not in C++?
- Explain “passing by value”, “passing by pointer” and “passing by reference”
- Have you heard of “mutable” keyword?
- What is a “RTTI”?
- What is difference between Structure and Unions?
- Can I stop people deriving from my class?
- Why doesn't C++ provide heterogeneous containers?
- Does "friend" violate encapsulation?
- Should I use NULL or 0?
- How are C++ objects laid out in memory?
- What's the value of i++ + i++?
- Why can't I define constraints for my template parameters?
- Why use sort() when we have "good old qsort()"?
- What is a function object?
- How do I deal with memory leaks
- How many lines of code you have written for a single program?
- How to write multithreaded applications using C++?
- How can I force objects of my class to always be created via new rather than as locals or global/static objects?
- Explain working of printf.
- What are some ways try / catch / throw can improve software quality?
- How do I allocate multidimensional arrays using new?
- What do you mean by inheritance?
- Does C++ have arrays whose length can be specified at run-time?
- What is Memory Alignment?
- When shall I use Multiple Inheritance?
- Explain whether Member Functions should be used in Smart Pointer class?
- what is the size of class which has int, double, and char?
- what are auto static variables and auto extern variables?
- What are the techniques you use for debugging?
- Implement a stack class using linked list or pointers?
- Implement a stack class using linked list or pointers?
- What's another way to build a Matrix template?
- What is the difference between Function and Member function?
- Write any small program that will compile in “C” but not in “C++”
- Talk something about profiling?
- Why preincrement operator is faster than post increment?
- Implement a Algorithm to check if the link list is in ascending order?
- What is faster ++i or i++, where i is an interger variable?
- How can I read a directory in a C program?
- Can I drop the [] when deleting array of some built-in type (char, int, etc)?
- How can I increase the allowable number of simultaneously open files?
- How do I do simple reference counting?
- How do I provide reference counting with copy-on-write semantics?
- What is friend function?
- Explain Storage issues of Smart Pointers?
- How can I find out how much memory is available?
- Write an algorithm to reverse a link list?
- How do I provide reference counting with copy-on-write semantics for a hierarchy of classes?
- Can you absolutely prevent people from subverting the reference counting mechanism, and if so, should you?
- What if I forget the [] when deleting array allocated via new k[n]?
- Is it legal (and moral) for a member function to say delete this?
- How can I handle a constructor that fails?
- Can I use a garbage collector in C++?
- What are the two kinds of garbage collectors for C++?
- What are the differences between a C++ struct and C++ class?
- What are the access privileges in C++? What is the default access level?
- What is a nested class? Why can it be useful?
- What is a local class? Why can it be useful?
- Can a copy constructor accept an object of the same class as parameter, instead of reference of the object?
- What is a class?
- What is near, far and huge pointers? How many bytes are occupied by them?
- How would you obtain segment and offset addresses from a far address of a memory location?
- What is diff between malloc()/free() and new/delete?
- What is "this" pointer?
- Can we take "main function" as of type float,char etc?
- How can we define a dynamic memory allocation in UNIX operating system?
- How to write a program such that it will delete itself after execution?
- Are the expressions arr and *arr same for an array of integers?
- What does extern "C" int func(int *, Foo) accomplish?
- How do you access the static member of a class?
- What is multiple inheritance(virtual inheritance)? What are its advantages and disadvantages?
- What are C++ storage classes?
- What are storage qualifiers in C++ ?
- What is a NULL Macro?
- What is the difference between a NULL Pointer and a NULL Macro?
- What does the error ‘Null Pointer Assignment’ mean and what causes this error?
- What is a NULL Pointer? Whether it is same as an uninitialized pointer?
- What will be output of the following program ? #include void main() { int cnt = 5, a; do { a /= cnt; } while (cnt --); printf ("%d\n", a); }
- What is the diff between "new" and "operator new" ?
- What is difference between template and macro?
- What is a dangling pointer?
- What is an object?
- When is an interface "good"?
- Print the output of this program #include void main() { int a, b, c, abc = 0; a = b = c = 40; if (c) { int abc; abc = a*b+c; } printf ("c = %d, abc = %d\n", c, abc); }
- Define copy constructor? What is the use of copy constructor?
- What is reference ??
- What is the use of 'using' declaration?
- What is encapsulation?
- Write down the equivalent pointer expression for referring the same element a[i][j][k][l]?
- How to write a program such that it will delete itself after execution?
- What is a far pointer? where we use it?
- How did you first get interested in Computer Science?
- What do you like to do best related to computers now (programming, administration, testing, manage projects, etc)?
- What is it about that area that you specifically enjoy?
- To which numbering system can the binary number 1101100100111100 be easily converted to?
- What is the use of volatile keyword? Give me one example?
- Find the size of an integer data type with out using sizeof() function?
- What is the maximum combined length of command line arguments including the space between adjacent arguments?
- What are the types of STL containers?
- Difference between a "assignment operator" and a "copy constructor"
- What is virtual class and friend class?
- Are the variables argc and argv are local to main?
- Which bit wise operator is suitable for checking whether a particular bit is on or off?
- Which bit wise operator is suitable for turning off a particular bit in a number?
- Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
- What are bit fields? What is the use of bit fields in a Structure declaration?
- If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
- What is the difference between structures and classes in C++?
- How can double dimensional arrays be dynamically initialized in C++?
- What is difference between constructor and destructor
#define f(a,b) a+
#define g(a,b) a*b
main()
{
int m;
m=2*f(3,g(4,5));
printf(" m is %d",m);
}
what's the value of m
a.70
b.50
c.26
d. 69 - How would you use the functions sin(), pow(), sqrt()?
- Is it safe to delete the same pointer twice?
- Can I free() pointers allocated with new? Can I delete pointers allocated with malloc()?
- Why should I use new instead of trustworthy old malloc()?
- Can I use realloc() on pointers allocated via new?
- What is the difference between class and structure?
- What is the difference between macro and inline()?
- How would you use the functions randomize() and random()?
- How would you implement a substr() function that extracts a sub string from a given string?
- What is the difference between the functions rand(), random(), srand() and randomize()?
- What is the difference between the functions memmove() and memcpy()?
- How would you obtain the current time and difference between two times?
- What is difference between copy constructor and constructor?
- How do you print a string on the printer?
- Can you use the function fprintf() to display the output on the screen?
- Why can't I resume after catching an exception?
- How would you use the functions memcpy(), memset(), memmove()?
- Is it safe to delete the same pointer twice?
- Write a program to calculate number of 1's (bit) in a given integer number i.e) Number of 1's in the given integer's equivalent binary representation.
- Why are destructors not virtual by default?
- Why don't we have virtual constructors?
- Differentiate between a for loop and a while loop? What are it uses?
- What are the different storage classes in C?
- Do I need to check for NULL after p = new Fred()?
- How can I convince my (older) compiler to automatically check new to see if it returns NULL?
- How do I allocate / unallocate an array of things?
- Do I need to check for NULL before delete p?
- What are the two steps that happen when I say delete p?
- In p = new Fred(), does the Fred memory "leak" if the Fred constructor throws an exception?
- How would you use the functions fseek(), freed(), fwrite() and ftell()?
- Why doesn't overloading work for derived classes?
- Can I call a virtual function from a constructor?
- What will be the output of this program ?
#include main()
{ int *a, i; a = (int *) malloc(10*sizeof(int));
for (i=0; i<10; i="0;"> - How would you dynamically allocate a one-dimensional and two-dimensional array of integers?
- Can you write a function similar to printf()?
- What is the difference between a pointer and a reference?
- How are prefix and postfix versions of operator++() differentiated?
- Can you dynamically allocate arrays in expanded memory?
- Which function should be used to free the memory allocated by calloc()?
- How much maximum can you allocate in a single call to malloc()?
- How can a called function determine the number of arguments that have been passed to it?
- Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
- When do use "const" reference arguments in function?
- How can you increase the size of a dynamically allocated array?
- What is copy constructor?
- When are copy constructors called?
- How can you increase the size of a statically allocated array?
- What is object file? How can you access object file?
- Which header file should you include if you are to develop a function which can accept variable number of arguments?
- When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
- What is the difference between const char *myPointer and char *const myPointer?
- How can I handle a constructor that fails?
- Can you overload a function based only on whether a parameter is a value or a reference?
- How does C++ help with the tradeoff of safety vs. usability?
- How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?
- Is Encapsulation a Security device?
- What is assignment operator?
- In header files whether functions are declared or defined?
- What is a structure?
- Explain the need for “Virtual Destructor”.
- What is Polymorphism?
- How can I handle a destructor that fails?
- What is Virtual Destructor?
- Can you think of a situation where your program would crash without reaching the breakpoint which you set at the beginning of main()?
- Name two cases where you MUST use initialization list as opposed to assignment in constructors.
- What is constructor or ctor?
- What is destructor?
- What is encapsulation?
- What is pure virtual function? or what is abstract class?
- What are the differences between structures and arrays?
- How can I write/read objects of my class to/from a data file?
- How can I send objects of my class to another computer (e.g., via a socket, TCP/IP, FTP, email, a wireless link, etc.)?
- Why can't I open a file in a different directory such as "..\test.dat"?
- What is default constructor?
- What are the differences between malloc() and calloc()?
- What's the difference between the keywords struct and class?
- How can I tell {if a key, which key} was pressed before the user presses the ENTER key?
- How can I make it so keys pressed by users are not echoed on the screen?
- Does delete p delete the pointer p, or the pointed-to-data *p?
- In c++ have a default constructor ?
- How do you write a program which produces its own source code as its output?
- what is memory leaking in c++ ?
- Why cant one make an object of abstract class?Give compiler view of statement
- what is the difference betwen wait() and delay()?
- What are Virtual Functions? How to implement virtual functions in "C"
- What is virtual constructors/destructors?
int f(int *a)
{
int b=5;
a=&b;
}
main()
{
int i;
printf(" %d",i);
f(&i);
printf(" %d",i);
}
what's the output .
1.10,5
2,10,10
c.5,5
d. none - How do I use exceptions?
- Write the hello world program . . . Without using any semi-colon's ";" ?
- How does free know the size of memory to be deleted? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete?
- Write a function to display an integer in a binary format.
- Implement Binary Search Tree in C++?
- Why doesn't C++ have an equivalent to realloc()?
- Why are member functions not virtual by default?
- What is the similarity between a Structure, Union and enumeration?
- Write the output of this program #include #define calc(a, b) (a * b) / (a - b) void main() { int a = 20, b = 10; printf("%d\n", calc(a + 4, b -2)); }
- What is an Iterator class?
- Implement Binary Heap in C++?
- Implement Vector class in C++?
- Implement STL List template class in C++? STL List class is a doubly linked list with a head and a tail pointer.
- Why doesn't C++ have a universal class Object?
- How do I read a string from input?
- Implementation of string length using pointer hopping
- Why is the size of an empty class not zero?
- Why do I have to put the data in my class declarations?
- Write a program to swap two integers without using 3rd integer (ie. Without using any temporary variable)
- Write a general swap macro in C : - A macro which can swap any type of data (ie. int, char, float, struct, etc..)
- What is a reference?
What happens if you assign to a reference? - Why can't I initialize my static member data in my constructor's initialization list?
- Should my constructors use "initialization lists" or "assignment"?
- Implementation of Random number generator?
- Implement Tic-Tac Game in C++?
- What happens if you return a reference?
- How can you reseat a reference to make it refer to a different object?
- When should I use references, and when should I use pointers?
- What is a handle to an object? Is it a pointer? Is it a reference? Is it a pointer-to-a-pointer? What is it?
- What is the "Named Constructor Idiom"?
- Does return-by-value mean extra copies and extra overhead?
- But can I explicitly call a destructor if I've allocated my object with new?
- What is "placement new" and why would I use it?
- Can one constructor of a class call another constructor of the same class to initialize the this object?
- When I write a derived class's destructor, do I need to explicitly call the destructor for my base class?
- Should my destructor throw an exception when it detects a problem?
- Why can't I assign a vector
to a vector ? - Should you use this pointer in the constructor?
- When I write a destructor, do I need to explicitly call the destructors for my member objects?
- Why are classes with static data members getting linker errors?
- What if I can't wrap the local in an artificial block?
- Is there a way to force new to allocate memory from a specific memory area?
main()
{
int i;
fork();
fork();
fork();
printf("----");
}
how many times the printf will be executed .
a.3
b. 6
c.5
d. 8
Tuesday, May 29, 2007
C/C++ Faqs
Subscribe to:
Post Comments (Atom)
4 comments:
1. what are the main defferences between an array and a C++ vector? explain with examples.
2. what is the defferences between between a function template and templete function? explain with examples.
what are the different pre-processor firectives in C++? what are their advantages?
write a program that reads full names , one per line and then prints them in the standard telephone directory format.
what are the different pre-processor directives in C++? what are their advantages?
Post a Comment