Thursday, May 6, 2010

C++ programming Interview Questions on UNIX


Could you tell something about the Unix System Kernel?
The kernel is the heart of the UNIX operating system, it’s responsible for controlling the computer’s resources and scheduling user jobs so that each one gets its fair share of resources.
What are each of the standard files and what are they normally associated with?
They are the standard input file, the standard output file and the standard error file. The first is usually associated with the keyboard, the second and third are usually associated with the terminal screen.

Determine the code below, tell me exactly how many times is the operation sum++ performed ?
for ( i = 0; i < j =" 100;"> 100 - i; j–)
sum++;

(99 * 100)/2 = 4950
The sum++ is performed 4950 times.

Give 4 examples which belongs application layer in TCP/IP architecture?

FTP, TELNET, HTTP and TFTP

What’s the meaning of ARP in TCP/IP?

The "ARP" stands for Address Resolution Protocol. The ARP standard defines two basic message types: a request and a response. a request message contains an IP address and requests the corresponding hardware address; a replay contains both the IP address, sent in the request, and the hardware address.

What is a Makefile?

Makefile is a utility in Unix to help compile large programs. It helps by only compiling the portion of the program that has been changed.
A Makefile is the file and make uses to determine what rules to apply. make is useful for far more than compiling programs.

What is deadlock?

Deadlock is a situation when two or more processes prevent each other from running. Example: if T1 is holding x and waiting for y to be free and T2 holding y and waiting for x to be free deadlock happens.

What is semaphore?

Semaphore is a special variable, it has two methods: up and down. Semaphore performs atomic operations, which means ones a semaphore is called it can not be inturrupted.

The internal counter (= #ups - #downs) can never be negative. If you execute the “down” method when the internal counter is zero, it will block until some other thread calls the “up” method. Semaphores are use for thread synchronization.
Is C an object-oriented language?
C is not an object-oriented language, but limited object-oriented programming can be done in C.

Name some major differences between C++ and Java?

C++ has pointers; Java does not. Java is platform-independent; C++ is not. Java has garbage collection; C++ does not. Java does have pointers. In fact all variables in Java are pointers. The difference is that Java does not allow you to manipulate the addresses of the pointer

No comments: