Sunteți pe pagina 1din 31

UNIX POINTS TO REMEMBER 1) Unix is a multiuser multitasking operating system. 2) Everything in Unix is treated as files.

Including devices like printers,RAM etc 3) Unix can have multiple shells but only one kernel. 4) Shell is a command interpreter.It basically interpretes the command for the kernel and calls the kernel using system call functions. The kernel then performs the required action and returns the control to the shell. For eg : When we type a command using a metacharacter,the shell interprets that metacharacter and then passes it on to the kernel. In the case of rm *, the shell replaces * by all the files in the current directory and then passes it on to the kernel. 5) The Unix file system is like an inverted tree structure. 6) Root directory represents the uppermost directory in the file system under which all the files exists.Root is represented by FORWARD SLASH / 7) There are two types of paths one can use to navigate to different directories.Absolute and relative path. Absolute Path and relative Path Say U are in the path home/testing/hello/world/dir/files and U want to navigate to hello directory.We can do that using absolute and relative paths: Absolute: cd /home/testing/hello Relative : cd ../../.. (Note .. represents parent directory) 8) pwd command prints the present working directory. 9) cd is the command to change the directory. 10) cat is the command to concatenate files. 11) Just by simply typing cd would take us to the home directory defined by the $HOME variable. 12) The ls command is used to list files. 13) ls -l command would list files along with their permissions user name and group name and also the size.

14) ls -a command would be used to list hidden files. 15) ls -r command will list files in revese order. 16) ls -i will list files against their inode number. 17) Files and metacharacters: ls * --- Will list all files in current directory. ls a? -- Will list files starting with a and second letter of the filename being any ASCII character. ls a* -- Will list all files beginning with a ls *.* --- WILL list all files with a single dot in between filenames. ls [!abc]art-- Will list files not beginning with a or b or c and next three characters being art. ls [b-dku-z]*-- Will list files beginning with either b-d which is b,c,d or with k or with u-z i.e u,w,x,y,z. 18) mkdir is the command to make directory. 19) rmdir is the command to remove directory. 20) chmod command is used to change the permissions of a file. 21) We can change the permissions of a file using the chmod command using the symbolic and absolute modes Symbolic mode: chmod a+rwx xyz.doc (Note : a --- all, u --- user , g --- group, o --others) Absolute mode: chmod 777 xyz.doc (Note : read --- 4 , write --- 2 , execute --- 1)

22) mv command can be used either to rename a file or change the location of a file. 23) There are two types of links : Hard and Soft Link. Hard Link : ln file1 file2 (Here file2 becomes a link for file1.On deletion of file1,file2 can be accessed.) Soft Link : ln -s file1 file2 (Here file2 becomes the soft link of file1 (basically a pointer to file1) hence on deletion of file1,file2 becomes a dangling pointer and the file1 contents are not accessible.)

24) find command is used to find files in the Unix system. 25) grep(global search for regular expression and print) command is used for searching a particular pattern in a file. grep [options] pattern filename Example : grep "Testing" Testing.dat --- Will search for the word Testing in the file Testing.dat 26) tr command can be used to translate characters in a file. 27) vi Editor is used as a text editor for files in unix.There are three modes in vi editor 1 --- Command Mode ---- in this mode we can use commands to modify the text of the file.For eg: cw command entered during command mode is used to change a particular word. 2 --- Input mode ---- in this mode we can insert text into the file. 3 --- Last line mde ---- in this mode we can search for a particular pattern in the file. 28) :set nu is the command to number the lines :set showmode shows the mode :se ic used to ignore case 29) We use the fg command to bring a background process to the foreground. 30) nice command is used to reduce the priority of a process.We cannot increase the priority of a command but only reduce it using the nice command. 31) bc is the basic calculator utility in unix. If without setting the scale, 5/2 would result in 2. After setting the scale=2, 5/2 would result in 2.50. 32) Always assign the value of the variable without a space in between. Like name=256 and not name =256 or name= 256 or name = 256. 33) To see all the environmental variables set we can use the set command. 34) If a=5 and b=10 $a + $b would not add the two variables as they are treated as string of characters.In order to add them we use the expression in the backquote `expr $a + $b`. 35) In case of floating point arithmetic we use the bc utility as shown below:

a=13.5, b=1.5 c=`echo $a + $b | bc` 36) export is the command to make the variable global i.e to make it available for all its child shells. 37) Parameters can also be used to pass arguments to a script. If 1.sh is a script which requires 3 filenames as arguments then 1.sh file1 file2 file3 Here $1 --- file1 $2 --- file2 $3 --- file3 Positional parameters from $1 through $9 are available.For additional parameters the shift command can be used.

1.The File System used by unix is . Answer: Hierarchical or Inverted tree file system 2.what are the default application programs installed with unix? Like gcc,g++,e.t.c 3.which of the following enforces security scheme? a)kernel b)shell 4.types of shell available? 5.which of the shell allows command history to be tracked?? 6.file naming conventions? 7.what is known as referring a file from root directory?(Absolute path name) 8.which command tells about present working directory? 9.Options used with ls commands(be through with options of every command)? 10.which option along with rm <file_name> will recursively remove the files? 11.command used to list the contents of file? 12.which option creates directories along path name? 13.what are levels in file security? 14.symbolic and absolute mode of changing file permissions? 15.creating hard and soft link between files using ln?

16.man command usage? 17.cat>>file_name ,cat <file_name what will be output? 18.cat<file_name | grep string emp.dat output?? 19.use of wildcards in filename? 20.cursor movements ? 21.screen movements? 22.which commands is used for exit terminal without saving? a)q! b)q c)none.. 23.command used for getting process id? 24.usage of test and [] with if ..else? 25.usage of echo statement? 26.continue and break statement? 27.usage of gt,-lt,-le,etc..? 28.parameters to shell script??(ex:what is used to get pid of the shell)? 29.usage of $#,$0? 30.can the mv command be used to rename a file?

1. What is the output of the following Command $ls -R | wc - lw 1>The output of ls command is stored in SampleFile 2>The output of wc command is stored in SampleFile 3>The output of ls is treated as input to wc and the count is stored in SampleFile 4>The output of ls is treated as input to wc and the count is displayed and stored in SampleFile ANSWER>3 2. What is the output of the following command $ cat File1>File2>File3 1>Copies the contents from File1 to File2 and File3 2>It is a wrong command - gives error 3>Copies File1 contents to File3 4>Copies File1 to File3 and creates an empty file File2 5>None of them ANSWER>4 3. What is the command to Print the searched pattern with the line numbers in File1 1>$grep -N Accenture File1 2>$grep -nv Accenture File1 3>$grep -n File1 4>$grep -n Accenture File1 5>All are correct

6>None ANSWER>4 4. What is the output of the following command $rmdir dir1 dir1/dir2/dir3 1>deletes dir1 and dir3 directories 2>deletes dir1 directory 3>deletes dir1 dir2 and dir3 directories 4>error ANSWER>4 5. In the vi editor to delete a char 1>h 2>j 3>x 4>k 5>l ANSWER>3 6. To save a file without quitting the vi editor is done using the command 1>:q 2>:w 3>:w! 4>:wq 5>:q! ANSWER>2 7. What is the output the following command % sort -t | +3 -5 Students 1>The records will be sorted based on 4th to 5th columns 2>The records will be sorted based on 3rd and 5th columns 3>The records will be sorted based on 3rd to 5th columns 4>The records will be sorted based on 3rd to 4th columns ANSWER>1 8. Unix file system has which of the following file structure 1>Tree Structure 2>Standard Structure 3>Hierarchical Structure 4>None of the above ANSWER>3 9. In unix grep-n command displays the 1>Line matching the pattern along with its line number 2>Only a count of the line that match a pattern 3>Prints out all those lines that do not match the pattern

4>None of the above ANSWER>1 10. Which of the following represents an absolute path? 1>../home/abc.txt 2>bin/cat 3>abcd/ 4>/usr/bin/cat ANSWER>4 11. Kernel Manage 1>Entire resources of the system 2>Schedules the work done by the CPU 3>Enforces the security scheme 4>a & b 5>b & c 6>a b & c ANSWER>6 12. Which option of grep displays the count of lines matching the pattern 1>-c 2>-nc 3>-v 4>-lc 5>-ln ANSWER>1 13. You have a file with numerical data in it (i.e file with list of numbers in it). To sort this data which command/method you will prefer most. Assume that list is reasonably small and Quick output is high priority. 1>sort <file_name> 2>sort n <file_name> 3>Write a C/C++ program. Use quick sort. 4>Write a C++ program. Use STL sort algorithm ANSWER>2 14. You can always return to your home directory by using the command 1>cd / 2>cd \ 3>cd HOME 4>cd .. 5>cd ANSWER>5

15. You are currently placed in trng directory placed under the directory training. The command to move the file file1 from trng directory to data directory placed under the directory training is: 1>mv file1 data 2>mv file1 data/. 3>mv file1 ../data/. 4>mv ../file1 ../data/. 5>mv file1 /data/. ANSWER>3 16. You are currently placed in data directory placed under the directory training. The command to copy the file file1 from data directory to trng directory placed under the directory training is: 1>cp file1 ../trng/. 2>cp file1 /trng/. 3>cp ../file1 ../trng/. 4>cp file1 /trng/. 5>cp file1 trng/. ANSWER>1 17. who | wc l What is the output of the following command if 10 users are connected? 1>It will display the list of all the users connected. 2>It will display an error in the command 3>10 4>None of the above ANSWER>3 18. Which unix command gives the number of lines , words and characters. 1>cat 2>ls 3>wc 4>grep filename ANSWER>3 19. Which option of sort allows you to sort data in descending order 1>-r 2>-o 3>-f 4>None of the above ANSWER>1 20. Which option of ls will allow you to display the files in reverse order 1>r 2>-r 3>R

4>-R</ 5>None of the above ANSWER>2 21. What command do you use to copy files from all sub directories to another directory 1>$cp -r Dir1 Dir2 2>$cp -i Dir1 Dir2 3>$cp -a Dir1 Dir2 4>$cp -m Dir1 Dir2 ANSWER>1 22. The command used to slice the files horizontally is 1>cut 2>paste 3>head 4>cat ANSWER>3 23. In the following command $paste -d ;: Student1 Student2 1>-d stands for define 2>-d stands for difference 3>-d stands for delimeter 4>None ANSWER>3 24. Which of the following commands will display the names of hidden files ? 1>ls h 2>ls a 3>ls l 4>ls x 5>ls p ANSWER>2 25. Which of the following commands will display the details of directories only of the current directory ? 1>ls d 2>ls -l | grep d$ 3>ls -l | grep ^d 4>ls -l | grep d^ 5>ls -l | grep $d ANSWER>3 26. Which character must be specified at the end of the command in order to execute that command in the background ? 1>&

2>^ 3>% 4>$ 5># ANSWER>1 27. If there are 5 files in the current directory and if ls -l | wc -l command is given in the current directory, then the output of this command will be 1>5 2>all the filenames will be displayed 3>6 4>all the lines of all the 5 files. 5>syntax error will be displayed ANSWER>3 28. Which of the following escape sequences can be used to keep the cursor on the same line after displaying the output with echo command ? 1>\a 2>\b 3>\c 4>\k 5>None of the above ANSWER>3 29. ln -s <filename><linkfile> will create ----- link to the file 1>soft link 2>symbolic link 3>hard link 4>both 1 and 2 ANSWER>4 30. __________ is the command to append into the contents of a file 1>cat > filename 2>cat >> filename 3>cat < filename 4>cat >>> filename ANSWER>2 31. State TRUE/FALSE Using 'mv' command can we rename a file 1>TRUE 2>FALSE ANSWER>1 32. Which option of mkdir command allows you to create sub-directories in one single statement

1>w 2>-w 3>p 4>-p 5>None of the above ANSWER>4z 33. Which of these expressions shows the proper way to add the directory /usr/bin to your path? 1>PATH+=/usr/bin 2>PATH=/usr/bin 3>$PATH:/usr/bin 4>PATH=$PATH:/usr/bin ANSWER>4 34. Which of these commands will set the permissions on file textfile to read and write for the owner, read for the group, and nothing for everyone else? 1>chmod 046 textfile 2>chmod 640 textfile 3>chmod 310 textfile 4>chmod rw r nil textfile ANSWER>2 35. Which of the following represents an absolute path? 1>../home/abc.txt 2>bin/cat 3>abcd/ 4>/usr/bin/cat ANSWER>4 36. Which of the following pieces of information is not contained in the passwd file? 1>A users unencrypted password 2>A users login name 3>A users preferred shell program 4>A users group ID ANSWER>1 37. Which are the different ways knowing more about the command 1>man 2>help 3>information 4>All of the above ANSWER>1 38. State TRUE/FALSE: When you log in, the current directory is set to home directory. 1>TRUE

2>FALSE ANSWER>1 39. When do we use the command, ps e 1>List full process showing the PPID 2>Display All processes including user and system processes 3>Dipslay Processes of User 4>Displaying all Users processes. ANSWER>2 40. What would happen when a user executes the following command and enters the details as shown below? a) $ cat < test1 <enter> 1>The cat command will take each line of the file test1 as input and display it on VDU. 2>The cat command will take each line of the file test1 as Output and display it on VDU. 3>None of the above ANSWER>1

Unix & O.S 1 $cat <file1>file2 -ans file1 is created and contents of file1 is copied to file2 2 $cat <test After execution the standard input is reassigned to the default device. 3 Wht connects 2 or more cmds- pipe ( | ) 4 Wht is used to move one line down in VI editor - j 5 Wht is used to delete one line down in VI editor - x 6 Wht is used to quit frm VI editor without saving - :q! 7 Wht is used to save frm VI editor without quiting - :w 8 Both saving & quiting :wq 9 $echo$?? ---will display 0 if the cmd was successful Else 1 10. wht is absolute path? Referring file frm its root directory 11. wht is relative path? Referring frm current directory Eg home/ulka. 12.no newline \c is used. 13.wht cmd is used to move to the next line ? 14.\n newlinw is used 15.wht is the job of nop hup?the process can continue execution even after the hang up 16.wht is PID of init?1(PID process id ) 17.$ sleep 10 ---it will wait for 10sec 18.wht is the o\p of ? Ls-L >data Ls>data Both will display the same output 19. banner great >great ---great will be enlarged & stored in file name great 20.cat file1>file2>file3 Content are copied to both file2 & file3 21. wht is the PID of current shell? $$ 22. unix structure is said to be? TREE,HEIRARCHIAL,RELATIONAL 23.IF ANY CHANGES IN PERMISSION ARE TO BE DONE FOR A USER who is a owner then the option used is -o for owner(ans) -u for user

-g group 24. option used with mkdir? Answer is ( -p)

1.1 How do you get help about the command "cp"? help cp man cp cp ? ans:b

1.2 How do you list all the files that are in the current directory? list all ls -full ls -a ans:c

1.3 How do you rename file "new" in file "old"? mv new old cp new old rn new old ans:a

1.4 How do you visualize the content of file "not_empty"? type not_empty

cat not_empty more not_empty ans:b

1.5 How do you create a new directory called "flower"? newdir flower mkdir flower crdir flower ans:b

UNIX Quiz - Level 2 2.1 What is the command to search all files in your current directory for the word "plasmodium"? a>grep plasmodium * b>find plasmodium -all c>lookup plasmodium * ans:a

2.2 How do you print the first 15 lines of all files ending by ".txt"? a>print 15 .txt b>cat *.txt -length=15 c>head -15 *.txt ans:c

2.3 Make a copy of file "upper" in the directory two levels up. a>jump -2 upper b>cp upper ../.. c>cp upper -2/ ans:b

2.4 Count the files you own in all your directories. a>ls -lR | grep myusername | wc -l b>ls -a | cnt * c>ls -n ~myusername ans:a

2.5 Change the current directory to /usr/local/bin a>mv /usr/local/bin b>cd /usr/local/bin c>setdir /usr/localbin ans:b 3.1 How do you change the access permission (add group read/write) to all the files in the current directory containing the word "cali" in their names? a>chmod g+rw *cali* b>setperm r+w *cali* c>chmod 0060 *cali* ans:a Unix 3 3.2 What is the command to find the differences in the lines containing "1999" between the files orig.txt and copy.txt, and add the result to file result.1999 a>diff orig.txt -d copy.txt | grep 1999 > result.1999 b>diffb orig.txt copy.txt | grep 1999 >> result.1999 c>grep 1999 *.txt >> result.1999 ans:b 3.3 How do you tell the server to use your local display (197.42.197.67) for X-windows? a>set display local b>setenv DISPLAY 192.42.197.67:0.0 c>setdsp x 192.42.197.67 ans:b

3.4 How do you uncompress and untar an archive called "lot_of_thing.tar.Z"

a>tar lot_of_thing.tar.Z | decomp b>zcat lot_of_thing.tar.Z | tar xvf c>tar xvf lot_of_thing.tar.Z ans:b

3.5 Create a new file "new.txt" that is a concatenation of "file1.txt" and "file2.txt". a>cat file1.txt file2.txt > new.txt b>make new.txt=file1.txt+file2.txt c>tail file1.txt | head file2.txt > new.txt ans:a

UNIX QUESTION 1).Which one of the following is the Correct syntax to declare a variable in PL/SQL a. variablename datatype := b.declare variable variablename datatype := c.variable variablename datatype := d. variablename variable datatype := Ans: 2).To list all the files and directories of current directory... a. $ls -d b. $ls | grep $"[^d]" c. $ls | grep "[d^] d. d$ls | grep "[d$] e. $ls | grep "[$d] Ans. To list all the files and directories ls is the option. (A) seems to be correct

3).What is the value of j after execution of this statement? a.None b.7 c.8 d.9 Ans. 4) What will be the output of the following command .$val1=10; val2=25; $ x:=${val1-val2:=35} $ echo $x; Ans: 5) What is output of value of x(something like this) a.10 b.25 c.35 d.Error e.No value of x Ans: Error 6). We can remove only one file at a time a. True b. false Ans: B) False 7). What will be the output of the following command $echo $? a) Exit status of the previous command. b) Process id of the previous command. c) Previous command status. d) Displays $? Ans: Exit status of the previous command 8). What will be the output of the following command $echo * a) It will display * b) It will display all the files of the current directory c) It will not display anything ie blank

d) Error. Ans: B) It will display all the files of the current directory 9). What will be the output of the following command $rmdir dir1 dir1/dir2/dir3 a. remove dir1 only b. remove dir1, dir2 and dir3 c. remove only dir3 Ans: Remove dir1 only 10).Which is the correct format to print full month using the date command? a.%m b.%M c.%B d.%b Ans: C ---- %B 11).Minimum no. of joins to avoid cartesian products of tables a.n-1; b.n-2; c.n-3; Ans: 12). Which command will give the WRITE PERMISSION to the user a)1 b)2 c)3 d)4 e)5 f)6 g)7 Ans: 13).Which option will print the files in reverse order? a) r b)R c)-r d)-R Ans: Ans c) -r

14).How will be the declaration of a variable of identical data type ,as student_id of student a) v_id student_id%TYPE b) student_id number; c) number student_id Ans:. 15).Conditional predicates in a trigger body a) Updating b) Insert c) Delete d) select Ans: 16). Raised exceptions are handled in seperate routines called a) exception handlers b) exception statement c) exception blocks d) excution section Ans. 17).What does this command will do $cat test.doc Ans: (a).displays the contents of file test (b).0 (c).1 (d).none. Ans) a) displays the contents 18) Command to get total no of words,lines,characters from a file 'data'? a) wc l data b) wc w data c) wc c data d) wc data Ans. D) 19) Exit statement used to terminate from which options a) switch construct b) if construct c) loop construct d) while construct Ans : c) loop construct

20) What will the following command will do ? $cut -c 3-5 data1 a) Displays 3 char from 5th position b) Displays 2 char from 1st position. c) Displays 2 chars from 3rd position. d) Displays 5 chars from 3rd position Ans: It should display 3rd to 5th characters of every line. None of the options seems ok to me 21)What will be the output of the following command Cat < data a) Takes output from the file and displays them on stndrd output.. b) Takes the values from the stndrd input. c) Displays the contents of the file data d)none Ans: c) Displays the contents of the file data 22) What will be the output of the following command $ ls sample* a)Displays hidden and non hidden files starting with sample. b).displays non hidden files starting with sample. c).displays non hidden files ending with sample. d)displays all files and dirs starting with sample and after sample. Ans: d)displays all files and dirs starting with sample and after sample. 23) What will be the output of the following command $ date;sort a) Displays the system date and then prompts for the user input. b) Takes the system date and waits for the file to be sorted. c) Displays the system date and then prompts filename. d) Error. Ans: a) Displays the system date and then prompts for the user input. Not sure but make a check 24) What will be the output of the following command echo "The sum is x='expr 20+30' ; echo $x; a)The sum is : 50 b) 50 c) Error

Ans: Just check whether back quotes are used or single quotes are used. If single quotes are used in expr then error else a) option is the answer 25) Find the error(if possible) in the following snippet of code Begin v_ref+10=v_fnum +v_lnum; dbms_output.put_line('sum is',vref); end; { Choose more than 1 answer} a) = operator cant be used on the left hand side for the variable declarations. b) v_ref and v_fun should be declared. c) Incorrect declaration. d) Error. Ans:

26) A variable that stores column value needs to have the same name as column (T/F)? Ans: 27) What will the following command do Cat>file1> dest1 >dest2 2> dest 3 a) file1 contents are in dest3 and dest1 and dest 2 is empty b) file1 contents are in dest1 and dest2 and dest3 are empty. d) file1 contents are in dest1 and dest2 and dest3 are empty. Ans: Not sure 28) What the following command will do $ mkdir p .\a\b\c (Not confirmed about the options, please provide the correct answer) It will create directory a with sub-directory b which will further have sub-directory c. 29) Which one gives the absolute path. a) ..\a\b b) \usr\bin\cat c) \bin\cat\ d) ..\home\usr\dir

Ans: b 30) Which wild card character will be used to display more than one character. a)* b)[] c) ? d) / e) \ Ans: aits actually zero or more characters 31)What will be the output of the following command. $ rm test[1-3].txt a) Remove test1,test2,test3 with .txt extension. b) Removes test1 or test2 or test and ending with .txt. c) Error cannot include range in []. d) Removes test1 and test3. Ans: Remove test1,test2,test3 with .txt extension.

1. ---------------- option is to list in reverse order.


a) b) c) d) d n r a

2. ---------------------command to get information of a command.


a) b) c) d) man help info all of the above

3. To append a file, what is the right way.


a) cat>file b) cat>>file c) cat<<file e) cat<>file

4. Set of environment variables

a) b) c) d)

Hone,Path,PS1 $Home,$Path,$PS1 $home none of the above

5. -----------------redirects command out


a) b) c) d) &amp: >filename :>filename a:>filename none of the above

6. If the value=ls|grep;echo $value


a) b) c) d) ls|grep ls|grep error none of the above

7. To display the last 20 lines of a file


a) b) c) d) tail -20 <filename > tail +20 <filename> home -20 <filename> none of the above.

8. Shell is a ----------------------a) b) c) d)

programming language layer between kernel and user command interpreter all of the above

9. ------------------ is a metacharacter
a) b) c) d) ? \ * $

10.Ending of case block is ---------------a) esac b) case end c) end d) none of the above 11.Searching for files with specific string using -------------a) find b) grep

c) find & grep d) find grep 12. a) b) c) d) Shell scripts cannot be used for system administration open communication implementing data structure non-portable application

13. Files are searched based on name and extension using -----------a) find b) search c) grep d) locate 14. Shell scripts begin with a) # b) % c) & d) $

15. #!/bin/bash while[! z$1] do echo $1; shift done a) b) c) d) shift is not used peoperly error message no such command syntax error run-time error

16. To list the details of a file, using ---------------a) ls b) cd . . c) cd d) none of the above Note: ls just gives the list of file. ls-l only will give the details of file. 17.Which is a type of shell ?

a) Korn b) corn c) hash d) bad 18.Redirection is used for a) inter-process communication. b) to connect one process to another c) d) none of the above 19.To locate the beginning of file with a and ending with a . followed by a number ------------------a)cat a*. ?? [0-9] b) cat a?? *[0-9] c) cat a*[0-9] d) none of the above 21. Positional parameters where the values are positioned using e) $1,$2 etc b) $1,2,$3 etc c) 1 22. Cut d f 5- file1 a) 5th field onwards to cut b) 5th field from the beginning to cut c) 6th field from the end to paste d) none of the above 23. How to end the statement at the end of every case? a) ;; b); c): d):: 24.export is used for a) making child shells to see their parent shells b) making sub-programs to see the shell variables c) none of the above d)for displaying errors 25. #!/bin/sh and #!<whitespace>/bin/sh ----------what is the difference between these two statements? c) nothing b) syntax error

c) run-time error d) all of the above 26. a=20; echo a d) a will be displayed b) runtime error c) 20 is diaplayed d) syntax error 27. In bash shell, using appropriate commands you have found out list of available jobs process ids, you are interested in one particular process job but unfortunetly it is runnig in the background. How will you make it run in the foreground. e) I will use cmd %fg.

1) How are shell variables assigned in C shell & Bourne shell(Syntax) 2) How will you find a file and delete directory and execute. Ans: is this syntax correct Find/path-type d- exec command / * { }; 3) what is true of Inode? a) there is a unique inode allocated for each active file , each current directory, each mounted on file, text file and the root. b) An node is named by its device/ I-number pair c) An inode is the pid of the current process Options: 1) a & b 2) a & c 3)b & c 4) You have a file with numerical data in it(i.e file with list of number in it) to sort this data which command/ method you will prefer most. Assume that list is reasonably small and quick o/p is high priority. a) write a c++ program, use STL sort algorithm b) write a c/c++ program use quick sort c) sort d) sort n 5) shell scripts cannot be used for which of the following: I sytem administrator II open source applications III implementing data structure IV non portable applications Options: 1) I & II 2) II & III 3) only III

4) only IV 6) shell is a a) programming language b) layer between kernel and user c) command interpreter d) all 7) _________ is a meta character a) ? b)\ c)* d)$ 8) searching for files with specific string using a) find b)grep c)find & grep d) find grep 9) shell scripts cannot be used for a) system administration b) open communication c) implementing data structure d) non-portable application options: i) a and b ii) b and c iii) only c iv) only d 10)what is the o/p? #!/bin/bash while[!-z $1] do echo $1 shift done a) infinite loop with first and the parameter echoed during each loop cycle b) list of all command line parameter passed c) error message/ message indicating no such command for shift d) infinite loop with first command line parameter echoed during each loop cycle. 11)filesa are searched based on name and extension using a) find b)search c)grep d) locate 12) shell scripts begin with a) # b) % c)& d)$

13) # /bin/bash

while[!-z $1] do echo $1; shift done a) shift is not used property b) error message no such command c) syntax error d) run-time error 14) to list the details of a file using a) ls b) ls-l c) cat d)none 15) redirection is used for a) interprocess communication b) to connect one process to another c) none of the above 16) After child process generated immediately what is the PID of it a) 0 b)>1 c) -1 d)none 17) diff between #!/bin/sh and #! <White space>/bin/sh a) nothing b) interpreter gives one error on some flavour of unix c) because #! Is a 4 byte magic number d) b and c 18)I communication between related process II communication between unrelated process III to avoid files in IPC IV none of the above Ans:- a) I & II b) II & III c) III & IV d) None 19)To locate the beginning of a file with a and followed by any character then . then 2 characters followed by a number a) cat a*.??[0-9] b) cat a??*[0-9] c) cat a*[0-9] d) none 20) cut d f5 file1 a) 5th field onwards to cut b) 5th field from beginning to cut c) 6th field from the end to paste d) none 21) all lines begin with a number a) ^[0-9] b) [^0-9] c) ^[#]

d) [0-9]. * $ 22) !#1 bin/bash error is shown on stderr however script 23) export is used for a) making child shells to see their parent shells b) making sub programs to see the shell variables c) none of the above d) for displaying errors 24) syntax a) b) c) d) for tr command to delete a new line from a file tr-d \n <xyz.txt tr-d \r\n <xyz.txt tr. c\r\n <xyz.txt tr \n <xyz.txt

Note: It must be either a or b, because tr command accepts 2 parameters only. 25)For the command on a execute folder named test /bin/chmod a-x test a)user will not be able to create any sub-directory b) user will not be able to list the content of this folder c) user will not be able to browse through the folder and subfolder d) all the above 26) when unix is installed which of the following is automatically installed a) c++ b)c c)perl d) visual Basic Note: I guess it is C

1>The command which tells how many users are presently logged in? A.WHO

2>Which option creates multiple links in Unix file system? A.ln 5>The command rm test[1-3].txt A.deletes test1.txt,test2.txt,test3.txt 6>which method is used to prevent overriding of files? A.noclobber 11>DATE : 07/06/06$JULY is got by executing A.Date +date %d$b 12> cat test1 test2 test3>test4. what is the output of the following command?? If test1 hello Test2 hi Test3 how r u A.hello hi how r u 19>Which is the command which helps to find the location of another command in unix?? A.which

S-ar putea să vă placă și