Wednesday, May 10, 2006

parsing the command line options / flags

The GNU C library provides a function that you can use in C and C++
programs to parse the make this job somewhat easier (although still a
bit annoying).This function, getopt_long, understands both short and
long options.

header file to include <getopt.h>

Tuesday, May 09, 2006

OOP interview questions.

  1. What is MUTEX ?
  2. What isthe difference between a 'thread' and a 'process'?
  3. What is INODE?
  4. Explain the working of Virtual Memory.
  5. How does Windows NT supports Multitasking?
  6. Explain the Unix Kernel.
  7. What is Concurrency? Expain with example Deadlock and Starvation.
  8. What are your solution strategies for "Dining Philosophers Problem" ?
  9. Explain Memory Partitioning, Paging, Segmentation.
  10. Explain Scheduling.
  11. Operating System Security.
  12. What is Semaphore?
  13. Explain the following file systems : NTFS, Macintosh(HPFS), FAT .
  14. What are the different process states?
  15. What is Marshalling?
  16. Define and explain COM?
  17. What is Marshalling?
  18. Difference - Loading and Linking ?

C /C++ interview questions..

  1. What is the output of printf("%d")
  2. What will happen if I say delete this
  3. What is Dangling pointer?
  4. Difference between "C structure" and "C++ structure".
  5. Diffrence between a "assignment operator" and a "copy constructor"
  6. What is the difference between "overloading" and "overridding"?
  7. Explain the need for "Virtual Destructor".
  8. Can we have "Virtual Constructors"?
  9. What are the different types of polymorphism?
  10. What are Virtual Functions? How to implement virtual functions in "C"
  11. What are the different types of Storage classes?
  12. What is Namespace?
  13. What are the types of STL containers?.
  14. Is there any difference between a messageand method?
  15. If I ask you to write 'VI' editor in C++ - How you'll proceed?
  16. Difference between char name[] = “prashant n mhatre”; and char *name = “prashant n mhatre”;
  17. Should we use global variables?
  18. Parsing HTML or XML document with C++
  19. What is 'self assignment'?
  20. Difference between how virtual and non-virtual member functions are called
  21. Finding shortest path aka Dijkstra's algorithm and backtracking
  22. Doing permutations and combinations in C++

  23. Difference between "vector" and "array"?
  24. How to write a program such that it will delete itself after exectution?
  25. Can we generate a C++ source code from the binary file?
  26. What are inline functions?
  27. Talk sometiming about profiling?
  28. How many lines of code you have written for a single program?
  29. What is "strstream" ?
  30. How to write Multithreaded applications using C++?
  31. Explain "passing by value", "passing by pointer" and "passing by reference"
  32. Write any small program that will compile in "C" but not in "C++"
  33. Have you heard of "mutable" keyword?
  34. What is a "RTTI"?
  35. Is there something that I can do in C and not in C++?
  36. Why preincrement operator is faster than postincrement?
  37. What is the difference between "calloc" and "malloc"?
  38. What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?
  39. What is Memory Alignment?
  40. Explain working of printf.
  41. Difference between "printf" and "sprintf".
  42. What is "map" in STL?
  43. When shall I use Multiple Inheritance?
  44. What are the techniques you use for debugging?
  45. How to reduce a final size of executable?
  46. Give 2 examples of a code optimization.

Database/SQL Interview questions

  1. What are the different types of joins?
  2. Explain normalization with examples.
  3. What cursor type do you use to retrieve multiple recordsets?
  4. Diffrence between a "where" clause and a "having" clause
  5. What is the difference between "procedure" and "function"?
  6. How will you copy the structure of a table without copying the data?
  7. How to find out the database name from SQL*PLUS command prompt?
  8. Tadeoffs with having indexes
  9. Talk about "Exception Handling" in PL/SQL?
  10. What is the diference between "NULL in C" and "NULL in Oracle?"
  11. What is Pro*C? What is OCI?
  12. Give some examples of Analytical functions.
  13. What is the difference between "translate" and "replace"?
  14. What is DYNAMIC SQL method 4?
  15. How to remove duplicate records from a table?
  16. What is the use of ANALYZing the tables?
  17. How to run SQL script from a Unix Shell?
  18. What is a "transaction"? Why are they necessary?
  19. Explain Normalizationa dn Denormalization with examples.
  20. When do you get contraint violtaion? What are the types of constraints?
  21. How to convert RAW datatype into TEXT?
  22. Difference - Primary Key and Aggregate Key
  23. How functional dependency is related to database table design?
  24. What is a "trigger"?
  25. Why can a "group by" or "order by" clause be expensive to process?
  26. What are "HINTS"? What is "index covering" of a query?
  27. What is a VIEW? How to get script for a view?
  28. What are the Large object types suported by Oracle?
  29. What is SQL*Loader?
  30. Difference between "VARCHAR" and "VARCHAR2" datatypes.
  31. What is the difference among "dropping a table", "truncating a table" and "deleting all records" from a table.
  32. Difference between "ORACLE" and "MICROSOFT ACCESS" databases.
  33. How to create a database link ?

OOP interview questions.

  1. What is inheritance?
  2. Difference between Composition and Aggregation.
  3. Difference: Sequence Diagrams, Collaboration Diagrams.
  4. Difference: 'uses', 'extends', 'includes'
  5. What shall I go for Package Diagram?
  6. What is Polymorphism?
  7. Is class an Object? Is object a class?
  8. Comment: C++ "includes" behavior and java "imports"
  9. What do you mean by "Realization"?
  10. What is a Presistent, Transient Object?
  11. What is the use of Operator Overloading?
  12. Does UML guarantee project success?
  13. Difference: Activity Diagram and Sequence Diagram.
  14. What is association?
  15. How to resolve many to many relationship?
  16. How do you represent static members and abstract classes in Class Diagram?
  17. Can we use UML for user interface (UI) design?
  18. Every object has : state, behavior and identity - explain
  19. How to reverse engineer C++ code in UML?
  20. What are the tools you used for OOAD?
  21. Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?
  22. What are the four phases of the Unified Process ?
  23. How do you convert uses cases into test cases?
  24. Explain Class Diagram in Detail.
  25. What are the Design Patterns you know.
  26. When do you prefer to use composition than aggregation?
  27. UML: IS it a process, method or notation?
  28. Does a concept HAVE to become a class in Design?
  29. What are the good practices to use while designing for reuse?
  30. Can you think of some nice examples where *multiple* actors are associated with a use case ?
  31. How to use CRC Cards for Class Design?
  32. What is the difference between static and dynamic Classificaition.Give some examples.
  33. Explian following terms: Constraint Rules, Design by contract.
  34. What is Object Constraint Language (OCL)?
  35. Difference Between Attribute and Association.
  36. What are associative classes?

Friday, May 05, 2006

compile for debug with gdb

add -ggdb flag in the compile & link command.
eg:
    g++ -c file_one.c -o file_one.o -ggdb
    g++ file_one.o file_two.o -o binary_file -ggdb


Wednesday, May 03, 2006

create, chmod a directory

#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>

int main(int argc, char** argv)
{
int fd;

fd = open("testdir", O_CREAT, 555);
if(fd != -1)
fchmod(fd, 422);
else
printf("cannot open the directory \n");

return 0;
}