- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
Unix Programming Interview Questions & Answers - Learning Mode

Unix Programming Interview Questions & Answers - Learning Mode

Unix (trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, developed in the 1970s at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others. UNIX was one of the first operating systems to be written in a high-level programming language, namely C. This meant that it could be installed on virtually any computer for which a C compiler existed. This natural portability combined with its low price made it a popular choice among universities.

Try Unix Programming Interview Questions & Answers - Exam Mode

1 2 3 Next

Sort By : Latest First | Oldest First | By Rating

Unix Programming Interview Questions & Answers - Learning Mode
Try Unix Programming Interview Questions & Answers - Exam Mode
Question: Create your own shell that completes the following problem: Ask the user their name,
Compare it to your name,
Give a reply that their response is either your name too or it is a nice name too

Answer: print -n "PLEASE ENTER Your First NAME? "
read answer
typeset -u answer
if [[ -n $answer ]]
if [ $answer = 'SHERWOOD' ]
echo "Your Name Too - " $answer
echo "Nice Name Too - " $answer
fi Source:
Question: Explain about the command overwrite?

Answer: Overwrite is committed to changing the original file. If the program providing input to overwrite gets an error, its output will be empty and overwrite will dutifully and reliably destroy the argument file. Overwrite could ask for conformation before replacing the file, but making overwrite interactive would negate its efficiency. Overwrite could check that its input is empty. Source:
Question: Who helped you put this list together?

Answer: I took over the maintenance of this list. Almost all of the work (and the credit) for generating this compilation was done by Steve Hayman. We also owe a great deal of thanks to dozens of Usenet readers who submitted questions, answers, corrections and suggestions for this list. Special thanks go to Maarten Litmaath, Guy Harris and Jonathan Kamens, who have all made many especially valuable contributions. Part 5 of this document (shells) was written almost entirely by Matthew Wicks . Part 6 of t Source:
Question: Explain about signal argument?

Answer: The sequence of commands is a single argument, so it must almost always be quoted. The signal numbers are small integers that identify the signal. For example, 2 is the signal generated by pressing the DEL key, and 1 is generated by hanging up the phone. Unless a program has taken explicit action to deal with signals, the signal will terminate it. Source:
Question: Give examples of how memory leaks can occur with c programs

Answer: Memory leaks can be occured if no allocated memory is freed. for example,malloc() and free().It is always a good practice to release the memory because it can be dangerous. it could afftect the whole program and lead to very difficult situtation. Make sure that you are releasing the allocated memory at time. so next time you write program, think twice before allocating memory. I always writedown a notes before i start program. so i know whats going on.

Momery leak example occurs when Source:
Question: What type of scheduling is used in Unix

Answer: Multi Level Feedback Queue Scheduling with each queue in round robin Source:
Question: How do you debug a core dump

Answer: > gdb a.out

? core core

? backtrace
Question: How do I ring the terminal bell during a shell script?

Answer: The answer depends on your Unix version (or rather on the kind of "echo" program that is available on your machine).

A BSD-like "echo" uses the "-n" option for suppressing the final
newline and does not understand the octal nn notation. Thus
the command is

echo -n '^G'

where ^G means a _literal_ BEL-character (you can produce this in
emacs using "Ctrl-Q Ctrl-G" and in vi using "Ctrl-V Ctrl-G").

A SysV-like Source:
Question: Explain about fgets?

Answer: Fgets (buf, size, fp) fetches the next line of input from fp, up to and including a newline, into buf, and adds a terminating Source:
Question: Is the function call to exit at the end of vis necessary?

Answer: The call to exit at the end of vis is not necessary to make the program work properly, but it ensures that any caller of the program will see a normal exit status from the program when it completes. An alternate way to return status is to leave main with return 0; the return value from main is the program`s exit status. Source:
Question: How do I find the creation time of a file?

Answer: You can't - it isn't stored anywhere. Files have a last-modified time (shown by "ls -l"), a last-accessed time (shown by "ls -lu") and an inode change time (shown by "ls -lc"). The latter is often referred to as the "creation time" - even in some man pages - but that's wrong; it's also set by such operations as mv, ln, chmod, chown and chgrp. The man page for "stat(2)" discusses this. Source:
Question: How do I construct a shell glob-pattern that matches all files except "." and ".." ?

Answer: You'd think this would be easy.

* Matches all files that don't begin with a ".";

.* Matches all files that do begin with a ".", but
this includes the special entries "." and "..",
which often you don't want;

.[!.]* (Newer shells only; some shells use a "^" instead of
the "!"; POSIX shells must accept the "!", but may
accept a "^" as well; all portable applications shall
not use an unquot Source:
Question: Explain about trap command

Answer: The trap command sequence must explicitly invoke exit, or the shell program will continue to execute after the interrupt. The command sequence will be read twice: once when the trap is set and once when it is invoked. Trap is used sometimes interactively, most often to prevent a program from being killed by the hangup signal. Source:
Question: How do I remove a file whose name begins with a "-" ?

Answer: Figure out some way to name the file so that it doesn't begin with a dash. The simplest answer is to use rm ./-filename (assuming "-filename" is in the current directory, of course.) This method of avoiding the interpretation of the "-" works with other commands too.

Many commands, particularly those that have been written to use the "getopt(3)" argument parsing routine, accept a "--" argument which means "this is the last option, anything after this is not an option", so your versio Source:
Question: How would you remove a semaphore / shared memory whose owner processes have died?

Answer: ipcrm -sem id ; for semaphores
ipcrm -shm id ; for shared mem Source:
Question: What's the difference between fork() and vfork()?

Answer: Some systems have a system call vfork(), which was originally
designed as a lower-overhead version of fork(). Since
fork() involved copying the entire address space of the process,
and was therefore quite expensive, the vfork() function was
introduced (in 3.0BSD). Source:
Question: How do I get a recursive directory listing?

Answer: One of the following may do what you want:

ls -R (not all versions of "ls" have -R)
find . -print (should work everywhere)
du -a . (shows you both the name and size)

If you're looking for a wildcard pattern that will match all ".c" files in this directory and below, you won't find one, but you can use % some-command `find . -name '*.c' -print` "find" is a powerful program. Learn about it. Source:
Question: Explain about the rules used in overwrite to preserve the arguments to the users command?

Answer: Some of the rules are
? $* and $@ expand into the arguments and are rescanned; blanks in arguments will result in multiple arguments.
? ?$*? is a single word composed of all the arguments to the shell file joined together with spaces.
? ?$@? is identical to the arguments received by the shell file: blanks in arguments are ignored and the result is a list of words identical to the original arguments. Source:
Question: What are the differences between Shared and Dynamic libraries

Answer: : There are two ways in which a library is shared. Static and dynamic

In statically linked library the code of library is referenced at compile time and the result executable will be bigger.

I dynamically linked libraries the code of library is referenced at run time and resulting executable will be smaller. But drwaback is that at run time this will need the library to reference the library related symbols.
Question: Describe about awk and sed?

Answer: The awk program processes this to report the changes in an easier to understand format. Sed output is always behind its input by one line; there is always a line of input that has been processed but not printed, and this would introduce an unwanted delay. Source:

1 2 3 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.016113 Seconds