Selenium & Unix Intervoew Questions
Selenium & Unix Intervoew Questions
Selenium & Unix Intervoew Questions
It is composed of
Selenium IDE: A tool for recording and playing back. This is a Firefox plugin. WebDriver and RC provide the APIs for a variety of languages like Java, .NET, PHP, etc. A Java example is shown below. The WebDriver and RC work with most browsers. Grid transparently distribute your tests on multiple machines so that you can run your tests in parallel, cutting down the time required for running in-browser test suites.
Q. In your experience, what are some of the challenges with Selenium? A. In general, badly written test cases whether junit tests or web tests, the biggest complaint is about writing test cases that are not maintainable. Unmaintainable automated test cases can take more time than manual tests. So, it is important to write quality test cases by clearly separting the page objects from the test cases as demonstrated in the Q&A above. The use of the locators need to be carefully thought through. For example, some frameworks like JSF dynamically generate HTML element IDs. So, if IDs are used in your tests, then the test cases may fail if the IDs have changed. The solution to this problem is to use XPath to find the relevant HTML elements. The ClickAndWait action will not work for AJAX calls, and use "waitForElement" instead.
What is Selenium? Selenium is a suite of tools for browser automation. It is composed of "IDE", a recording and playback mechanism, "WebDriver" and Remote Control "RC" which provide APIs for browser automation in a wide variety of languages, and "Grid", which allows many tests using the APIs to be run in parallel. QA Tester should not forget to mention during interview that with the release of Selenium 2, Selenium RC has been officially deprecated in favor of Selenium WebDriver. It works with most browsers, including Firefox
from 3.0 up to 8, Internet Explorer 8, Google Chrome, Safari and Opera 11.5. Describe technical problems that you had with Selenium tool? As with any other type of test automation tools like SilkTest, HP QTP, Watir, Canoo Webtest, Selenium allows to record, edit, and debug tests cases. However there are several problems that seriously affect maintainability of recorded test cases, occasionally Quality Assurance Engineers complain that it takes more time to maintain automated test cases than to perform manual testing; however this is an issue with all automated testing tools and most likely related to improper testing framework design. Another problem is complex ID for an HTML element. If IDs is auto-generated, the recorder test cases may fail during playback. The work around is to use XPath to find required HTML element. Selenium supports AJAX without problems, but QA Tester should be aware that Selenium does not know when AJAX action is completed, so ClickAndWait will not work. Instead QA tester could use pause, but the snowballing effect of several 'pause' commands would really slow down total testing time of test cases. The best solution would be to use waitForElement.
What test can Selenium do? Selenium could be used for the functional, regression, load testing of the web based applications. The automation tool could be implemented for post release validation with continuous integration tools like Jenkins, Hudson, QuickBuild or CruiseControl. What is the price of Selenium license per server?
Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge. How much does Selenium license cost per client machine? Selenium is open source software, released under the Apache 2.0 license and can be downloaded and used without charge. Where to download Selenium? Selenium can be downloaded and installed for free from seleniumhq.org What is the latest version of Selenium components? The latest versions are Selenium IDE 1.3.0, Selenium Server (formerly the Selenium RC Server) 2.9.0, Selenium Client Drivers Java 2.9.0, Selenium Client Drivers C# 2.9.0, Selenium Client Drivers Ruby 2.8.0, Selenium Client Drivers Python 2.9, Selenium Grid 1.0.8. What is Selenium IDE? Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test cases, which QA Tester can play back in the Firefox browser or export to Selenium RC. Selenium IDE has the following features: record/play feature, debugging with step-by-step and breakpoints, page abstraction functionality, an extensibility capability allowing the use of add-ons or user extensions that expand the functionality of Selenium IDE
What are the limitations of Selenium IDE? Selenium IDE has many great features and is a fruitful and well-organized test automation tool for developing test cases, in the same time Selenium IDE is missing certain vital features of a testing tool: conditional statements, loops, logging functionality, exception handling, reporting functionality, database testing, re-execution of failed tests and screenshots taking capability. Selenium IDE doesn't for IE, Safari and Opera browsers. What does SIDE stand for? Selenium IDE. It was a very tricky interview question. What is Selenium Remote Control (RC) tool? Selenium Remote Control (RC) is the powerful solution for test cases that need more than simple browser actions and linear execution. Selenium-RC allows the developing of complex test scenarios like reading and writing files, querying a database, and emailing test reports. These tasks
can be achieved by tweaking test cases in your preferred programming language. Selenium RC has been officially deprecated in favor of Selenium WebDriver. What are the advantages using Selenium as testing tool? If QA Tester would compare Selenium with HP QTP or Micro Focus SilkTest, QA Engineer would easily notice tremendous cost savings for Selenium. In contrast to expensive SilkTest license or QTP license, Selenium automation tool is absolutely free. It means that with almost no investment in purchasing tools, QA Team could easily build the state of the art test automation infrastructure. Selenium allows developing and executing test cases in various programming languages including .NET, Java, Perl, RubyPython, PHP and even HTML. This is a great Selenium advantage, most likely your software developers already know how to develop and maintain C# or Java code, so they transfer coding techniques and best practices to QA team. Selenium allows simple and powerful DOM-level testing and in the same time could be used for testing in the traditional waterfall or modern Agile environments. Selenium would be definitely a great fit for the continuous integration tools Jenkins, Hudson, CruiseControl, because it could be installed on the server testing box, and controlled remotely from continuous integration build.
What is Selenium Grid? Selenium Grid extends Selenium RC to distribute your tests across multiple servers, saving you time by running tests in parallel. What is Selenium WebDriver?
Selenium WebDriver is a tool for writing automated tests of websites. It is an API name and aims to mimic the behavior of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor of Selenium Remote Control which has been officially deprecated. How many browsers are supported by Selenium IDE? Test Engineer can record and playback test with Selenium IDE in Firefox. Can Selenium test an application on iPhone's Mobile Safari browser? Selenium should be able to handle Mobile Safari browser. There is experimental Selenium IPhone Driver for running tests on Mobile Safari on the iPhone, iPad and iPod Touch. Can Selenium test an application on Android browser? Selenium should be able to handle Android browser. There is experimental Selenium Android Driver for running tests in Android browser. What are the disadvantages of using Selenium as testing tool? Selenium weak points are tricky setup; dreary errors diagnosis; tests only web applications How many browsers are supported by Selenium Remote Control? QA Engineer can use Firefox 7, IE 8, Safari 5 and Opera 11.5 browsers to run actuall tests in Selenium RC.
How many programming languages can you use in Selenium RC? Several programming languages are supported by Selenium Remote Control - C# Java Perl PHP Python Ruby How many testing framework can QA Tester use in Selenium RC? Testing frameworks aren't required, but they can be helpful if QA Tester wants to automate test cases. Selenium RC supports Bromine, JUnit, NUnit, RSpec (Ruby), Test::Unit (Ruby), TestNG (Java), unittest (Python). How to developer Selenium Test Cases? Using the Selenium IDE, QA Tester can record a test to comprehend the syntax of Selenium IDE commands, or to check the basic syntax for a specific type of user interface. Keep in mind that Selenium IDE recorder is not clever as QA Testers want it to be. Quality assurance team should never consider Selenium IDE as a "record, save, and run it" tool, all the time anticipate reworking a recorded test cases to make them maintainable in the future. What programming language is best for writing Selenium tests? The web applications may be written in Java, Ruby, PHP, Python or any other web framework. There are certain advantages for using the same language for writing test cases as application under test. For example, if the team already have the experience with Java, QA Tester could always get the piece of advice while mastering Selenium test cases in Java. Sometimes it is better to choose simpler programming language that will ultimately deliver better
success. In this case QA testers can adopt easier programming languages, for example Ruby, much faster comparing with Java, and can become become experts as soon as possible. Do you know any alternative test automation tools for Selenium? Selenium appears to be the mainstream open source tool for browser side testing, but there are many alternatives. Canoo Webtest is a great Selenium alternative and it is probably the fastest automation tool. Another Selenium alternative is Watir, but in order to use Watir QA Tester has to learn Ruby. One more alternative to Selenium is Sahi, but is has confusing interface and small developers community. Compare HP QTP vs Selenium? When QA team considers acquiring test automation to assist in testing, one of the most critical decisions is what technologies or tools to use to automate the testing. The most obvious approach will be to look to the software market and evaluate a few test automation tools. Read Selenium vs QTP comparison Compare Borland Silktest vs Selenium? Check Selenium vs SilkTest comparison
Compared to traditional waterfall software development projects, the role of test automation in agile development projects is more critical and significantly different. The close collaboration between product owners, testers and developers in agile software projects also changes the way that quality is managed. Managing
quality is not seen as a discrete discipline done in isolation; it is viewed more as an integral part of overall project management with multiple stakeholders sharing responsibilities for quality and testing. This approach leads to different requirements for test automation and test management tools used to manage releases, user stories, defects and tasks. Traditional test automation and test management tools often cannot accommodate the required changes to processes, skills, attitude, and responsibility that the shift to agile management practices brings. Selenium is the truly Agile automation testing tool. It allows agile teams to generate scripts using their preferred method based on the skills of team members either visually using Selenium IDE or using a programing languages such as PHP, Java, C#, Ruby, Python. This fosters collaboration between cross-functional Agile team, helps to manage code and test together, and minimize future test-script maintenance effort.
What is Selenium? Ans. Selenium is a set of tools that supports rapid development of test automation scripts for web based applications. Selenium testing tools provides a rich set of testing functions specifically designed to fulfil needs of testing of a web based application.
Q2. What are the main components of Selenium testing tools? Ans. Selenium IDE, Selenium RC and Selenium Grid
Q3. What is Selenium IDE? Ans. Selenium IDE is for building Selenium test cases. It operates as a Mozilla Firefox add on and provides an easy to use interface for developing and running individual test cases or entire test suites.
Selenium-IDE has a recording feature, which will keep account of user actions as they are performed and store them as a reusable script to play back.
Q4. What is the use of context menu in Selenium IDE? Ans. It allows the user to pick from a list of assertions and verifications for the selected location. Q5. Can tests recorded using Selenium IDE be run in other browsers? Ans. Yes. Although Selenium IDE is a Firefox add on, however, tests created in it can also be run in other browsers by using Selenium RC (Selenium Remote Control) and specifying the name of the test suite in command line. Q6. What are the advantage and features of Selenium IDE? Ans. 1. Intelligent field selection will use IDs, names, or XPath as needed 2. It is a record & playback tool and the script format can be written in various languages including C#, Java, PERL, Python, PHP, HTML 3. Auto complete for all common Selenium commands 4. Debug and set breakpoints 5. Option to automatically assert the title of every page 6. Support for Selenium user-extensions.js file
Q7. What are the disadvantage of Selenium IDE tool? Ans. 1. Selenium IDE tool can only be used in Mozilla Firefox
Q8. What is Selenium RC (Remote Control)? Ans. Selenium RC allows the test automation expert to use a programming language for maximum flexibility and extensibility in developing test logic. For example, if the application under test returns a result set and the automated test program needs to run tests on each element in the result set, the iteration / loop support of rogramming languages can be used to iterate through the result set,calling Selenium commands to run tests on each item. Selenium RC provides an API and library for each of its supported languages. This ability to use Selenium RC with a high level programming language to develop test cases also allows the automated testing to be integrated with the projects automated build environment. Q9. What is Selenium Grid? Ans. Selenium Grid in the selenium testing suit allows the Selenium RC solution to scale for test suites that must be run in multiple environments. Selenium Grid can be used to run multiple instances of Selenium RC on various operating system and browser configurations.
Q10. How Selenium Grid works? Ans. Selenium Grid sent the tests to the hub. Then tests are redirected to an available Selenium RC,which launch the browser and
run the test. Thus, it allows for running tests in parallel with the entire test suite.
Q 11. What you say about the flexibility of Selenium test suite? Ans. Selenium testing suite is highly flexible. There are multiple ways to add functionality to Selenium framework to customize test automation. As compared to other test automation tools, it is Seleniums strongest characteristic. Selenium Remote Control support for multiple programming and scripting languages allows the test automation engineer to build any logic they need into their automated testing and to use a preferred programming or scripting language of ones choice.Also, the Selenium testing suite is an open source project where code can be modified andenhancements can be submitted for contribution. Q12. What test can Selenium do? Ans. Selenium is basically used for the functional testing of web based applications. It can be used for testing in the continuous integration environment. It is also useful for agile testing Q16. What are the advantages and disadvantages of using Selenium as testing tool? Ans. Advantages: Free, Simple and powerful DOM (document object model) level testing, can be used for continuous integration; great fit with Agile projects. Disadvantages: Tricky setup; dreary errors diagnosis; can not test client server applications. Q17. What is difference between QTP and Selenium? Ans. Only web applications can be testing using Selenium testing
suite. However, QTP can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and linux. However, QTP is limited to Internet Explorer on Windows. QTP uses scripting language implemented on top of VB Script. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.
Q18. What is difference between Borland Silk test and Selenium? Ans. Selenium is completely free test automation tool, while Silk Test is not. Only web applications can be testing using Selenium testing suite. However, Silk Test can be used for testing client server applications. Selenium supports following web browsers: Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. However, Silk Test is limited to Internet Explorer and Firefox. Silk Test uses 4Test scripting language. However, Selenium test suite has the flexibility to use many languages like Java, .Net, Perl, PHP, Python, and Ruby.
Below are some Interview questions regarding Selenium. Can anyone please answer. Thanks in Advance. 1. How do you start Selenium RC? 2. How do you connect Data base from selenium 3. How do you handle Ajax controls using selenium? Eg. By typing in search engine how do you capture the auto suggestion 4. How do you select the 2nd item in a List box or drop down. 5. How do you identify an object using selenium? 6. How do you capture an element loading after the page load? 7. Brief about your framework
8. What is the difference between assert and Verify Commands? 9. Explain about your reporting method 10.How do you verify an object presented in multiple pages. 11.What are the locators available in Selenium? 12.What is the difference between single and double slash in Xpath. 13.Brief about Selenium Client. 14.Did you write any User Extensions. 15.What are all things can not be done through selenium IDE 16.Brief about Selenium Grid. 17.Is it possible to start the Remote engine more than once in an instance. 18. How to use selenium for performance testing 19. How to start the selenium server from your language class? 20. Is it possible to handle multiple pop ups in selenium? 22. Give the benefits of SQL Stored procedure in selenium? 23.What are the difficulties or challenge you faced in selenium? 24. How do you check a single test method in multiple browser? 25. What is the annotation you use to connect the Spread sheet in Junit. 26.Brief about Junit annotations. 27.How can we speed up the selenium script execution? 28.If the default port of selenium is busy then which port you use? 29.Explain types of SQL joins. 30.How do you handle the secured connection error in HTTPS? 31.How do you compare two strings or values are same.
Felipe Knorr View profile Kuhn Answering to interview questions is like using record and playback. Or calling checks "tests".
kiran
View profile
> 1. How do you start Selenium RC? Create a selenium objecct by Implementing the Selenium Inteface with the DefaultSelenium and then use selenium.start() > 2. How do you connect Data base from selenium Use JDBC connectivity . Nothing to do with selenium > 3. How do you handle Ajax controls using selenium? Using wait for condition command > Eg. By typing in search engine how do you capture the auto suggestion > 4. How do you select the 2nd item in a List box or drop down. use getXpathCount > 5. How do you identify an object using selenium? using Fire bug. IE devtool bat find the object's id or name or class or Xpath and many more..... > 6. How do you capture an element loading after the page load? What does capture means? anyways use waitForPageToLoad > 7. Brief about your framework > You have to take care of this > 8. What is the difference between assert and Verify Commands? > 9. Explain about your reporting method Junit or Test NG Reports > 10.How do you verify an object presented in multiple pages. Use need to assert the object in each and every page you expect it to be present > 11.What are the locators available in Selenium? Check the 5th Ques > 12.What is the difference between single and double slash in Xpath. Double >> Parent , Single >> Child > 13.Brief about Selenium Client. Check the Selenium RC documentation > 14.Did you write any User Extensions. > 15.What are all things can not be done through selenium IDE > 16.Brief about Selenium Grid. Check Selenium Documentation . Its ideally used for Parallel distribution of your tests
> 17.Is it possible to start the Remote engine more than once in an instance. 18. How to use selenium for performance testing Ideally Cannot ... You have to integrate Jmeter along with Selenium > 19. How to start the selenium server from your language class? Server server = new SeleniumServer(); server.start(); > 20. Is it possible to handle multiple pop ups in selenium? Yes > 22. Give the benefits of SQL Stored procedure in selenium? Invalid Question! Who's that great fellow who had asked you this question? > 23.What are the difficulties or challenge you faced in selenium? Many...Ajax, handling windows controls > 24. How do you check a single test method in multiple browser? Using Selenium Grid > 25. What is the annotation you use to connect the Spread sheet in Junit. > 26.Brief about Junit annotations. Check Junit site > 27.How can we speed up the selenium script execution? *useXpathLibrar(libraryName) when you are using too many xpaths * > 28.If the default port of selenium is busy then which port you use? which ever valid port which is not being used by the processes . Try below RemoteControlConfiguration rcc = new RemoteControlConfiguration(); rcc.setPort(5555); SeleniumServer server = new SeleniumServer(rcc); > 30.How do you handle the secured connection error in HTTPS? run your tests in Firefoxproxy and iexploreproxy mode , provided installation of cyber villain certificate use rcc.setTrustAllCertificates(true) > 31.How do you compare two strings or values are same. using junit assertEquals(String1,String2)
2) If you want to count of a particular word in log file you can use grep -c option to count the word. Below command will print how many times word "Error" has appeared in logfile.txt
3) Sometime we are not just interested on matching line but also on lines around matching lines particularly useful to see what happens before any Error or Exception. grep --context option allows us to print lines around matching pattern. Below example of grep command in UNIX will print 6 lines around matching line of word "successful" in logfile.txt
Show additional six lines after matching very useful to see what is around and to print whole message if it splits around multiple lines. You can also use command line option "C" instead of "--context" for example grep -C 2 'hello' * Prints two lines of context around each matching line.
4) egrep stands for extended grep and it is more powerful than grep command in Unix and allows more regular exception like you can use "|" option to search for either Error or Exception by executing just one command.
5) If you want to do case insensitive search than use -i option from grep command in UNIX. Grep -i will find occurrence of both Error, error and ERROR and quite useful to display any sort of Error from log file.
6) zgrep is another great version of grep command in Unix which is used to perform same operation as grep does but with .gz files. Many a times we gzip the old file to reduce size and later wants to look or find something on those file. zgrep is your man for those days. Below command will print all files which have "Error" on them.
7) Use grep -w command in UNIX if you find whole word instead of just pattern. grep -w ERROR logfile
Above grep command in UNIX searches only for instances of 'ERROR' that are entire words; it does not match `SysERROR'. For more control, use `\<' and `\>' to match the start and end of words. For example:
grep 'ERROR>' *
Searches only for words ending in 'ERROR', so it matches the word `SysERROR'.
8) Another useful grep command line option is "grep -l" which display only the file names which matches the given pattern. Below command will only display file names which have ERROR?
grep -l ERROR *.log grep -l 'main' *.java will list the names of all Java files in the current directory whose contents mention `main'.
9) If you want to see line number of matching lines you can use option "grep -n" below command will show on which lines Error has appeared. grep -n ERROR log file.
10) If you want to do recursive search using grep command in Unix there are two options either use "-R" command line option or increase directory one by one as shown below.
12) There are three version of grep command in UNIX `grep, fgrep, egrep'. `fgrep' stands for Fixed `grep', `egrep' Extended `grep' These examples of grep command in UNIX are something which I use on daily basis; I have seen more sophisticated use of grep with regular expression. I will list some more examples of grep command in UNIX as I come across and find useful to share. As per my experience having good hold on grep and UNIX find command with knowledge of regular expression will be great for you day to day life if you need to look log files or config files or need to do production support on electronic trading systems or any other kind of system which is running on UNIX. This list of grep command in UNIX is by no means complete and I look forward from you guys to share how you are using grep command in UNIX.
1. How are devices represented in UNIX? 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 sequential order). 2. What is 'inode'? All UNIX files have its description stored in a structure called 'inode'. The inode contains info about the file-size, its location, time of last access, time of last modification, permission and so on. Directories are also represented as files and have an associated inode. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file. If the file is large, inode has indirect pointer to a block of pointers to additional data blocks (this further aggregates for larger files). A block
is File owner identifier File type File access permissions File access times Number of links File size Location of the file data
typically
8k.
3. Brief about the directory representation in UNIX A Unix directory is a file containing a correspondence between filenames and inodes. A directory is a special file that the kernel maintains. Only kernel modifies directories, but processes can read directories. The contents of a directory are a list of filename and inode number pairs. When new directories are created, kernel makes two entries named '.' (refers to the directory itself)
and
'..'
(refers
to
parent
directory).
System call for creating directory is mkdir (pathname, mode). 4. What are the Unix system calls for I/O?
open(pathname,flag,mode) - open file creat(pathname,mode) - create file close(filedes) - close an open file read(filedes,buffer,bytes) - read data from an open file write(filedes,buffer,bytes) - write data to an open file lseek(filedes,offset,from) - position an open file dup(filedes) - duplicate an existing file descriptor dup2(oldfd,newfd) - duplicate to a desired file descriptor fcntl(filedes,cmd,arg) - change properties of an open file ioctl(filedes,request,arg) - change the behaviour of an open file
The difference between fcntl anf ioctl is that the former is intended for any open file, while the latter is for device-specific operations. 5. How do you change File Access Permissions? Every owner's owner's file user group ID ID has ( ( following 16 16 bit bit attributes: integer integer ) )
permission-group
permission-others w-write,
permission) x-execute 1:
To change the access mode, we use chmod(filename,mode). To change mode of myfile to 'rw-rw-r' (ie. read, write permission for user - read,write permission for group - only read permission for others) we give the args as:
Therefore, Example
for
'rw'
the
value
is
6(4+2). 2:
6. What are links and symbolic links in UNIX file system? A link is a second name (not a file) for a file. Links can be used to assign more than one name to a file, but cannot be used to assign a directory more than one name or link filenames on different computers. Symbolic link 'is' a file that only contains the name of another file.Operation on the symbolic link is directed to the file pointed by the it.Both the limitations of links are eliminated in symbolic links. Commands for linking files are:
Link ln filename1 filename2 Symbolic link ln -s filename1 filename2
7. What is a FIFO? FIFO are otherwise called as 'named pipes'. FIFO (first-in-firstout) is a special file which is said to be data transient. Once data is read from named pipe, it cannot be read again. Also, data can be read only in the order written. It is used in interprocess communication where a process writes to one end of the pipe (producer) and the other reads from the other end (consumer). 8. How do you create special files like named pipes and device files?
The system call mknod creates special files in the following sequence. 1.kernel special minor For controller and minor device number is the disk. 9. Discuss the mount and unmount system calls The privileged mount system call is used to attach a file system to a directory of another file system; the unmount system call detaches a file system. When you mount another file system on to your directory, you are essentially splicing one directory tree onto a branch in another directory tree. The first argument to mount call is the mount point, that is , a directory in the current file naming system. The second argument is the file system to mount to that point. When you insert a cdrom to your unix system's drive, the file system in the cdrom automatically mounts to /dev/cdrom in your system. 10. How does the inode map to data block of a file? Inode has 13 block addresses. The first 10 are direct block addresses of the first 10 data blocks in the file. The 11th address points to a one-level index block. The 12th address points to a two-level (double in-direction) index block. The 13th address points to a three-level(triple in-direction)index block. This provides a very large maximum file size with efficient access to large files, but also small files are accessed directly in one disk read. device assigns new inode, file, numbers. example: 2. sets the file type to indicate that the file is a pipe, directory or 3. If it is a device file, it makes the other entries like major,
11. What is a shell? A shell is an interactive user interface to an operating system services that allows an user to enter commands as character strings or through a graphical user interface. The shell converts them to system calls to the OS or forks off a process to execute the command. System call results and other information from the OS are presented to the user through an interactive interface. Commonly used shells are sh,csh,ks etc. 12. Brief about the initial process sequence while the system boots up. While booting, special process called the 'swapper' or 'scheduler' is created with Process-ID 0. The swapper manages memory allocation for processes and influences CPU allocation. The swapper inturn creates 3 children:
the process dispatcher, vhand and dbflush IDs 1,2 and 3 respectively.
with
This is done by executing the file /etc/init. Process dispatcher gives birth to the shell. Unix keeps track of all the processes in an internal data structure called the Process Table (listing command is ps -el). 13. What are various IDs associated with a process? Unix identifies each process with a unique integer called ProcessID. The process that executes the request for creation of a process is called the 'parent process' whose PID is 'Parent Process ID'. Every process is associated with a particular user called the 'owner' who has privileges over the process. The identification for the user is 'UserID'. Owner is the user who executes the process. Process also has 'Effective User ID' which
getpid() -process id getppid() -parent process id getuid() -user id geteuid() -effective user id
14. Explain fork() system call. The `fork()' used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()'. The parent gets the child's pid returned to him, but the child gets 0 returned to him. 15. Predict the output of the following program code
main() { fork(); printf("Hello World!"); }
Answer:
Hello World!Hello World!
Explanation: The fork creates a child that is a duplicate of the parent process. The child begins from the fork().All the statements after the call to fork() will be executed twice.(once by the parent process and other by child). The statement before fork() is executed only by the parent process. 16. Predict the output of the following program code
main() { fork(); fork(); fork(); printf("Hello World!"); }
Answer: "Hello World" will be printed 8 times. Explanation: 2^n times where n is the number of calls to fork() roobhi 17. List the system calls used for process management: System calls Description
fork() To create a new process exec() To execute a new program in a process wait() To wait until a created process completes its execution exit() To exit from a process execution getpid() To get a process identifier of the current process getppid() To get parent process identifier nice() To bias the existing priority of a process brk() To increase/decrease the data segment size of a process.
18. How can you get/set an environment variable from a program? Getting the value of an environment variable is done by using `getenv()'. Setting the value of an environment variable is done by using `putenv()'. 19. How can a parent and child process communicate? A parent and child can communicate through any of the normal inter-process communication schemes (pipes, sockets, message queues, shared memory), but also have some special ways to communicate that take advantage of their relationship as a parent and child. One of the most obvious is that the parent can get the exit status of the child.
20. What is a zombie? When a program forks and the child finishes before the parent, the kernel still keeps some of its information about the child in case the parent might need it - for example, the parent may need to check the child's exit status. To be able to get this information, the parent calls `wait()'; In the interval between the child terminating and the parent calling `wait()', the child is said to be a `zombie' (If you do `ps', the child will have a `Z' in its status field to indicate this.) 21. What are the process states in Unix? As a process executes it changes state according to its circumstances. Unix processes have the following states: Running : The process is either running or it is ready to run . Waiting : The process is waiting for an event or for a resource. Stopped : The process has been stopped, usually by receiving a signal. Zombie : The process is dead but have not been removed from the process table. * To display a list of all manual pages containing the keyword "date", what command would you type? * What command will display the first several lines of a file called "junk"? == Users and permissions practicum == * Rig it so everything in the folder gets deleted tonight at 10pm. Every night at 10pm. == Local security == * How do you feel about `sudo`? * What's the difference between `telnet` and `ssh`? What's a good use for each? * How do you ensure your users have hard-to-guess passwords? == Filesystem == * What is the difference between a symbolic and hard link? When would you use each? * I have a file named `-fr`. How do I get rid of it? * Why did I just ask that question?
* To partition or not? How? * What are RAID 0, 1, 5, 0+1? What level would you use for a web server and why? A database server? == `/etc` == * `ls -l /etc`. What is all this stuff? * You added a line to `/etc/aliases`, but it doesn't seem to be working. Why? * You've created a `zope` user to run Zope under. How do you secure it so someone doesn't guess its password, log in with it, and mess with stuff? * Bring up `/etc/passwd`. What is all this junk? * What are shadow passwords? == Processes == * How many processes are running on your machine right now? == Shells == * Name as many shells as you can. * What's your favorite shell? Why? * Write a shell script to append "snork" to the file "test" but only if "test" already exists. * A user performed a `cd; chmod 644 .` before logging out. What problem occurs when he logs in the next time, and what level of privilege is required to correct the problem? == Startup == * Describe the boot process of your favorite Linux in as much detail as you can. * What are runlevels? == Social == * Describe an experience you had with a difficult user. * How do you keep up with current tools and practices? * How did you document your work at your last job so someone else could pick up where you left off? == Totally miscellaneous == * When debugging a core in gdb, what does the command `bt` give: core memory, heap usage, or calling stack? * A user complains the web site is slow. What do you do?
* What command will display the first several lines of a file called "junk"? Code:
head junk man head
== Users and permissions practicum == * Rig it so everything in the folder gets deleted tonight at 10pm. Every night at 10pm. Set cronjob, see How do I add jobs to cron under Linux or UNIX oses? == Local security == * How do you feel about `sudo`? sudo allows a permitted user to execute a command as the superuser or another user. sudo is much better than su and you don't have to share root password with other users/admin. Linux sudo Configuration * What's the difference between `telnet` and `ssh`? What's a good use for each? TELNET, by default, does not encrypt any data sent over the connection (including password, and so it is often practical to eavesdrop on the communications and use the password later for malicious purposes; SSH by default encrypt password and traffic. SSH is recommended for all use. * * Bring up `/etc/passwd`. What is all this junk? See, Understanding /etc/passwd file format * What are shadow passwords? /etc/shadow file stores actual password in encrypted format for user's account with additional properties related to user password Understanding /etc/ shadow file == Processes == * How many processes are running on your machine right now? Code:
== Shells == * Name as many shells as you can. Bourne shell (sh) Almquist shell (ash) Debian Almquist shell (dash) Bourne-Again shell (bash) Friendly interactive shell (fish) Korn shell (ksh) C shell (csh) TENEX C shell (tcsh) Es shell (e esh (Unix) Easy Shell rc shell (rc) - shell for Plan 9 and Unix runscript The initial shell interpreter used to process startup scripts in Gentoo scsh (Scheme Shell) Stand-alone Shell (sash) Z shell (zsh) * What's your favorite shell? Why? bash - it rocks and feature rich. * Write a shell script to append "snork" to the file "test" but only if "test" already exists. Code:
[ -f test ] && echo "snork" >> test ||:
* A user performed a `cd; chmod 644 .` before logging out. What problem occurs when he logs in the next time, and what level of privilege is required to correct the problem? User will not able to login. A root user can this problem by resting permission cmod perm /home/user . is current directory
.. parent directory == Startup == * Describe the boot process of your favorite Linux in as much detail as you can. See redhat or any other distro doc * What are runlevels? The term runlevel refers to a mode of operation in one of the computer operating systems that implement Unix System V-style initialization. Conventionally, seven runlevels exist, numbered from zero to six, though up to ten, from zero to nine, may be used. Code:
man init man runlevel
== Social == * Describe an experience you had with a difficult user. * How do you keep up with current tools and practices? * How did you document your work at your last job so someone else could pick up where you left off? Use our social skillz == Totally miscellaneous == * When debugging a core in gdb, what does the command `bt` give: core memory, heap usage, or calling stack? Code:
man gdb Read gdb page
* A user complains the web site is slow. What do you do? Ask user to upgrade internet connection. If using windows ask to reboot windows .. LOL just kidding, google for slow apache problem. There could be zillions of causes == Apache == * How do you rig Apache to start up on boot? Code:
chkconfig httpd on
* Apache doesn't start up on boot, and the thing above checks out okay. How do you track down the problem? Code:
chkconfig httpd on httpd -t service httpd on netstat -tulpn | grep 80 tail -f /var/log/httpd/access_log tail -f /var/log/httpd/error_log
Lately one of the interns, who works for our company for training rather than only employment, asked me to make a suggestion to choose between SilkTest and Selenium as carrier path for future Quality Assurance Engineer position. Let's take a detailed glance and evaluate both test automated tools against each other: The benefits of Selenium is completely free open source test automation tool, while SilkTest price is around a few thousand dollars per license. It means if you want to include Selenium to your talent set, just download free application, download manual and start testing. SilkTest download is not free, and available only for Borland customers, although everyone may download Silk Test free trial version, but it will help you for 30 days and then you will get bombarded by Borland sales asking to buy test automation tool. There are no a single SilkTest book or tutorial in print yet except SilkTest Getting Started Tutorial, comparing with several recently published Selenium and QTP books. Quality Assurance society anticipate more Selenium books in the nearest future. For for detailed book review look at Best Books for QTP and Top Books for Selenium posts.
Selenium allows creating automated test cases only against web applications. In the same time Quality Assurance Engineer may use Silk Test for automating client server application. Selenium gracefully supports a broad range of browsers Internet Explorer, Firefox, Safari, Opera or Konqueror on Windows, Mac OS X and Linux. In the same time Silk Test is restricted to Internet Explorer and Firefox on Windows. SilkTest uses 4Test scripting language to describe the test procedure, and to manipulate the objects and pedals of the application under test. One more benefits of Selenium has lots of language bindings like Java, .Net, Perl, PHP, Python, and Ruby, so anyone can learn not only one tool, but add a few more lines in the resume. Last thing to check is to visit any employment search sites like dice.com or monster.com and compare how many opening are available for SilkTest or Selenium. Anonymous said... Ashok, I have been recording against AJAX without difficulty. I am not sure what you are speaking about. I am using 2009 R2.
2:05 PM
TheMANforAutomation said... You have been able to call ANY progamming language in Silk Test that uses ANSI C Parameter passing conventions. Futhermore, simce you can compile and output results by calling CLI based programs (such as Visual Basic and / or Perl you can collect the output of these "external" programs using 1) echo statments in VB and 2) print statements in Perl. Correct me if I'm wrong, you cannot call a lightweight exrcution agent from Quick Test Pro and run the same sript on multiple machine unless you have a seprate liecnse for each machine, which not only costs more, but leave a much larger memory footprint on each Machine Under test.
I have also been told by Borlnd technical support that you cann cannor call libraries in DLL'
4:26 AM
Learn More About Decision Table Testing Technique in the Video Tutorial here 8. What is the MAIN objective when reviewing a software deliverable? To identify defects in any software work product. 9. Which of the following defines the expected results of a test? Test case specification or test design specification. Test case specification. 10. Which is a benefit of test independence? It avoids author bias in defining effective tests. 11. As part of which test process do you determine the exit criteria? Test planning. 12. What is beta testing? Testing performed by potential customers at their own locations. 13. Given the following fragment of code, how many tests are required for 100% decision coverage? if width > length then biggest_dimension = width if height > width then biggest_dimension = height end_if else biggest_dimension = length if height > length then biggest_dimension = height end_if end_if 4 14. You have designed test cases to provide 100% statement and 100% decision coverage for the following fragment of code. if width > length then biggest_dimension = width else biggest_dimension = length end_if The following has been added to the bottom of the code fragment above. print "Biggest dimension is " & biggest_dimension print "Width: " & width print "Length: " & length How many more test cases are required? None, existing test cases can be used. 15. Rapid Application Development ? Rapid Application Development (RAD) is formally a parallel development of functions and subsequent integration. Components/functions are developed in parallel as if they were mini projects, the developments are time-boxed, delivered, and then assembled into a working prototype. This can very quickly give the customer something to see and use and to provide feedback regarding the delivery and their requirements. Rapid change and development of the product is possible using this methodology. However the product specification will need to be developed for the product at some point, and the project will need to be placed under more formal controls prior to going into production. 16. What is the difference between Testing Techniques and Testing Tools? Testing technique: Is a process for ensuring that some aspects of the application system or unit functions properly there may be few techniques but many tools. Testing Tools: Is a vehicle for performing a test process. The tool is a resource to the tester, but itself is insufficient to conduct testing Learn More About Testing Tools here 17. We use the output of the requirement analysis, the requirement specification as the input for writing User Acceptance Test Cases 18. Repeated Testing of an already tested program, after modification, to discover any defects introduced or uncovered as a result of the changes in the software being tested or in another related or unrelated software component: Regression Testing 19. What is component testing ? Component testing, also known as unit, module and program testing, searches for defects in, and verifies the functioning of software (e.g. modules, programs, objects, classes, etc.) that are separately testable. Component testing may be done in isolation from the rest of the system depend-ing on the context of the
development life cycle and the system. Most often stubs and drivers are used to replace the missing software and simulate the interface between the software components in a simple manner. A stub is called from the software component to be tested; a driver calls a component to be tested. 20. What is functional system testing ? Testing the end to end functionality of the system as a whole. 21. What is the benefits of Independent Testing Independent testers see other and different defects and are unbiased. 22. In a REACTIVE approach to testing when would you expect the bulk of the test design work to be begun? After the software or system has been produced. 23. What are the different Methodologies in Agile Development Model? There are currently seven different Agile methodologies that I am aware of: 1. Extreme Programming (XP) 2. Scrum 3. Lean Software Development 4. Feature-Driven Development 5. Agile Unified Process 6. Crystal 7. Dynamic Systems Development Model (DSDM) 24. Which activity in the fundamental test process includes evaluation of the testability of the requirements and system? A Test analysis and design. 25. What is typically the MOST important reason to use risk to drive testing efforts? Because testing everything is not feasible. 26. Which is the MOST important advantage of independence in testing? An independent tester may be more effective at finding defects missed by the person who wrote the software. 27. Which of the following are valid objectives for incident reports? i. Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary. ii. Provide ideas for test process improvement. iii. Provide a vehicle for assessing tester competence. iv. Provide testers with a means of tracking the quality of the system under test. i. Provide developers and other parties with feedback about the problem to enable identification, isolation and correction as necessary, ii.Provide ideas for test process improvement, iv.Provide testers with a means of tracking the quality of the system under test 28. Consider the following techniques. Which are static and which are dynamic techniques? i. Equivalence Partitioning. ii. Use Case Testing. iii.Data Flow Analysis. iv.Exploratory Testing. v. Decision Testing. vi. Inspections. Data Flow Analysis and Inspections are static, Equivalence Partitioning, Use Case Testing, Exploratory Testing and Decision Testing are dynamic. 29. Why are static testing and dynamic testing described as complementary? Because they share the aim of identifying defects but differ in the types of defect they find. 30. What are the phases of a formal review ? In contrast to informal reviews, formal reviews follow a formal process. A typical formal review process consists of six main steps: 1. Planning 2. Kick-off 3. Preparation 4. Review meeting 5. Rework
6.
Follow-up.
31. What is the role of moderator in review process? The moderator (or review leader) leads the review process. He or she deter-mines, in co-operation with the author, the type of review, approach and the composition of the review team. The moderator performs the entry check and the follow-up on the rework, in order to control the quality of the input and output of the review process. The moderator also schedules the meeting, disseminates documents before the meeting, coaches other team members, paces the meeting, leads possible discussions and stores the data that is collected. Learn More About Review process in Video Tutorial here 32. What is an equivalence partition (also known as an equivalence class)? An input or output range of values such that only one value in the range becomes a test case. 33. When should configuration management procedures be implemented? During test planning. 34. A Type of functional Testing, which investigates the functions relating to detection of threats, such as virus from malicious outsiders. Security Testing 35. Testing where in we subject the target of the test , to varying workloads to measure and evaluate the performance behaviors and ability of the target and of the test to continue to function properly under these different workloads. Load Testing 36. Testing activity which is performed to expose defects in the interfaces and in the interaction between integrated components is: Integration Level Testing 37. What are the Structure-based (white-box) testing techniques ? Structure-based testing techniques (which are also dynamic rather than static) use the internal structure of the software to derive test cases. They are com-monly called 'white-box' or 'glass-box' techniques (implying you can see into the system) since they require knowledge of how the software is implemented, that is, how it works. For example, a structural technique may be concerned with exercising loops in the software. Different test cases may be derived to exercise the loop once, twice, and many times. This may be done regardless of the func-tionality of the software. 38. When should be performed Regression testing ? After the software has changed or when the environment has changed 39. When should testing be stopped? It depends on the risks for the system being tested 40. What is the purpose of a test completion criterion? To determine when to stop testing 41. What can static analysis NOT find? For example memory leaks 42. What is the difference between re-testing and regression testing? Re-testing ensures the original fault has been removed; regression testing looks for unexpected sideeffects 43. What are the Experience-based testing techniques ? In experience-based techniques, people's knowledge, skills and background are a prime contributor to the test conditions and test cases. The experience of both technical and business people is important, as they bring different perspectives to the test analysis and design process. Due to previous experience with similar systems, they may have insights into what could go wrong, which is very useful for testing. 44. What type of review requires formal entry and exit criteria, including metrics? Inspection 45. Could reviews or inspections be considered part of testing? Yes, because both help detect faults and improve quality 46. An input field takes the year of birth between 1900 and 2004 What are the boundary values for testing this field ? 1899,1900,2004,2005 47. Which of the following tools would be involved in the automation of regression test? a. Data tester b. Boundary tester c. Capture/Playback d. Output comparator. d. Output comparator 48. To test a function,what has to write a programmer, which calls the function to be tested and passes it test data.
Driver 49. What is the one Key reason why developers have difficulty testing their own work? Lack of Objectivity 50.How much testing is enough? The answer depends on the risk for your industry, contract and special requirements. 51. When should testing be stopped? It depends on the risks for the system being tested. 52. Which of the following is the main purpose of the integration strategy for integration testing in the small? To specify which modules to combine when, and how many at once. 53. What is the purpose of a test completion criterion? To determine when to stop testing 54. Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage? Read p Read q IF p+q> 100 THEN Print "Large" ENDIF IF p > 50 THEN Print "p Large" ENDIF 1 test for statement coverage, 2 for branch coverage 55. What is the difference between re-testing and regression testing? Re-testing ensures the original fault has been removed; regression testing looks for unexpected sideeffects. 56. Which review is normally used to evaluate a product to determine its suitability for intended use and to identify discrepancies? Technical Review. 57. Why we use decision tables?. The techniques of equivalence partitioning and boundary value analysis are often applied to specific situations or inputs. However, if different combinations of inputs result in different actions being taken, this can be more difficult to show using equivalence partitioning and boundary value analysis, which tend to be more focused on the user interface. The other two specification-based tech-niques, decision tables and state transition testing are more focused on business logic or business rules. A decision table is a good way to deal with combinations of things (e.g. inputs). This technique is sometimes also referred to as a 'cause-effect' table. The reason for this is that there is an associated logic diagramming technique called 'cause-effect graphing' which was sometimes used to help derive the decision table 58. Faults found should be originally documented by who? By testers. 59. Which is the current formal world-wide recognized documentation standard? There isnt one. 60. Which of the following is the review participant who has created the item to be reviewed? Author 61. A number of critical bugs are fixed in software. All the bugs are in one module, related to reports. The test manager decides to do regression testing only on the reports module. Regression testing should be done on other modules as well because fixing one module may affect other modules. 62. Why does the boundary value analysis provide good test cases? Because errors are frequently made during programming of the different cases near the edges of the range of values. 63. What makes an inspection different from other review types? It is led by a trained leader, uses formal entry and exit criteria and checklists. 64. Why can be tester dependent on configuration management? Because configuration management assures that we know the exact version of the testware and the test object. 65. What is a V-Model ?
A software development model that illustrates how testing activities integrate with software development phases 66. What is maintenance testing? Triggered by modifications, migration or retirement of existing software 67. What is test coverage? Test coverage measures in some specific way the amount of testing performed by a set of tests (derived in some other way, e.g. using specification-based techniques). Wherever we can count things and can tell whether or not each of those things has been tested by some test, then we can measure coverage. 68. Why is incremental integration preferred over big bang integration? Because incremental integration has better early defects screening and isolation ability 69. When do we prepare RTM (Requirement traceability matrix), is it before test case designing or after test case designing? The would be before. Requirements should already be traceable from Review activities since you should have traceability in the Test Plan already. This question also would depend on the organisation. If the organisation do test after development started then requirements must be already traceable to their source. To make life simpler use a tool to manage requirements. 70. What is called the process starting with the terminal modules ? Bottom-up integration 71. During which test activity could faults be found most cost effectively? During test planning 72. The purpose of requirement phase is To freeze requirements, to understand user needs, to define the scope of testing 73. How much testing is enough? The answer depends on the risks for your industry, contract and special requirements 74. Why we split testing into distinct stages? Each test stage has a different purpose. 75. Which of the following is likely to benefit most from the use of test tools providing test capture and replay facilities? a) Regression testing b) Integration testing c) System testing d) User acceptance testing Regression testing 76. How would you estimate the amount of re-testing likely to be required? Metrics from previous similar projects and discussions with the development team 77. What studies data flow analysis ? The use of data on paths through the code. 78. What is Alpha testing? Pre-release testing by end user representatives at the developers site. 79. What is a failure? Failure is a departure from specified behaviour. 80. What are Test comparators ? Is it really a test if you put some inputs into some software, but never look to see whether the software produces the correct result? The essence of testing is to check whether the software produces the correct result, and to do that, we must compare what the software produces to what it should produce. A test comparator helps to automate aspects of that comparison. 81. Who is responsible for document all the issues, problems and open point that were identified during the review meeting Scribe 82. What is the main purpose of Informal review Inexpensive way to get some benefit 83. What is the purpose of test design technique? Identifying test conditions and Identifying test cases 84. When testing a grade calculation system, a tester determines that all scores from 90 to 100 will yield a grade of A, but scores below 90 will not. This analysis is known as: Equivalence partitioning 85. A test manager wants to use the resources available for the automated testing of a web application. The best choice is Tester, test automater, web specialist, DBA 86. During the testing of a module tester X finds a bug and assigned it to developer. But developer rejects the same, saying that its not a bug. What X should do? Send to the detailed information of the bug encountered and check the reproducibility
87. A type of integration testing in which software elements, hardware elements, or both are combined all at once into a component or an overall system, rather than in stages. Big-Bang Testing 88. In practice, which Life Cycle model may have more, fewer or different levels of development and testing, depending on the project and the software product. For example, there may be component integration testing after component testing, and system integration testing after system testing. V-Model 89. Which technique can be used to achieve input and output coverage? It can be applied to human input, input via interfaces to a system, or interface parameters in integration testing. Equivalence partitioning 90. This life cycle model is basically driven by schedule and budget risks This statement is best suited for V-Model 91. In which order should tests be run? The most important tests first 92. The later in the development life cycle a fault is discovered, the more expensive it is to fix. why? The fault has been built into more documentation,code,tests, etc 93. What is Coverage measurement? It is a partial measure of test thoroughness. 94. What is Boundary value testing? Test boundary conditions on, below and above the edges of input and output equivalence classes. 95. What is Fault Masking ? Error condition hiding another error condition. 96. What does COTS represent? Commercial Off The Shelf. 97.The purpose of wich is allow specific tests to be carried out on a system or network that resembles as closely as possible the environment where the item under test will be used upon release? Test Environment 98. What can be though of as being based on the project plan, but with greater amounts of detail? Phase Test Plan 99. What is exploratory testing? Exploratory testing is a hands-on approach in which testers are involved in minimum planning and maximum test execution. The planning involves the cre-ation of a test charter, a short declaration of the scope of a short (1 to 2 hour) time-boxed test effort, the objectives and possible approaches to be used. The test design and test execution activities are performed in parallel typi-cally without formally documenting the test conditions, test cases or test scripts. This does not mean that other, more formal testing techniques will not be used. For example, the tester may decide to use boundary value analysis but will think through and test the most important boundary values without necessarily writing them down. Some notes will be written during the exploratory-testing session, so that a report can be produced afterwards. 100. What is failure? Deviation from expected result to actual result
Unix Commands Interview Questions Subscribe to FREE & Exclusive career resources at www.jobsassist.com/CareerMag/ JobsAssist.com (http://www.jobsassist.com/) and VyomWorld.com (http://www.vyomworld.com/) Free Student Resources
UNIX Commands Interview Questions Check for your FREE Bonuses at the end of this eBookUnix Commands Interview Questions Subscribe to FREE & Exclusive career resources at www.jobsassist.com/CareerMag/ JobsAssist.com (http://www.jobsassist.com/) and VyomWorld.com (http://www.vyomworld.com/) Free Student Resources 1. Construct pipes to execute the following jobs. 1. Output of who should be displayed on the screen with value of total number of users who have logged in displayed at the bottom of the list. 2. Output of ls should be displayed on the screen and from this output the lines containing the word poem should be counted and the count should be stored in a file. 3. Contents of file1 and file2 should be displayed on the screen and this output should be appended in a file . From output of ls the lines containing poem should be displayed on the screen along with the count. 4. Name of cities should be accepted from the keyboard . This list should be combined with the list present
in a file. This combined list should be sorted and the sorted list should be stored in a file newcity. 5. All files present in a directory dir1 should be deleted any error while deleting should be stored in a file errorlog. 2. Explain the following commands. $ ls > file1 $ banner hi-fi > message $ cat par.3 par.4 par.5 >> report $ cat file1>file1 $ date ; who $ date ; who > logfile $ (date ; who) > logfile 3. What is the significance of the tee command? It reads the standard input and sends it to the standard output while redirecting a copy of what it has read to the file specified by the user. 4. What does the command $who | sort logfile > newfile do?
The input from a pipe can be combined with the input from a file . The trick is to use the special symbol - (a hyphen) for those commands that recognize the hyphen as std input. In the above command the output from who becomes the std input to sort , meanwhile sort opens the file logfile, the contents of this file is sorted together with the output of who (rep by the hyphen) and the sorted output is redirected to the file newfile. 5. What does the command $ls | wc l > file1 do? ls becomes the input to wc which counts the number of lines it receives as input and instead of displaying this count , the value is stored in file1. 6. Which of the following commands is not a filter man , (b) cat , (c) pg , (d) head Ans: man A filter is a program which can receive a flow of data from std input, process (or filter) it and send the result 7. How is the command $cat file2 different from $cat >file2 and >> redirection operators ? is the output redirection operator when used it overwrites while >> operator appends into the file.
9. Explain the steps that a shell follows while processing a command. After the command line is terminated by the key, the shel goes ahead with processing the command line in one or more passes. The sequence is well defined and assumes the following order. Parsing: The shell first breaks up the command line into words, using spaces and the delimiters, unless quoted. All consecutive occurrences of a space or tab are replaced here with a single space. Variable evaluation: All words preceded by a $ are avaluated as variables, unless quoted or escaped. Command substitution: Any command surrounded by backquotes is executed by the shell which then replaces the standard output of the command into the command line. Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *, ?, [, ]). Any word containing a wild-card is replaced by a sorted list of filenames that match the pattern. The list of these filenames then forms the arguments to the command. PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to
search in order to hunt for the command. 10. What difference between cmp and diff commands? cmp - Compares two files byte by byte and displays the first mismatch diff - tells the changes to be made to make the files identical 11. What is the use of grep command? grep is a pattern search command. It searches for the pattern, specified in the command line with appropriate option, in a file(s). Syntax : grep Example : grep 99mx mcafile 12. What is the difference between cat and more command? Cat displays file contents. If the file is large the contents scroll off the screen before we view it. So command 'more' is like a pager which displays the contents page by page. 13. Write a command to kill the last background job? Kill $! 14. Which command is used to delete all files in the current directory and all its sub-directories?
rm -r * 15. Write a command to display a files contents in various formats? $od -cbd file_name c - character, b - binary (octal), d-decimal, od=Octal Dump. 16. What will the following command do? $ echo * It is similar to 'ls' command and displays all the files in the current directory. 17. Is it possible to create new a file system in UNIX? Yes, mkfs is used to create a new file system. 18. Is it possible to restrict incoming message? Yes, using the mesg command. 19. What is the use of the command "ls -x chapter[15]" ls stands for list; so it displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1, chapter2, and so on. 20. Is du a command? If so, what is its use? Yes, it stands for disk usage. With the help of this command you can find the disk capacity and free space
of the disk. 21. Is it possible to count number char, line in a file; if so, How? Yes, wc-stands for word count. wc -c for counting number of characters in a file. wc -l for counting lines in a file. 22. Name the data structure used to maintain file identification? inode, each file has a separate inode and a unique inode number. 23. How many prompts are available in a UNIX system? Two prompts, PS1 (Primary Prompt), PS2 (Secondary Prompt). 24. How does the kernel differentiate device files and ordinary files? Kernel checks 'type' field in the file's inode structure. 25. How to switch to a super user status to gain privileges? Use su command. The system asks for password and when valid entry is made the user gains super user (admin) privileges. 26. What are shell variables?
Shell variables are special variables, a name-value pair created and maintained by the shell. Example: PATH, HOME, MAIL and TERM 27. What is redirection? Directing the flow of data to the file or from the file for input or output. Example : ls > wc 28. How to terminate a process which is running and the specialty on command kill 0? With the help of kill command we can terminate the process. Syntax: kill pid Kill 0 - kills all processes in your system except the login shell. 29. What is a pipe and give an example? A pipe is two or more commands separated by pipe char '|'. That tells the shell to arrange for the output of the preceding command to be passed as input to the following command. Example : ls -l | pr The output for a command ls is the standard input of pr. When a sequence of commands are combined using pipe, then it is called pipeline.
30. Explain kill() and its possible return values. There are four possible results from this call: kill() returns 0. This implies that a process exists with the given PID, and the system would allow you to send signals to it. It is system-dependent whether the process could be a zombie. kill() returns -1, errno == ESRCH either no process exists with the given PID, or security enhancements are causing the system to deny its existence. (On some systems, the process could be a zombie.) kill() returns -1, errno == EPERM the system would not allow you to kill the specified process. This means that either the process exists (again, it could be a zombie) or draconian security enhancements are present (e.g. your process is not allowed to send signals to *anybody*). kill() returns -1, with some other value of errno you are in trouble! The most-used technique is to assume that success or failure with EPERM implies that the process exists, and any other error implies that it doesn't. An alternative exists, if you are writing specifically for a system (or all those systems) that provide a /proc
filesystem: checking for the existence of /proc/PID may work.Unix Commands Interview Questions Subscribe to FREE & Exclusive career resources at www.jobsassist.com/CareerMag/