- 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: 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 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: What type of scheduling is used in Unix

Answer: Multi Level Feedback Queue Scheduling with each queue in round robin 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: 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: 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: 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:
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: 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 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: How are devices represented in UNIX?

Answer: All devices are represented by files called special files that are located in/dev directory. Thus, device files and other files are named and accessed in the same way. A 'regular file' is just an ordinary data file in the disk. A 'block special file' represents a device with characteristics similar to a disk (data transfer in terms of blocks). A 'character special file' represents a device with characteristics similar to a keyboard (data transfer is by stream of bits in s Source:
Question: Explain about kill command?

Answer: The kill command only terminates processes specified by process-id when a specific background process needs to be killed, you must usually run ps to find the process-id and then re type it as an argument to kill. Killing process is dangerous and care must be taken to kill the right processes. 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: How do you debug a core dump

Answer: > gdb a.out

? core core

? backtrace
Question: Why do I get [some strange error message] when I "rsh host command" ?

Answer: (We're talking about the remote shell program "rsh" or sometimes "remsh" or "remote"; on some machines, there is a restricted shell called "rsh", which is a different thing.) If your remote account uses the C shell, the remote host will fire up a C shell to execute 'command' for you, and that shell will read your remote .cshrc file. Perhaps your .cshrc contains a "stty", "biff" or some other command that isn't appropriate for a non-interactive shell. The unexpected output or erro Source:
Question: Explain the unix file system.

Answer: Basically there are 4 diiferent types of file systems in unix ,they are as follows
1.Device file
2.Directory fil.
4.Regular file
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:

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.03125 Seconds