TCS PA Unix MCQs

TCS PA Unix MCQs


1.To copy two files in a new files ?
cat file1 file 2 > file 3
 

2.To sort the records from large to small number and print the largest number ?
 Option with Desc limit 1
 

3.Grep tata.*services$//multiple answer question
which has tata --service –may contain anything like consultancy , conference etc..
 

4.To remove a folder  which have files
1.rm –rf
2.rmdir –l
3.rmdiv
4.rmAns:
 

5.Grep –v java// multiple answer question
options which doesn’t contain the java word in the line is the answer
 

6.S=0 {s=s+$2}
Avg of second column
Sum of second column
 

​7.Unix command to remove duplicates in line  ?
1.sort –u
2.sort unique
3.uniq
4.unique
 

8.What is output of below commands.. ?
grep –o cat animal.txtgrep ‘cat’ animal.txt
1.cat cat
2.Cat Cat
3.None cat
4.none of these
 

9.File and directory permission access will be done by which command ... ?
chmod
 

10.On update cascade ensures what .. ?
1.Data integrity
2.Normalization
3.Materialized
4.All
 

11.Delete lines from ‘this’ file .. ?1.Sed/’this’/d file2.Delete –f this file3.Sed/this/file4.Sed/this/d fileAns : 1
 

12.String ‘llp’ file case insensitive.. ?
1.Grep –i‘llp’ file.txt
2.Grep –wi‘llp’ file.txt
3.Grep –w ‘llp’ file.txt
 

13.Compress file in unix.. ?
1.Compress
2.Comp
3.Zip
4.gzip
 

14.Pattern match at beginning of file ?
1.Pat^
2.Pat$
3.$pat
4.^pat
 

15.Length of longest file .. ?
1.Wc -cl
2.Wc –L <filename>
 

16.Sort file1| uniq–u
1.Sort the file name file 1 and diplaysdistinct lines
2.Find unique lines and sort
3.Command has syntax error
4.Sort the file and display duplicate lines
 

17.Query to delete primary key constraints .. ?     
Drop
 

18.To print first line from file1.txt use,
1.echo $1 file1.txt
2.awk 'NR==1' file1.txt   
3.head -1 file1.txt     
4.sed -n '1p' file1.txt
 

19.What is output of below command 
awk'BEGIN{s=0 while(s<55){print s; ++s}}'
1. prints 0 to 54 number
2. prints 0 to 55 number
3. syntax error.     
4. infinite loop


20.To count only words from which command is used ?
1.wc filename
2.wc -w filename
3.wc -word filename
 

21.S=S+$2.. ?
1.avg of second column
2.sum of second column
3.None


22._____displays all environment variables
1.environ
2.env
3.HOME
4.HOM

 

23.in order to determinvalue of a variable use the command?
1.echo
2.cat
3.ls
4.set
 

24.What is unix?
1.an operating system
2.programming language
3.software
4.editor
 

25.What are three main components of the Unix Architecture
1.kernel,data,PC
2.pcb,utilities,shell
3.shell,kernel,shared memory
4.kernel,shell,utilities
 

26.When a process finished its execution and exit status not received by the parent, the process state becomes...
1.new
2.stopped
3.orphan
4.Zombie

Comments